#32 Width of weird Characters breaks the tables.

Open
opened 2 years ago by jyamihud · 0 comments

What is monospace?

In terminal we use Monospace type fonts which force each letter to be the same exact width. And this allows us to make interesting designs right inside the terminal.

Non Monospace Monospace
ABCDEFGHIJ ABCDEHGHIJ
1234567890 1234567890

For example the logo of the FastLBRY:

█▓▓█▓▓▓▓▓▓█▓██▓▓▓▓▓▓▓█▓▓▓▓▓▓█▓▓▓▓██▓▓▓▓█▓▓▓▓█
▓▒▒▒▒▒▒▒▓▒▒▒▒▒▒▒▓▓▒▒▒▒▒▒▒▒▒▓▒▒▒▒▒▒▒▒▒▓▒▒▒▒▓▒▓
██░░░▒░░░░░░▒░░░░░░░▒░░░░░░░░░▒░░▒░░░░░░░░▒▓▓
▓▓░ ░          ░             ░    ■     ■░░▒▓
▓▒▒ ╔════════■   ░  ╔════╗ ╔════╗ ║  ░  ║ ░▓█
▓▒░ ║ ░      ║      ║    ║ ║    ║ ║     ║ ░▒▓
█▓░░║        ║      ╠════╣ ╠═╦══╝ ╚══╦══╝ ▒▒▓
▓▒▒ ╠══ AST ■║      ║    ║ ║ ╚══╗    ║   ░░▒█
█▒░ ║        ║      ║    ║ ║    ║    ║    ░▓▓
▓▓░ ║    ░   ╚═════■╚════╝ ■    ■ ░  ║ ░  ░▒▓
▓▒░░║ ░       THE TERMINAL CLIENT    ║    ▒▒█
█▒▒ ■      ░                  ░      ■ ▒░ ░▓▓
▓▒░░░░░░░▒░░░░▓░░░░░▒░░░░░░░░░▒░░░░▒░░░░░░░▒█
▓▓▒▒▒▒▓▒▒▒▒▒▓▒▒▒▒▓▒▒▓▒▒▒▒▒▒▒▓▓▒▒▒▒▒▒▓▒▒▒▒▒▓▓▓
█▓▓█▓▓▓▓▓████▓▓▓▓█▓▓▓▓█▓▓▓▓██▓▓▓█▓▓▓▓▓█▓▓▓▓██

What would happen if monospace wasn't there and each character could do what ever he wanted?

Well:

█▓▓█▓▓▓▓▓▓█▓██▓▓▓▓▓▓▓█▓▓▓▓▓▓█▓▓▓▓██▓▓▓▓█▓▓▓▓█

▓▒▒▒▒▒▒▒▓▒▒▒▒▒▒▒▓▓▒▒▒▒▒▒▒▒▒▓▒▒▒▒▒▒▒▒▒▓▒▒▒▒▓▒▓

██░░░▒░░░░░░▒░░░░░░░▒░░░░░░░░░▒░░▒░░░░░░░░▒▓▓

▓▓░ ░ ░ ░ ■ ■░░▒▓

▓▒▒ ╔════════■ ░ ╔════╗ ╔════╗ ║ ░ ║ ░▓█

▓▒░ ║ ░ ║ ║ ║ ║ ║ ║ ║ ░▒▓

█▓░░║ ║ ╠════╣ ╠═╦══╝ ╚══╦══╝ ▒▒▓

▓▒▒ ╠══ AST ■║ ║ ║ ║ ╚══╗ ║ ░░▒█

█▒░ ║ ║ ║ ║ ║ ║ ║ ░▓▓

▓▓░ ║ ░ ╚═════■╚════╝ ■ ■ ░ ║ ░ ░▒▓

▓▒░░║ ░ THE TERMINAL CLIENT ║ ▒▒█

█▒▒ ■ ░ ░ ■ ▒░ ░▓▓

▓▒░░░░░░░▒░░░░▓░░░░░▒░░░░░░░░░▒░░░░▒░░░░░░░▒█

▓▓▒▒▒▒▓▒▒▒▒▒▓▒▒▒▒▓▒▒▓▒▒▒▒▒▒▒▓▓▒▒▒▒▒▒▓▒▒▒▒▒▓▓▓

█▓▓█▓▓▓▓▓████▓▓▓▓█▓▓▓▓█▓▓▓▓██▓▓▓█▓▓▓▓▓█▓▓▓▓██

This what would happen. LOL. So to keep the width of all character in check helps a lot.

The problem

If you try to search for some publication that uses Asian characters or other weird characters, some of them will not obey monospace and thus break the prettiness of the application.

So far in Commint 89143489aee I fixed this issue half way. I made it so now each character not included in ASCII is going to be threaded as 2 columns wide.

I found this article outlining the problem in more depth. He linked to some technical papers that I do not understand fully. Please help me understand them.

