Saturday, October 31, 2020

New ask Hacker News story: Unicode 13 sextants advances state-in-the-art terminal rendering

Unicode 13 sextants advances state-in-the-art terminal rendering
4 by dankamongmen | 1 comments on Hacker News.
I'm the author of a blingful TUI/character graphics library by the name of Notcurses. One of the core competencies of Notcurses is rendering images and video to a terminal (without undue shrinking of the font). Leaving aside asymmetric rendering such as that performed by caca (see Notcurses documentation for an explanation of why I don't think this a good general approach), common symmetric rendering techniques include spaces and Unicode half blocks ( and ). This last method is employed by tools like viu and mpv's TCT output, and can be considered the general "state of the art". Notcurses had already gone past this with its Quadblitter, making use of Unicode 3.2's quadrant blocks to map 2x2 pixels to a terminal cell. With the advent of Unicode 13's Legacy Computing Symbols (and rollout of font support for them), a powerful new symmetric blitting method is made available, mapping 3 rows of 2 columns each to a single cell. This blitter is available as NCBLIT_3x2 in the upcoming Notcurses 2.0.3. I was worried that color loss would be more of a problem, but it ended up looking great! The following images are rendered using all four blitters: https://ift.tt/3mIUnVw (left to right: S, Q, H, ASCII) https://ift.tt/2Gf54j9 (clockwise from upper left: ASCII, H, Q, S) The algorithm is described here: https://ift.tt/3kYfAKE code here: https://ift.tt/35TbmOo notcurses: https://ift.tt/3jShv2o hype video: https://www.youtube.com/watch?v=cYhZ7myXyyg enjoy! hack on!

No comments:

Post a Comment