Is there a way to fallback for missing glyphs with PIL?

余生长醉 提交于 2020-01-15 03:43:10

问题


When rendering text using PIL (ImageFont, ImageDraw, etc.) if the font is missing a glyph for a particular character, it just skips that character. I don't see any mechanism in the docs for specifying a fallback font. Is there a tried-and-true recipe for using a fallback font for missing glyphs in PIL?


回答1:


I couldn't figure out how to do this, but I did find a workaround. I used FontForge to fill in the missing glyphs in the main font, with backup glyphs from another font. As explained in this answer: https://superuser.com/questions/490922/merging-two-font-into-one

The only catch was that I'm running OS X 10.11.3, and the current stable release of FontForge just dies on that O/S. So I had to build FontForge from source. I did that following the "homebrew" instructions on this page: https://github.com/fontforge/fontforge/blob/master/INSTALL-git.md



来源:https://stackoverflow.com/questions/35436932/is-there-a-way-to-fallback-for-missing-glyphs-with-pil

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!