# ![Demo](assets/display.png) > ENGLISH | [简体中文](README.md) ## font-xibo Xibo is a Chinese TTY font designed for Linux, aiming to provide Chinese display in TTY without installing kernel patches such as [cjktty](https://github.com/zhmars/cjktty-patches) or third-party software like [kmscon](http://www.freedesktop.org/wiki/Software/kmscon), [fbterm](https://salsa.debian.org/debian/fbterm), or [zhcon](https://zhcon.sourceforge.net/). The inspiration for this project comes from the [syllazh](https://github.com/oldherl/syllazh/) font. ### Phonetic Characters When using this font, you may notice that characters with similar pronunciations are displayed as the same character. For example, any of the characters "用永勇拥擁涌湧咏詠蛹雍踊庸踴泳" 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 a maximum of 512 glyphs. However, a single glyph can map to multiple Unicode code points. Therefore, Xibo maps all characters with the same pronunciation (ignoring tones) to the same glyph, allowing for Chinese character display within the limited number of glyphs. ### TUI display optimization This font also optimizes the mapping of commonly used graphical symbols in terminals to make them more suitable for terminal use. Some examples: - Original symbols: ```plaintext ┌─┬─┐ │ │ │ ├─┼─┤ │ │ │ └─┴─┘ ``` - Before optimization: (Cannot be displayed correctly) - After optimization: ```plaintext r-T-┐ | | | ├-+-┤ | | | L-┴-J ``` Among these, `┌` is mapped to the letter `r`, `┬` is mapped to the letter `T`, `┘` is mapped to the letter `J`, etc. This type of mapping maximizes the improvement of display quality without occupying more glyphs. ![btop with font-xibo](assets/btop.png) ## Building the Font 1. Clone the repository: ```shellscript git clone https://github.com/PJ-568/font-xibo.git cd font-xibo ``` 2. Install dependencies: ```shellscript pip install -r requirements.txt ``` 3. Build the font: ```shellscript bash build.bash ``` During the build process, the script will install `psftools`, which is used to generate the font. After building, a PSF2 font file named `xibo.psfu.gz` will be generated in the `output/` directory. ## Using the Font > Ensure that the version of the `setfont` command is `2.6rc1` or higher. > Versions prior to `2.6rc1` do not support fonts larger than 65535 (approximately 64KB). > After `2.6rc1`, the limit has been relaxed to 4194304 (approximately 4MB). > > Run `setfont -V` to check the version. Place `xibo.psfu.gz` in the `consolefonts` directory (located at `/usr/share/consolefonts/` on Debian and `/usr/share/kbd/consolefonts/` on Arch Linux), then execute `setfont xibo` to change the font or `setfont -d xibo` to switch to a double-sized font. ## License > 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 the `scripts/` directory in this repository follow the [GNU GENERAL PUBLIC LICENSE Version 3](LICENSE), `original/references/pinyin_hanzi` in the `original/references/` directory follows the GNU Lesser General Public License (LGPL) 2.1, and other reference files follow the [Unlicense license](original/references/LICENSE), The font files generated by this project follow the [MIT license](MIT-LICENSE) or [SIL OPEN FONT LICENSE Version 1.1](SIL-LICENSE). For the original font upstream licenses, see the files in [`FONT-LICENSE/`](FONT-LICENSE/). ## Contributing Refer to the [Contribution Guide](CONTRIBUTING.md).