Procházet zdrojové kódy

【文档,自述】优化终端显示说明与字宽显示解释

- 更新英文 README 中的 "TUI display optimization" 标题为更准确的
  "Terminal User Interface Display Optimization"
- 优化中英文 README 中的终端符号显示示例,使用更具可读性的线框图
- 增加关于字符宽度显示优化的详细说明,解释全角与半角字符在 PSF2
  字体中的显示问题及 font-xibo 的解决方案
- 添加“第三十二个字符”的说明,解释其在 TTY 中的默认行为和作用
- 插入旧版显示效果截图链接,增强文档可视化说明
- 更新许可证部分,感谢 syllazh 项目的前瞻性探索
- 插入新增的 display_old.png 二进制图片文件,用于展示旧版显示问题
PJ568 před 1 rokem
rodič
revize
957c472762
4 změnil soubory, kde provedl 77 přidání a 25 odebrání
  1. 37 12
      README.en.md
  2. 39 12
      README.md
  3. 1 1
      VERSION
  4. binární
      assets/display_old.png

+ 37 - 12
README.en.md

@@ -15,18 +15,18 @@ When using this font, you may notice that characters with similar pronunciations
 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
+### Terminal User Inerface 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:
@@ -36,18 +36,41 @@ This font also optimizes the mapping of commonly used graphical symbols in termi
 - After optimization:
 
   ```plaintext
-  r-T-┐
-  | | |
-  ├-+-┤
-  | | |
-  L-┴-J
+  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.
+  This type of mapping maximizes the improvement of display quality without occupying more glyphs (:-D).
 
   ![btop with font-xibo](assets/btop.png)
 
+### Character Width Display Optimization
+
+In regular text display scenarios:
+
+- **Full-width characters** (such as Chinese characters and symbols in GB2312) have a display width of two units (occupying two character positions) and a height of one character line (occupying one line height);
+- **Half-width characters** (such as English letters, Arabic numerals, and ASCII punctuation) have a display width of one unit and the same height as one character line.
+
+This means: Chinese characters and symbols in GB2312 encoding are full-width, while ASCII characters and English symbols (such as 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.
+This leads to:
+
+- If all characters are displayed with a width of one unit: full-width characters only show the left half, with the right half displaying the [thirty-second character](#thirty-second-character);
+- If all characters are displayed with a width of two units: all half-width characters occupy two columns, but visually only have a width of one unit, resulting in [large gaps between half-width characters](assets/display_old.png).
+
+Given the high difficulty of finding or designing "tall and narrow half-width monospace Chinese fonts" or "compatible full-width English letter fonts",
+font-xibo maps all English letters, Arabic numerals, ASCII punctuation, and other characters to full-width characters in the UTF-8 high range.
+Although each Chinese character is still separated by a [thirty-second character](#thirty-second-character), font-xibo achieves a relatively balanced visual appearance overall.
+
+### Thirty-second Character
+
+The thirty-second character in Linux TTY fonts defaults to `U+20`, which is a space. This character is used to fill positions in the background where no character is present.
+
 ## Building the Font
 
 1. Clone the repository:
@@ -85,6 +108,8 @@ Place `xibo.psfu.gz` in the `consolefonts` directory (located at `/usr/share/con
 
 ## License
 
