awtk/tools/font_gen/README.md
2018-11-28 09:13:50 +08:00

30 lines
661 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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