PDA

View Full Version : How to get 3D points from true type font?



HanWu
06-08-2005, 12:10 AM
Does anyone know how to get the 3D points (contour of the font) from a true type font? I am currently doing a project that require to convert the true type font into a 3D polyline. Hope someone could show me some hints or any website to get the information regarding to this problem. Thanks.

T101
06-08-2005, 12:17 AM
If you just want it for text rendering have a look at this.

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=14

If not, you'll have to render the character to a monochrome bitmap (freetype can do that for you), do an edge detect (i.e. find the pixels that differ from their neighbours), then turn the edge pixels into vertices and extrude.
A lot of work, and you'll probably get more vertices than you actually need.

[EDIT] Or see if you can find the specifications on the truetype format, and then parse the definitions. After all, characters are defined as lines and arcs in TT.

SeskaPeel
06-08-2005, 02:28 AM
Freetype handles everything you need for arcs and contour. Still you'll need to extrude from those points by yourself.
http://www.freetype.org

You can find an implementation of what you want to achieve here : http://homepages.paradise.net.nz/henryj/code/#FTGL

And I would not advise doing font rendering as shown in the NeHe example, that is full of bad practices, and completely texture space ineficient.

SeskaPeel

HanWu
06-08-2005, 11:53 PM
Originally posted by SeskaPeel:
Freetype handles everything you need for arcs and contour. Still you'll need to extrude from those points by yourself.
http://www.freetype.org

You can find an implementation of what you want to achieve here : http://homepages.paradise.net.nz/henryj/code/#FTGL

And I would not advise doing font rendering as shown in the NeHe example, that is full of bad practices, and completely texture space ineficient.

SeskaPeelI agree with you, the font rendering method from the NeHe example is very slow when dealing with a big number of string. Using FreeType is a good idea, but the problem is I develop my project with C# using Tao framework. I don't know how to include the .lib (FreeType) file from visual c++ to C#. Do you have any idea how to do it? Thanks.