<分区> 分区>
这是一个简短的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.
当我尝试渲染一个缺失的字形时,我得到一个空方 block 。
draw.text((10, 10), chr(1234), font=font)
- 如何以编程方式确定缺失的字形?
- 如何在 ttf 文件中列出可用的字形?
两个问题几乎一样。
I would prefer using Pillow to determine what I want. Other modules from PyPI are welcome as well.
