stefanhaustein / TerminalImageViewer

Small C++ program to display images in a (modern) terminal using RGB ANSI codes and unicode block graphics characters
Other
1.56k stars 111 forks source link

Add support for new teletext/legacy unicode characters #70

Open stefanhaustein opened 4 years ago

stefanhaustein commented 4 years ago

This should allow for much better pattern matching: https://www.unicode.org/L2/L2019/19025-terminals-prop.pdf

clort81 commented 4 years ago

SO excited for this!

innerlee commented 4 years ago

This is great!

stefanhaustein commented 4 years ago

Does anybody have a pointer for installing a corresponding font on Manjaro?

clort81 commented 4 years ago

I downloaded unscii, put it in ~/.fonts, and ran fc-cache. http://pelulamu.net/unscii/

Then the font is available for use in terminals.
e.g. in ~/.Xresources XTerm*font: -unscii-unscii-medium-r-normal-full-16-160-75-75-c-80-iso10646-1

(then xrdb ~/.Xresources and test they got accepted with xlsfonts |grep unscii )

Or you can alias term invocation in ~/.bashrc like alias tterm='xterm -title uxtermsm -fg Turquoise1 -fn -unscii-unscii-medium-r-normal-full-16-160-75-75-c-80-iso10646-1&

It's a shame most font designers did not implement diagonal triangles ◢ to be full-height as they should be for PETSCII graphics, and the Unicode consortium failed to understand that a fullheight triangle deserves a new codepoint for 13.0.

Very depressing. I have modified some of my fonts to use fullheight triangles. DejaBlapCap

stefanhaustein commented 4 years ago

I have added experimental support for the 3x2 block characters, but haven't tested it so far.

Requires the new parameter -x

Don't hesitate to send a screenshot if it works (or not)....

clort81 commented 3 years ago

Test picture, 30 columns, 13 rows

tivtestcap4x tiv -x -w 30 -h 300 tivtestcap4x.png > tivtestcap4x.ans && cat tivtestcap4x.ans

tivtestcap4xres The unscii font is installed so freetype2 is using it as my fallback. My terminal can see all the fonts in original image.

Note it particularly has problems resolving the correct precise width and height of these: ▊ ▋ ▌ ▍ ▎ ▏ ▁ ▂ ▃ ▄ ▅ ▆ ▇

Note also that: Font designers have failed to make these full height, and the Unicode consortium refused to grant new codepoints for full height diagonal triangles, so you will need a patched font. ◢ ◣◥ ◤

tivtestcap4xgrid

Note that even the new block graphics of Unicode doesn't have the fat-centered horizontal and vertical blocks (BOOO!) in the upper right of the parallelogram. I'm just curious how those resolve.

stefanhaustein commented 3 years ago

Thanks for the test image -- it's very helpful.

Not sure what's going wrong -- it seems like the new characters got mismapped... perhaps a problem with mappping code points to utf8? I guess the "old" codes are all below 0xffff....

Concerning the test image in general: It would probably help if you could include a photo somewhere, making sure that improvements in "flat color" rendering don't lead to a regression there....

clort81 commented 3 years ago

Concerning the test image in general: It would probably help if you could include a photo somewhere, making sure that improvements in "flat color" rendering don't lead to a regression there....

I'm not understanding what kind of photo you are requesting; It seems to me any non-flat-shaded photo would serve that purpose.

Still having great fun with TerminalImageViewer almost every day. Thank you!

clort81 commented 3 years ago

This font has the new block drawing characters, and -x does not render using them.

http://pelulamu.net/unscii/