Search code examples
imagefontstruetype

extract font character image from ttf file


Does anyone knows how to extract the characters image from a font(ttf) file?


Solution

  • TTF is a vector format, so there are no characters shapes, really. Load the font, select it into a device context (a memory one), render a character, grab a bitmap.

    Relevant APIs: AddFontResource, CreateFont, CreateDC, CreateBitmap, SelectObject, TextOut (or DrawText).