jsbueno / terminedia

Python3 library for multimedia functions at the command terminal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for 1/6 block characters

RebeccaRGB opened this issue · comments

Unicode 13.0 added 1/6 block characters at 1FB00-1FB3B in the Characters for Legacy Computing block. This would be a nice complement to the 1/4, 1/2, and 1/8 (Braille) modes.

Yes - support for the 1/6 block characters are on the "todo" ever since the 1/4 blocks were introduced.
Fortunately, the refactoring that introduced the 1/8 blocks made it a breeze for new blockchars subpixel systems to be created.

I just need my personal system to have support for 1/6th to implement those, and probably some fencing to avoid Unicode exceptions if the project is run where those are not yet available.

commented

Just an FYI for you guys: fundamentals-fontdevelopment is Piotr Grochowski.

btw, the resolutions existing so far have a "name" through which they can be used. I am open on suggestions dor a name for the 1/6 blocks. So far we have "normal" for full-block, "square" for half-block, "high" for 1/4 block and "braille" for braille characters. Would "sextant" be ok?

The text API also have numeric aliases for the resolutions, indicating the height of a character in blocks. (For the 8x8 UNSCII embedded font). The "number" would be 2.6666 - I am likely just using "3".

"Sextant" is a bit technical but perfectly acceptable.

Keep in mind we'll eventually have the Kaypro 1/8 set too (It always bothers me to use Braille this way).

Implemented in commit f4e0f1c in master; even easier than the braille characters, as the order of the sextant chars was the same I picked when implementing the 1/4 block for the 'subpixel" algorithms.

The out-of-sequence half right and half left blocks were also easy to deal with (once I found out they were not in the expected position in the sextant sequence), as the implementation relies on the character-declaration order in the class body, not in their sequence in the codepoints.

Example usage:

import terminedia as TM
import math

sc = TM.Screen()
for x in range(sc.sextant.width):
    sc.sextant.set_at((x, 10 + int(8 * math.sin(x / 5))))

sc.update()

(For more than single pixel setting/resetting, the full drawing API is available
at Screen.sextant.draw.* )