TTF glyph rendering using Python

2.6k Views Asked by At

I am trying to generate bitmaps for certain glyphs from a TTF file and realized that there are no ready solutions for that when you are trying to generate glyphs without a cmap entry. I am working with an indic font so I need to extract some half glyphs for example.

I found fonttools and was able to parse my TTF file with it. I could verify that I indeed have objects for all the glyphs that can be viewed in a glyph viewer. I am now trying to find out if fonttools or any similar library can be used to render these glyphs as bitmaps?

Screen grabbing from the glyph viewer is not an option as the quality of the images cannot be influenced. I found a lot of tools where I can influence the quality but then have no means of generating half or compound glyphs.

Any help in this regard will also be appreciated.

1

There are 1 best solutions below

1
On

The Python Image Library - and its up-to-date fork, Pillow - can load a truetype font and render text from it. See the ImageFont docs.