Since True Type fonts are just vectors, I was wondering if there was a way to get the vectors (array of points) for a letter given that i'm using the WinAPI. Thanks
Use the GetGlyphOutline function with the GGO_NATIVE option.
http://msdn.microsoft.com/en-us/library/dd144891%28v=VS.85%29.aspx
Actually, True Type fonts are defined by Bezier curves, not vectors, so you get back a list of curves. Most graphics libraries have a way of drawing Bezier curves anyway so you can get by just knowing that a curve is defined by several control points.
The font will be pre-fitted to a grid (eg, hinting).
I don't know if the Win32 API will give you a deconstructed glyph. The FOSS FreeType2 library provides glyph points in FT_Outline::points
.
Note that a glyph is more than its points. You have to work with Bézier curves and hinting to reproduce a glyph correctly. The hinting part is crucial for small fonts, and is extremely difficult to get right. FreeType usually does all this for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With