特定字形的子集字体 [英] Subset Font By Specific Glyphs
问题描述
我有一个14MB的TTF,其中大部分是简体中文字符.
I have a 14MB TTF containing mostly Simplified Chinese characters.
我想通过创建一个仅包含HTML页面中特定字符的子集来减小尺寸.
I'd like to reduce the size by creating a subset which only contains the specific characters within an HTML page.
因此,理想情况下,我想通过一个Linux程序传递一个文本块,并让其根据所包含的字符重新创建字体.
So, ideally, I'd like to pass a (Linux) program an block of text and have it recreate the font based on the characters contained.
例如
./magic-font-squisher input.tff "ABC123水小长"
或
./magic-font-squisher input.tff /path/to/test.html
新字体将只包含这9个字符.
The new font would then only have those 9 characters present.
推荐答案
已使用 https://bitbucket.org/philip/font-optimizer/src
./subset.pl --chars="ABC 123 水小长" input.ttf output.ttf
这正是我想要的.
我如何找到它
-string =:仅为指定的字符串生成子集.对...有用 创建菜单子集.通常我们使用来自Font的subset.pl 但是,为此进行了优化.
--string=: Generate subset for just the specified string. Useful for creating a menu subset. Generally we use subset.pl from Font Optimizer for this, however.
通过搜索Font Optimizer,我进入了演示网站,该网站可让您测试脚本.
A search for Font Optimizer took me to a demo site which allows you to test the script.
还有一个分叉的GitHub存储库具有更好的文档.
There is also a forked GitHub repo which has better documentation.
这篇关于特定字形的子集字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!