+> Thanks to [oldherl](https://github.com/oldherl) for their forward-looking technical exploration project [syllazh](https://github.com/oldherl/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 the `scripts/` directory in this repository follow the [GNU GENERAL PUBLIC LICENSE Version 3](LICENSE),

+ 39 - 12
README.md

@@ -4,7 +4,9 @@
 
 ## font-xibo
 
-xibo 是一个为 Linux 设计的中文 TTY 字体,旨在在不安装诸如 [cjktty](https://github.com/zhmars/cjktty-patches) 等内核补丁且不安装 [kmscon](http://www.freedesktop.org/wiki/Software/kmscon)、[fbterm](https://salsa.debian.org/debian/fbterm) 或 [zhcon](https://zhcon.sourceforge.net/) 等第三方软件的环境下提供 TTY 中文显示。
+xibo 是一个为 Linux 设计的中文 TTY 字体,旨在在不安装诸如 [cjktty](https://github.com/zhmars/cjktty-patches) 等内核补丁,
+且不安装 [kmscon](http://www.freedesktop.org/wiki/Software/kmscon)、[fbterm](https://salsa.debian.org/debian/fbterm)
+或 [zhcon](https://zhcon.sourceforge.net/) 等第三方软件的环境下提供 TTY 中文显示。
 
 本项目的灵感来源自 [syllazh](https://github.com/oldherl/syllazh/) 字体。
 
@@ -22,11 +24,11 @@ xibo 是一个为 Linux 设计的中文 TTY 字体,旨在在不安装诸如 [c
 - 原符号:
 
   ```plaintext
-  ┌─┬─┐
-  │ │ │
-  ├─┼─┤
-  │ │ │
-  └─┴─┘
+  ┌───┬───┐
+  │   │   │
+  ├───┼───┤
+  │   │   │
+  └───┴───┘
   ```
 
 - 优化前:
@@ -36,18 +38,41 @@ xibo 是一个为 Linux 设计的中文 TTY 字体,旨在在不安装诸如 [c
 - 优化后:
 
   ```plaintext
-  r-T-┐
-  | | |
-  ├-+-┤
-  | | |
-  L-┴-J
+  r---T---┐
+  |   |   |
+  ├---+---┤
+  |   |   |
+  L---┴---J
   ```
 
   其中,`┌` 被映射为字母 `r`,`┬` 被映射为字母 `T`,`┘` 被映射为字母 `J` 等。
-  此类映射在尽量不占用更多字形的情况下最大程度地改善了显示效果。
+  此类映射在尽量不占用更多字形的情况下最大程度地改善了显示效果(:-D)。
 
   ![font-xibo 在 btop 下的表现](assets/btop.png)
 
+### 字宽显示优化
+
+在常规情景的文本显示中:
+
+- **全角字符**(如 GB2312 中的汉字和中文符号)的显示宽度为二个单位(占用两个字符位置),高度为一个字符行(占用一行高度);
+- **半角字符**(如英文字母、阿拉伯数字、ASCII 标点符号)的显示宽度为一个单位,高度同为一个字符行。
+
+也就是说:GB2312 编码中的汉字和中文符号为全角,而 ASCII 字符和英文符号(如逗号、句点)通常为半角。
+
+然而,PC Screen Font 2(PSF2)是一个固定宽度的位图字体格式,不支持在单个字体中存在不同大小(宽度)的字符。
+导致,若:
+
+- 所有字符以宽一个单位显示:全角字符仅显示左半截,右半截显示为字体中的[第三十二个字符](#第三十二个字符);
+- 所有字符以宽二个单位显示:所有半角字符占满两行,但视觉宽仅一单位,导致[两个半角字符间有大空隙](assets/display_old.png)。
+
+鉴于寻找和设计“瘦高半角等宽汉字等字体”或“适配的全角英文字母等字体”的高难度。
+font-xibo 将所有英文字母、阿拉伯数字、ASCII 标点符号等字映射为 UTF-8 高位的全角字符。
+虽每个汉字间仍被一个[第三十二个字符](#第三十二个字符)隔开,font-xibo 在总体视觉上达到相对平衡。
+
+### 第三十二个字符
+
+Linux TTY 默认第字体的三十二个字符为 `U+20`,既空格。这个字符被用来填充背景中没有字符的位置。
+
 ## 构建字体
 
 1. 克隆仓库:
@@ -85,6 +110,8 @@ xibo 是一个为 Linux 设计的中文 TTY 字体,旨在在不安装诸如 [c
 
 ## 许可协议
 
+> 感谢 [oldherl](https://github.com/oldherl) 的前瞻技术探索项目 [syllazh](https://github.com/oldherl/syllazh/);
+>
 > 感谢 **TakWolf** 及其团队提供的 `fusion-pixel-font` 字体。
 
 本仓库中的脚本文件 `build.bash`、`build_font_from_bdf.py` 和 `scripts/` 中的所有文件遵循 [GNU GENERAL PUBLIC LICENSE Version 3 许可协议](LICENSE),

+ 1 - 1
VERSION

@@ -1 +1 @@
-1.0.0
+1.0.1

binární
assets/display_old.png