Original link: https://zburu.com/2022/05/24/106.html
Sharing a python library – fonttools, it is very convenient to deal with font files.
You need to download the python environment on your computer first, so I won’t say much about this.
Then enter on the local command line:
pip install fonttools
- Create a new folder locally, name it
fonts, you can do whatever you want. Put the fonts you need to compress and organize in a folder, such as
- Then create a file named
word.txt, then we need to find a common font library, here I share one on github https://github.com/zburu/cdn/blob/main/font/Chinese common fonts.txt , and copy the common fonts in it to the
pyftsubset OPPOSans.ttf --text=$(cat word.txt) --no-hinting
Let’s take a look at the command, where
OPPOSans.ttf is the font file,
word.txt is the common font, we want to separate these words separately.
The names can be according to their own requirements, but they must correspond to each other.
You can enter it on the command line. After the operation is completed, you can see the font file with the word
subset in the folder. The space occupied is greatly reduced, and it can be used directly.
This article is reprinted from: https://zburu.com/2022/05/24/106.html
This site is for inclusion only, and the copyright belongs to the original author.