有没有办法使用PIL来丢失字形? [英] Is there a way to fallback for missing glyphs with PIL?

查看:179
本文介绍了有没有办法使用PIL来丢失字形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用PIL(ImageFont,ImageDraw等)呈现文本时,如果字体缺少特定字符的字形,则会跳过该字符。我没有看到指定备用字体的文档中的任何机制。有没有一个尝试和真实的方法使用后备字体PIL缺失字形?

解决方案

如何做到这一点,但我找到了解决方法。我使用FontForge来填充主字体中缺失的字形,并使用另一种字体的备份字形。正如在这个答案解释: https://superuser.com/questions/490922/merging-two- font-in-one

唯一的问题是我运行的是OS X 10.11.3,目前FontForge的稳定版本刚刚死O / S。所以我不得不从源码建立FontForge。我按照这个页面上的自制说明做了:
https://github.com/fontforge/fontforge/blob/master/INSTALL-git.md


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?

解决方案

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

这篇关于有没有办法使用PIL来丢失字形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