Open Darleanow opened 2 months ago
I'll add one more piece of information: according to what I've deduced from the codepoint_width()
, it returns a size of 3 for the red heart (1 for \u2764
and 2 for \uFE0F
, which is an extended character).
However, not all extended characters have a size of 2. When I look at the Konsole code (whose display is correct), \uFE0F
is nothing special and returns 1 (https://invent.kde.org/utilities/konsole/-/blob/master/src/characters/CharacterWidth.cpp?ref_type=heads)
Thanks for reporting this!
Here is FTXUI equivalent to this table: https://github.com/ArthurSonzogni/FTXUI/blob/dfb9558eaff417ee7909169d0abd66e6c52c9d55/src/ftxui/screen/string.cpp#L31-L1077
I believe both FTXUI adnd konsole are equivalent. They should attributes a size of 1 for \u2764
and 0 for the extended character.
I see this library has some special handling for 0xFE0F
, this might require something different.
Any advice are appreciated !
Hey again !
Adding additionnal infos:
It seems that when i remove the last unicode character from the emoji (in my ide some emoji are displayed as two characters wide, and i can backspace once to remove a character from it), it renders properly !
const std::string health_icon = "❤"; // Heart icon
The line above works, and contains only one unicode character
const std::string health_icon = "❤️"; // Heart icon
This line however doesn't
Note that on the screen, the rendered heart from the icons is the right one
It seems that powershell adds a unicode sequence when displaying emojis, which might cause the issue with FTXUI ???
Maybe I'm wrong, but it could help you I hope ?
Hey Arthur,
I'm making a textual game, and trying to use some icons to make my game look better.
It appears that some emojis (not all of them), make the layout appear glitchy, i'm talking especially about this emoji: ❤️ But for example this one: ✊ is not causing any issues.
It renders on the screen though, just makes everything glitchy on updates (e.g. moving the cursor, new selection on a dropdown)
Do you have any ideas on why ? If i can do something to fix this.
Note that I'm using Windows, powershell with a nerd font.
From the screen, the second heart emoji is a working one, its a slight difference only, but it's triggering to be restricted to a few only !
Also it might be a duplicate, but I was unable to use the other issues as valuable ressources for my use case (maybe I'm wrong)
For the code, thats basically something like this (this is pseudo code, it's taken from a larger code segment, but shows the idea):