Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Octants (Unicode 16.0) #711

Closed
PhMajerus opened this issue Jan 22, 2024 · 5 comments · Fixed by #723
Closed

Feature Request: Octants (Unicode 16.0) #711

PhMajerus opened this issue Jan 22, 2024 · 5 comments · Fixed by #723

Comments

@PhMajerus
Copy link
Contributor

PhMajerus commented Jan 22, 2024

Description of the new feature

Many modern command-line apps are using Braille characters as pseudo-pixels to render graphics in the terminal.

image

They provide a 2×4 grid per character, using them as semigraphic mosaics. However, Braille is not a good solution because the symbols are using discrete dots, which makes the on and off pseudo-pixels unbalanced, and they always have space between symbols and between lines, so when using a group of cells to render a graphic, the grid of pseudo-pixels is not a regular grid:

image

Some terminals modify the Braille characters to space the dots evenly and avoid spaces between characters and lines, but that breaks their original intended use.

Unicode 16.0 will provide a better solution, it includes octants, which, just like the half-blocks and quadrants, provide a regular mosaic pattern designed to be used as pseudo-pixels:

image

Octants provide the highest resolution that can be achieved currently without using graphical extensions such as Sixels or ReGIS. They can also be combined with VT control sequences to generate color images:

image

These would not be possible using Braille or other non-mosaic characters, as they need foreground and background colored pseudo-pixels to completely fill their respective parts of the mosaic grid to work properly without background color bleeding:

image

This request replaces a previous suggestion to modify the Braille characters to achieve the same visual result: #647

Proposed technical implementation details

In January 2022, Unicode approved a new set of legacy computing characters, that includes those octants, to be part of Unicode 16.0.

The octants are set at U+1CD00 to U+1CDE5, as well as two new required quadrants at U+1FBE6 and U+1FBE7 that are reused for octants.

Cascadia should include the set of octants so apps can start moving from Braille to octants. This represents 238 glyphs (there are 256 mosaic patterns, but some already exist as part of half-blocks and quadrants).

image

Since octants do not duplicate patterns already available as full-block, half-blocks, and quadrants, all pseudo-pixels semigraphic characters must be designed using a unified set of coordinates. This may require fixing some of the existing characters, such as explained in #644.

I believe an external utility could even replace Braille with Octants on the fly, making it possible to pipe existing apps using Braille without modifying them. This makes the implementation of octants even more interesting, but is outside the scope of this feature request.

@PhMajerus
Copy link
Contributor Author

Another small demonstration of why octants are interesting for lines-based drawings (vectors, fonts, monochrome images,…).
Here is the same text rendered as half-blocks with grayscale anti-aliasing using VT colors, and as plain-text octants taking advantage of their increased pseudo-pixels resolution.
In each case the text has the same characters cells height, fitting 3 lines.
image

@Explorer09
Copy link

I believe an external utility could even replace Braille with Octants on the fly, making it possible to pipe existing apps using Braille without modifying them. This makes the implementation of octants even more interesting, but is outside the scope of this feature request.

Off-topic, but as a coding practice, I made a little snippet to generate Unicode Octant characters from the given bits (0-255):
https://gist.github.com/Explorer09/1da382e4b1cf3bf2e8009e60836af70b
https://gitlab.com/-/snippets/3710003

@cool-RR
Copy link

cool-RR commented Dec 4, 2024

I'm trying to get these octants to work on my local system but I just get different symbols instead, like Asian lettering or question marks. I wonder what I'm doing wrong. I downloaded Cascadia 2407.024. I'm on Windows 7. I tried both in Microsoft Terminal and in notepad. Do I need to do anything special to get these to work?

@PhMajerus
Copy link
Contributor Author

@cool-RR Nothing special is required besides selecting the proper font to use.
Try curl "https://raw.githubusercontent.com/PhMajerus/Documents/refs/heads/main/CheatSheets/Blocks%20tables.txt" in a shell (cmd, bash,
...). If that test file works and your output shows other characters, I would suspect a text encoding mismatch.

@cool-RR
Copy link

cool-RR commented Dec 4, 2024

Works, thank you! @PhMajerus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants