ttx-fonttools

fonttools convert ttf to woff2

不想你离开。 提交于 2021-02-08 07:42:43
问题 Currenly, I'm using fonttools(https://github.com/fonttools/fonttools) to convert font file ttf to woff2 by ttx command with 2 steps convert ttf to ttx then convert ttx to woff2 But it's too slow and ttx file to big, is there any way to convert ttf to woff2 directly by using fonttools to improve performance? 回答1: With fonttools installed in your Python (virtualenv, pipenv, etc): $ python >>> from fontTools.ttLib import TTFont >>> f = TTFont('path/to/your/file.otf') >>> f.flavor='woff2' >>> f

fonttools convert ttf to woff2

依然范特西╮ 提交于 2021-02-08 07:41:17
问题 Currenly, I'm using fonttools(https://github.com/fonttools/fonttools) to convert font file ttf to woff2 by ttx command with 2 steps convert ttf to ttx then convert ttx to woff2 But it's too slow and ttx file to big, is there any way to convert ttf to woff2 directly by using fonttools to improve performance? 回答1: With fonttools installed in your Python (virtualenv, pipenv, etc): $ python >>> from fontTools.ttLib import TTFont >>> f = TTFont('path/to/your/file.otf') >>> f.flavor='woff2' >>> f