OpenGL true type font outlines

BlitzMax Forums/OpenGL Module/OpenGL true type font outlines

matibee(Posted 2012) [#1]
Has anyone got any idea where to start with generating font outlines? I need them vectorised, not bitmap.

I've been reading up on TrueType, and that will (or should) give me points and curves required for generating a glyph but it would be nice to do away with that step if possible.


SLotman(Posted 2012) [#2]
To just draw the outline, in real time, you could just draw the text with an offset:

Local x:int=100, y:int=100

SetColor 0,0,0
For local fx:int=-1 to 1
   For local fy:int=-1 to 1 
        DrawText "MyText", x+fx, y+fy

SetColor 255,255,255
DrawText "MyText", x,y

Of course, this won't give you a vector image, and this way to generate an outline isn't the best (try making big outlines, in several colors, and you'll see it degrades pretty bad compared to actual outlines rendered from the font shape).

I'm also looking for something similar to this - but what I need is a bitmap font generator, capable of making fonts with outlines (more than 1, with different sizes) and also with gradient... which doesn't appear to exist =(

matibee(Posted 2012) [#3]
Hi Slotman,

I'm starting to believe that want to do is achievable through the already included FreeType library. It even seems to have a stroke mode.

I might not be testing this for a week a two yet (hence letting this post hang for a while as it's such as slow board) but I'll report back.


SystemError51(Posted 2012) [#4]
Hey SLotman, I think THIS may be what you're looking for.

ImaginaryHuman(Posted 2012) [#5]
You can use the truetype library to get the actual curve data for the font and turn it into some kind of vectorgraphics, but if I recall you need truetype version 2 and blitz only comes with v1? Not sure on that.

matibee(Posted 2012) [#6]
Hi IH. I can plot vectors from the curve glyphs and according to mod\pub.mod\freetype.mod\include\freetype\freetype.h it's V2.1.10 so it should be good to go. In an ideal world I would have liked the code to plot the glyph points but it's probably in the FreeType source somewhere anyway.

SLotman(Posted 2012) [#7]
@SystemError51: I already tried that, and it's not what I need... unfortunately, it doesn't generate more than 1 outline :(

What I'm trying to achieve is this:

The "Exit" text has 2 outlines (see the "Appearance" tab from Illustrator), with 2 different sizes and on top of if the font rendered with a gradient.