# What is monospace? In terminal we use Monospace type fonts which force each letter to be the same exact width. And this allows us to make interesting designs right inside the terminal. | Non Monospace | Monospace | | --- | --- | | ABCDEFGHIJ | `ABCDEHGHIJ` | | 1234567890 | `1234567890` | For example the logo of the FastLBRY: ``` █▓▓█▓▓▓▓▓▓█▓██▓▓▓▓▓▓▓█▓▓▓▓▓▓█▓▓▓▓██▓▓▓▓█▓▓▓▓█ ▓▒▒▒▒▒▒▒▓▒▒▒▒▒▒▒▓▓▒▒▒▒▒▒▒▒▒▓▒▒▒▒▒▒▒▒▒▓▒▒▒▒▓▒▓ ██░░░▒░░░░░░▒░░░░░░░▒░░░░░░░░░▒░░▒░░░░░░░░▒▓▓ ▓▓░ ░ ░ ░ ■ ■░░▒▓ ▓▒▒ ╔════════■ ░ ╔════╗ ╔════╗ ║ ░ ║ ░▓█ ▓▒░ ║ ░ ║ ║ ║ ║ ║ ║ ║ ░▒▓ █▓░░║ ║ ╠════╣ ╠═╦══╝ ╚══╦══╝ ▒▒▓ ▓▒▒ ╠══ AST ■║ ║ ║ ║ ╚══╗ ║ ░░▒█ █▒░ ║ ║ ║ ║ ║ ║ ║ ░▓▓ ▓▓░ ║ ░ ╚═════■╚════╝ ■ ■ ░ ║ ░ ░▒▓ ▓▒░░║ ░ THE TERMINAL CLIENT ║ ▒▒█ █▒▒ ■ ░ ░ ■ ▒░ ░▓▓ ▓▒░░░░░░░▒░░░░▓░░░░░▒░░░░░░░░░▒░░░░▒░░░░░░░▒█ ▓▓▒▒▒▒▓▒▒▒▒▒▓▒▒▒▒▓▒▒▓▒▒▒▒▒▒▒▓▓▒▒▒▒▒▒▓▒▒▒▒▒▓▓▓ █▓▓█▓▓▓▓▓████▓▓▓▓█▓▓▓▓█▓▓▓▓██▓▓▓█▓▓▓▓▓█▓▓▓▓██ ``` What would happen if monospace wasn't there and each character could do what ever he wanted? Well: █▓▓█▓▓▓▓▓▓█▓██▓▓▓▓▓▓▓█▓▓▓▓▓▓█▓▓▓▓██▓▓▓▓█▓▓▓▓█ ▓▒▒▒▒▒▒▒▓▒▒▒▒▒▒▒▓▓▒▒▒▒▒▒▒▒▒▓▒▒▒▒▒▒▒▒▒▓▒▒▒▒▓▒▓ ██░░░▒░░░░░░▒░░░░░░░▒░░░░░░░░░▒░░▒░░░░░░░░▒▓▓ ▓▓░ ░ ░ ░ ■ ■░░▒▓ ▓▒▒ ╔════════■ ░ ╔════╗ ╔════╗ ║ ░ ║ ░▓█ ▓▒░ ║ ░ ║ ║ ║ ║ ║ ║ ║ ░▒▓ █▓░░║ ║ ╠════╣ ╠═╦══╝ ╚══╦══╝ ▒▒▓ ▓▒▒ ╠══ AST ■║ ║ ║ ║ ╚══╗ ║ ░░▒█ █▒░ ║ ║ ║ ║ ║ ║ ║ ░▓▓ ▓▓░ ║ ░ ╚═════■╚════╝ ■ ■ ░ ║ ░ ░▒▓ ▓▒░░║ ░ THE TERMINAL CLIENT ║ ▒▒█ █▒▒ ■ ░ ░ ■ ▒░ ░▓▓ ▓▒░░░░░░░▒░░░░▓░░░░░▒░░░░░░░░░▒░░░░▒░░░░░░░▒█ ▓▓▒▒▒▒▓▒▒▒▒▒▓▒▒▒▒▓▒▒▓▒▒▒▒▒▒▒▓▓▒▒▒▒▒▒▓▒▒▒▒▒▓▓▓ █▓▓█▓▓▓▓▓████▓▓▓▓█▓▓▓▓█▓▓▓▓██▓▓▓█▓▓▓▓▓█▓▓▓▓██ This what would happen. LOL. So to keep the width of all character in check helps a lot. # The problem If you try to search for some publication that uses Asian characters or other weird characters, some of them will not obey monospace and thus break the prettiness of the application. So far in [Commint 89143489aee](https://notabug.org/jyamihud/FastLBRY-terminal/commit/89143489aee1b31e2b93490c17be1d80963866c2) I fixed this issue half way. I made it so now each character not included in ASCII is going to be threaded as 2 columns wide. I found [this article](https://denisbider.blogspot.com/2015/09/when-monospace-fonts-arent-unicode.html) outlining the problem in more depth. He linked to some technical papers that I do not understand fully. Please help me understand them.
Sign in to join this conversation.
No Milestone
No assignee
1 Participants
Loading...
Cancel
Save
There is no content yet.