层峦(cengluan)是一个为 Linux 设计的中文 TTY 字体,旨在在不安装诸如 cjktty 等内核补丁且不安装 kmscon、fbterm 或 zhcon 等第三方软件的环境下提供 TTY 中文显示。
|
|
10 bulan lalu | |
|---|---|---|
| .github | 1 tahun lalu | |
| FONT-LICENSE | 1 tahun lalu | |
| assets | 10 bulan lalu | |
| original | 10 bulan lalu | |
| scripts | 10 bulan lalu | |
| .gitignore | 10 bulan lalu | |
| CONTRIBUTING.md | 2 tahun lalu | |
| LICENSE | 2 tahun lalu | |
| MIT-LICENSE | 1 tahun lalu | |
| README.en.md | 10 bulan lalu | |
| README.md | 10 bulan lalu | |
| SIL-LICENSE | 1 tahun lalu | |
| VERSION | 10 bulan lalu | |
| build.bash | 10 bulan lalu | |
| build_font_from_bdf.py | 10 bulan lalu | |
| build_font_from_bdf_new.py | 10 bulan lalu | |
| requirements.txt | 2 tahun lalu |

ENGLISH | 简体中文
cengluan is a Chinese TTY font designed for Linux, aiming to provide Chinese display in TTY without installing kernel patches like cjktty, nor third-party software such as kmscon, fbterm, or zhcon.
This project is inspired by the syllazh font.
When using this font, you may notice that Chinese characters with similar pronunciations are displayed as the same character. For example: any character from "用永勇拥擁涌湧咏詠蛹雍踊庸踴泳" will be uniformly displayed as "用".
This is because fonts on Linux TTY are generally changed using the setfont tool from the kbd package, which supports up to 512 glyphs, but a single glyph can be mapped to multiple Unicode code points. Therefore, font-cengluan maps all Chinese characters with the same syllable (ignoring tones) to the same glyph, enabling Chinese display with a limited number of glyphs.
This font also optimizes the mapping of commonly used graphic symbols in terminals to make it more suitable for terminal use. Some examples:
Original symbols:
┌───┬───┐
│ │ │
├───┼───┤
│ │ │
└───┴───┘
Before optimization:
?????????
? ? ?
?????????
? ? ?
?????????
(Cannot be displayed properly)
After optimization:
r---T---7
| | |
├---+---┤
| | |
L---┴---J
Here, ┌ is mapped to the letter r, ┬ to T, ┘ to J, etc.
Such mappings maximize display improvement while minimizing the use of additional glyphs (:-D).
In conventional text display scenarios:
That is: Chinese characters and symbols in GB2312 encoding are full-width, while ASCII characters and English symbols (like commas, periods) are typically half-width.
However, PC Screen Font 2 (PSF2) is a fixed-width bitmap font format that does not support characters of different sizes (widths) within a single font. Consequently:
Given the high difficulty of finding or designing "tall, thin half-width monospaced Chinese character fonts" or "compatible full-width English letter fonts", font-cengluan adopts two design approaches:
Although each full-width character is still separated on the right by a 32nd character, font-cengluan achieves a relatively balanced visual appearance overall.
In Linux TTY, the 32nd character of the default font is U+20, i.e., a space. This character is used to fill positions in the background where no character is present.
Clone the repository:
git clone https://github.com/PJ-568/font-cengluan.git
cd font-cengluan
Install dependencies:
pip install -r requirements.txt
Build the font:
bash build.bash
During the build process, the script will install psftools for font generation.
After building, a PSF2 font file named cengluan.psfu.gz will be generated in the output/ directory.
Ensure the
setfontcommand is version2.6rc1or higher. Versions before2.6rc1do not support fonts larger than 65535 bytes (≈64KB) before compression. After2.6rc1, this limit was raised to 4194304 bytes (≈4MB).Run
setfont -Vto check the version.
Place cengluan.psfu.gz into the consolefonts directory (located at /usr/share/consolefonts/ in Debian, /usr/share/kbd/consolefonts/ in Arch Linux). Then run setfont cengluan to change the font, or setfont -d cengluan to switch to double-sized font.
Thanks to oldherl for the forward-looking technical exploration project syllazh;
Thanks to TakWolf and their team for providing the fusion-pixel-font font.
The script files build.bash, build_font_from_bdf.py, and all files in scripts/ in this repository follow the GNU GENERAL PUBLIC LICENSE Version 3.
original/references/pinyin_hanzi in the original/references/ directory follows the GNU Lesser General Public License (LGPL) 2.1, while other reference files follow the Unlicense.
The font files generated by this project follow either the MIT License or the SIL OPEN FONT LICENSE Version 1.1. For original font upstream licenses, see the files under FONT-LICENSE/.
Refer to the Contribution Guide.