Unicode Character Size Modifiers
Unicode Character Size Modifiers
In the terminal world, character width detection is not well defined and is context dependent, which is the cause of the following issues:
- No way to specify a custom width for displayed characters.
- No way to simultaneously display the same characters in both narrow and wide variants.
- No way to use triple and quadruple characters along with narrow and wide.
- Different assumptions about character widths in applications and terminal emulators.
- No way to display wide characters partially.
- No way to display characters higher two cells.
- No way to display subcell sizeв characters.
By defining that the graphical representation of a character is a cellular matrix (1x1 matrix consists of one fragment), the concept of "wide/narrow" can be completely avoided.
Terminals can annotate each scrollback cell with character matrix metadata and use it to display either the entire character image or a specific fragment within the cell.
Users can explicitly specify the size of the character matrix or select any fragment of it using codepoints from some range, e.g. 0xD0000-0xD02A2.
For character matrices larger than 8x4, pixel graphics should be used.
Encoding matrix fragments up to 8x4 in size requires four integer values, which can be packed into Unicode codepoint space by enumerating "wh_xy" values:
- w: Character matrix width
- h: Character matrix height
- x: Horizontal fragment selector inside the matrix
- y: Vertical fragment selector inside the matrix
Usage Examples
- Сharacters can occupy an arbitrary matrix of cells (up to 8×4) and can be displayed in fragments:
# cat ./text1.sh
#! /bin/bash
echo -e "Advanced T\U000D00B7e\U000D00B7r\U000D00B7m\U000D00B7i\U000D00B7n\U000D00B7a\U000D00B7l\U000D00B7"
echo -e "Terminal T\U000D00E4e\U000D00E4r\U000D00E4m\U000D00E4i\U000D00E4n\U000D00E4a\U000D00E4l\U000D00E4"
echo -e "Emulator ★\U000D0030★\U000D0030★\U000D0030★\U000D0030★\U000D0030★\U000D0030★\U000D005E\e[93m"☆\U000D005F☆\U000D0030\e[m"
# cat ./text2.sh
#! /bin/bash
echo -e "A\U000D0030d\U000D0030v\U000D0030a\U000D0030n\U000D0030c\U000D0030e\U000D0030d\U000D0030⚙\U0000FE0E\U000D005F"
echo -e "T\U000D0141e\U000D00B7r\U000D00B7m\U000D00B7i\U000D00B7n\U000D00B7a\U000D00B7l\U000D00B7"
echo -e "T\U000D016Ee\U000D00E4r\U000D00E4m\U000D00E4i\U000D00E4n\U000D00E4a\U000D00E4l\U000D00E4"
echo -e "T\U000E019BEmulator\e[93m"★\U000D0030★\U000D0030★\U000D005E☆\U000D005F\e[m"
अनुच्छेद १.
सभी मनुष्यों को गौरव और अधिकारों के मामले में
जन्मजात स्वतन्त्रता और समानता प्राप्त है ।
उन्हें बुद्धि और अन्तरात्मा की देन प्राप्त है और
परस्पर उन्हें भाईचारे के भाव से बर्ताव करना चाहिए ।
PoC: