2018-04-15 17:58:24 +08:00
|
|
|
|
# 字体工具
|
|
|
|
|
|
|
|
|
|
## 点阵字体生成工具
|
2018-04-01 11:34:05 +08:00
|
|
|
|
|
|
|
|
|
fontgen从指定的tff文件,提取指定字符集(从文件中读取)的glyph,生成C常量文件。
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
./bin/fontgen ttf_filename str_filename output_filename font_size
|
|
|
|
|
```
|
|
|
|
|
* ttf\_filename tff文件
|
|
|
|
|
* str\_filename 字符集合(UTF-8)编码
|
|
|
|
|
* output\_filename 输出的文件
|
2018-04-15 17:58:24 +08:00
|
|
|
|
* font\_size 字体大小
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## 从TTF字体文件中提取部分字体
|
|
|
|
|
|
|
|
|
|
可以使用fonttools中的pyftsubset工具提取:
|
|
|
|
|
|
|
|
|
|
安装:
|
|
|
|
|
```
|
|
|
|
|
pip install fonttools
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
示例:
|
|
|
|
|
```
|
2018-11-28 09:13:50 +08:00
|
|
|
|
pyftsubset ../../../fonts/msyh.ttf --text-file=../../demos/assets/raw/fonts/text.txt --output-file=../../demos/assets/raw/fonts/default.mini.ttf
|
2018-04-15 17:58:24 +08:00
|
|
|
|
```
|
|
|
|
|
|