kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
24.58k stars 984 forks source link

Zero-width spaces ignored? #1154

Closed csguimaraes closed 5 years ago

csguimaraes commented 5 years ago

I'm trying to use some FiraCode ligatures side-by-side by adding zero-width spaces (\u200b) between them so their sequences don't collide, but it seems that they're ignored in the font/rendering layer.

Maybe I could somehow find the "dummy glyphs of zero size" that you mentioned here https://github.com/kovidgoyal/kitty/issues/182#issuecomment-357400779, but I'm not sure how to find its code nor if kitty will be able to handle it.

Thanks for any suggestions! :sweat_smile:

kovidgoyal commented 5 years ago

Umm shouldn't you be using U+200d not U+200b? And note that kitty has a hard limit on maximum ligature length (in number of glyphs/cells).

ggPeti commented 6 months ago

@kovidgoyal no, 200d is the joiner, 200b is the separator / space.

I have a similar issue, trying to separate regional indicators so that 🇦 and 🇹 don't combine into 🇦🇹. But when I do this (there is a ZWS between the characters):

$ echo '🇦​🇹'
🇦​🇹

The output characters are fine, but kitty renders it as

image
kovidgoyal commented 6 months ago

kitty is correctly putting those codepoints into four different cells (two for the A and ZWS and two for T). It then passes the sequence of codepoints into harbuzz, which chooses to ignore the ZWS. You will need to ask the developers of harfbuzz why it does that. I could work around it by special casing this, but that's too much effort for this edge case.

ggPeti commented 6 months ago

Thanks for the response @kovidgoyal. I found out in the meantime, that luckily \u200c (ZWNJ) works for separating the characters. By the way, why does 🇦 take 2 cells?