Here is a short example.
from PIL import ImageFont, ImageDraw
draw = ImageDraw.Draw(image)
# use a bitmap font
font = ImageFont.load("arial.pil")
draw.text((10, 10), "hello", font=font)
# use a truetype font
font = ImageFont.truetype("arial.ttf", 15)
draw.text((10, 25), "world", font=font)
I want to know if the font is missing any glyphs from the rendered text.
When I try to render a glyph that is missing I get an empty square.
draw.text((10, 10), chr(1234), font=font)
- How to programmatically determine missing glyphs?
- How to list available glyphs in a ttf file?
The two questions are almost the same.
I would prefer using Pillow to determine what I want. Other modules from PyPI are welcome as well.