Chinese font files for the game

Game engines generally use the FreeType library to read font files.
In order to display Chinese, the engine generally requires the game to come with Chinese fonts (the system font situation is too complicated, making font selection difficult).

Font selection

Blackbody displays better on the screen, so you can use Siyuan Blackbody . Siyuan Songti is also good.
They all use SIL Open Font License .

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works.

Region Specific Subset OTFs Simplified Chinese (Simplified Chinese) font files of Siyuan Heidi are smaller.
For boldface font weight, use Normal or Regular.
For Song font, it looks better to use Normal or SemiBold.

Font subsetting and simplification

If the game does not have a chat function and uses fewer words, you can consider simplifying the fonts. This can be achieved using the pyftsubset subsetting function included in Python's fonttools.
Install:

py -m pip install --upgrade fonttools

Execute in the command prompt window:

pyftsubset SourceHanSansCN-Normal.otf --text-file=charlist.txt --output-file=zh_CN.otf

The charlist.txt file uses UTF-8 encoding and contains all characters that may be displayed (including non-Chinese characters).
The effect of streamlining:
Insert image description here
the number of words has been greatly reduced.
If you need to convert the font file to other non-OTF font formats, such as TTF, you can use FontForge to process it (first CID->Flatten, then File->Generate Fonts...).

reference

GB/T 16964.1-1997 Font Information Exchange Part 1 Architecture
GB 18030 Chinese Coded Character Set
GitHub: Siyuan Heidi
Zhihu: FontTools Font Subset
Zhihu: What is the font weight
FontForge: Menus

Guess you like

Origin blog.csdn.net/feiyunw/article/details/127409982