KiTTY icon indicating copy to clipboard operation
KiTTY copied to clipboard

Double-width characters font; pict glyphs not rendering correctly

Open ljramalho opened this issue 4 years ago • 6 comments

KiTTY and PuTTY allows for the "selection of variable-pitch fonts", however, I THINK... both applications do good job by rendering variable pitch fonts as monospace fonts even if that means to compress glyphs with more larger width like the letter "m", or showing extra space in some narrow glyphs like "l". I don't really know if that is the case....

However this behavior on variable pitch-fonts may produce bad results when rendering text using some fonts.

I use the command "lsd" (https://github.com/Peltoche/lsd) installed on my raspberry pi. A variant of the command "ls" that show some pictorial glyphs depending of the file type.

So... this is KiTTY / PuTTY using variable pitch Hack Nerd fonts (here using font size 11 but size 10 is the same), where the icon is cutted in both sides. image

This is an example of how it should look like (the folder glyph seems to extend in the space of two characters).: image

Question. Is there some other option to change this behavior or, I'm wrong and it is NOT a problem with KiTTY / PuTTY?

Thanks and sorry for my bad English.

ljramalho avatar Nov 18 '21 03:11 ljramalho

It seems a rendering problem in KiTTY / PuTTY, when using variable-width fonts, with bigger width pict glyphs. Below a superposition of the KiTTY window over "Windows Terminal" window running 'ssh user@server', both using the same Hack Nerd Font. image

ljramalho avatar Nov 18 '21 19:11 ljramalho

Interested in this as well. The icons are commonly referred to as "double-width" characters, @ljramalho maybe you could adapt the issue title accordingly. See for reference how other terminal emulators deal with this, e.g. mintty or foot.

carlfriedrich avatar Feb 22 '22 10:02 carlfriedrich

Seems PuTTY/KiTTY already supports this in a hidden setting: in Window > Translation, check "Treat CJK ambiguous characters as wide". That makes the icons render correctly in my case.

carlfriedrich avatar Feb 22 '22 10:02 carlfriedrich

Hello mr. @carlfriedrich.

THANK YOU very much indeed!!!!! Your solution does really did the trick and SOLVE the problem.

I would never guess that. Usually I don't mess around with the more obscure settings of any program and for me that option, "Treat CJK ambiguous characters as wide" was really obscure and slipped away from my eyes.

Thank you again.

ljramalho avatar Apr 25 '22 01:04 ljramalho

Hello. I'm back to this issue.

Please check furter pictures at: https://github.com/cyd01/KiTTY/issues/381

While the KiTTY option, "Window > Translation, check "Treat CJK ambiguous characters as wide", really allows the handling of double-width glyphs, the feature is far from perfect. This must be a PuTTY / KiTTY issue since I cannot observe none of the below described problems in other windows ssh terminal.

The problems are...

  1. For some font sizes some double width glyphs still don't print fully. This is the case of the "folder" glyph present in "Hack nerd font". The result is better than in the picture above, but still trims the right corner, visible when font size 11 is selected, (not so much visible when use font size 10).

  2. When the command "lsd" (https://github.com/Peltoche/lsd) is used in KiTTY with option "Treat CJK ambiguous characters as wide" activated, does produce wrapped lines. Somehow when double width glyphs are printed, KiTTY fails to correctly calculate the space between columns. However the command "ls" works perfectly.

  3. Yet the command "mc" (Midnight Command) shows strange artifacts; a) lines are shown dashed, b) irregular panel size, that change size when move the cursor bar, c) strange numbers are shown in front of each file / folder entry. This can be mitigated by calling Midnight Command with ascii option, that is (mc -ca), that change graph glyphs to ascii characters, yet even so, it is not perfect mainly when activate "mc" menus.

Thanks you.

ljramalho avatar Apr 27 '22 00:04 ljramalho

Seeing what I'm guessing is the same issue here:

https://user-images.githubusercontent.com/8271372/222501349-2f5be35b-d6dc-47bf-a63e-248bbf25a562.mp4

That is -- certain emojis, but not all (presumably, the ambiguous ones) really hose the input in Vim. The same characters also display inconsistently in the less pager -- they're 1 character wide on first view, but two characters wide if they scroll out of the viewport and back in.

My default Linux Mint GNOME terminal emulator doesn't have any of these issues; it handles these same characters without input or display artifacts. (But it doesn't do other stuff I need that kitty does ...)

Haven't tried the ""Treat CJK ambiguous characters as wide" setting -- how do I toggle that in kitty.conf? Hoping that might resolve this, or that there's another fix here.

githorse avatar Mar 02 '23 17:03 githorse