asciinema / asciinema

Terminal session recorder 📹

Home Page:https://asciinema.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect rendering of DEC Special Graphics, which is used in ncurses Nethack

leonyu opened this issue · comments

DEC Special Graphics characters are rendered incorrectly.

This can be produced by the following oneliner:

python3 -c 'for i in range(95, 127): print(f"{i:x} | \x1b(0{chr(i) * 4}\x1b(B | {i:x}")'

https://asciinema.org/a/6wW8RLBjuampesVCrbDUEjX62

These characters are used by ncurses Nethack:

https://asciinema.org/a/LguWxEd8Sju8Hc6lKtpmLlsX4

How should it look like?

This is how it looks like for me on Arch Linux / Firefox 106:

image

image

I am on Windows 10 chrome.

It looks like Consolas doesn't have those glyphs, so it has to pick another font, in this case Cambria Math

image

I don't know if there's a wholistic solution for this. I think VS Code had similar issue and switched to use canvas for terminal rendering. I think they use Xterm.js.

Yeah, holistic solution is a holy grail :) It's just browsers render text differently, and I'm afraid without switching to canvas + carefully selected set of font faces there will always be something off. There's no plan for canvas impl in short term but in long term we may go there.

It is also possible to detect the rendering size of the characters using Canvas/OffscreenCanvas then make adjustments with rendering accordingly.

That's interesting idea 💡