我有一个 14MB 的 TTF,其中大部分是简体中文字符。
我想通过创建一个仅包含 HTML 页面中特定字符的子集来减小大小。
因此,理想情况下,我想向(Linux)程序传递一段文本,并让它根据包含的字符重新创建字体。
E.g.
./magic-font-squisher input.tff "ABC123水小长"
or
./magic-font-squisher input.tff /path/to/test.html
新字体将仅包含这 9 个字符。
你可以这样做脚本 FontForge http://fontforge.org/scripting.html。这是可行的,尽管它可能会变得更聪明或包含在包含脚本中。
#!/usr/bin/env fontforge
Open($1); # first param
SelectAll();
SelectFewer(0u41, 0u43, 0u31, 0u33); # a range
SelectFewer(0u6c34); # or a single codepoint
SelectFewer(0u5c0f);
SelectFewer(0u957f);
DetachAndRemoveGlyphs();
Save($2); # second param
Quit(0);
我必须定义FONTFORGE_LANGUAGE
在运行之前:
FONTFORGE_LANGUAGE=ff ./squish source.ttf squished.ttf
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)