sedwards2009 / extraterm

The swiss army chainsaw of terminal emulators
https://extraterm.org
MIT License
2.52k stars 116 forks source link

Certain unicode characters not rendered correctly #297

Closed aral closed 3 years ago

aral commented 3 years ago

It appears that certain unicode characters are getting cut off / incorrectly scaled (?) while rendered.

In GNOME Terminal:

Screenshot from 2020-10-20 16-24-58

In Extraterm

Screenshot from 2020-10-20 16-25-40

The problematic characters

šŸ…· šŸ†„ šŸ…¶ šŸ…¾ 

(And yes, I know I have an emoji problem.) ;)

Possibly related to #46

sedwards2009 commented 3 years ago

@aral Which fonts are you using?

sedwards2009 commented 3 years ago

I've dug into this issue and there is quite a lot going on here.

Firstly, GNOME Terminal is incorrectly displaying those glyphs (the enclosed letters). They are meant to be 1 cell wide, but the rendered glyph is falling out of the cell and overwriting/corrupting whatever is next to it. In this case it is an empty space so it is not noticeable. But it is still wrong.

Now to Extraterm. The cut off characters are because the glyph is simply too wide even though the font claims to be monospace. :man_shrugging: Monospace TrueType fonts tend to have these kinds of flaws. I've added code to directly check for these kinds of "trouble" glyphs and automatically scale them.

Lastly, the problem of the strange "o". This is a colour emoji coming from the Twemoji font which Extraterm ships with and supports. But this font only has a couple glyphs defined in this part of unicode, like the "o" in this example. (The enclosed "o" also serves as the symbol for blood type O, which is why the Twitter folks thought it was worth drawing.) The related other enclosed latin glyphs are not defined and so we get a mix of two fonts which just doesn't look good. I've now excluded those glyphs from Extraterm so now only the same font will be used.

The final result is that H U G O in Extraterm now renders as small enclosed letters which fit within one cell, and they are all visually the same.

These fixes will be in the next release.

aral commented 3 years ago

Simon, Iā€™m in awe of your response time and the care and depth with which you tackle development :)

(And thank you!) :)

sedwards2009 commented 3 years ago

Released in version 0.55.0.