-
-
Notifications
You must be signed in to change notification settings - Fork 449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unicode combining characters do not show up #109
Comments
Thanks for reporting this. I will take a look. |
A struct Pixel {
wchar_t character = U' ';
bool blink = false;
bool bold = false;
bool dim = false;
bool inverted = false;
bool underlined = false;
Color background_color = Color::Default;
Color foreground_color = Color::Default;
}; So, a single Not fully sure how to overcome this issue. |
Note that the character you are using can also be represented via a single character: auto document = text(L"- activẽ: ");
auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
Render(screen, document);
screen.Print(); This doesn't solve this issue, but this might solve your particular problem? |
Yeah, most of the common graphemes are available as a single codepoint - it's not currently a major issue for me, but I wanted to report it for completeness :) |
I added a note into the README. At first glance, this seems difficult to support. I will try to learn more about this unicode feature. If its specification is not too insane, there might be a way to support "multiple character per pixels" feature. |
In case it may help: magiblot/tvision#26 |
This helps a lot! Sounds like you had the exact same problem and you solved it. Thank you! |
Modify the ftxui::Pixel. Instead of storing a wchar, store a std::wstring. Now a single pixel can store multiple codepoints. If a codepoint is of size <=0, it will be appended to the previous pixel. Only ftxui::text() is supported. ftxui::vtext support still needs to be added. This fixes: #109
Modify the ftxui::Pixel. Instead of storing a wchar, store a std::wstring. Now a single pixel can store multiple codepoints. If a codepoint is of size <=0, it will be appended to the previous pixel. Only ftxui::text() is supported. ftxui::vtext support still needs to be added. This causes the following CPU and memory regression: - Memory: Pixel size increases by 200% (16 byte => 48byte). - CPU: Draw/Second decrease by 62.5% (16k draw/s => 6k draw/s on 80x80) Both regressions are acceptable. There are still two orders of magnitude (100x) before the levels where performance/memory concerns begins. This fixes: #109
Modify the ftxui::Pixel. Instead of storing a wchar, store a std::wstring. Now a single pixel can store multiple codepoints. If a codepoint is of size <=0, it will be appended to the previous pixel. Only ftxui::text() is supported. ftxui::vtext support still needs to be added. This causes the following CPU and memory regression: - Memory: Pixel size increases by 200% (16 byte => 48byte). - CPU: Draw/Second decrease by 62.5% (16k draw/s => 6k draw/s on 80x80) Both regressions are acceptable. There are still two orders of magnitude (100x) before the levels where performance/memory concerns begins. This fixes: #109
Modify the ftxui::Pixel. Instead of storing a wchar, store a std::wstring. Now a single pixel can store multiple codepoints. If a codepoint is of size <=0, it will be appended to the previous pixel. Only ftxui::text() is supported. ftxui::vtext support still needs to be added. This causes the following CPU and memory regression: - Memory: Pixel size increases by 200% (16 byte => 48byte). - CPU: Draw/Second decrease by 62.5% (16k draw/s => 6k draw/s on 80x80) Both regressions are acceptable. There are still two orders of magnitude (100x) before the levels where performance/memory concerns begins. This fixes: #109
It looks like unicode combining characters such as https://www.fileformat.info/info/unicode/char/0303/index.htm do not render correctly.
Modifying the example starter project as a test (see https://gist.github.com/retupmoca/68a4852a28b7cf6d2c39a90d7670212f for the full modified file), I added:
When I run the modified program, I see:
![image](https://user-images.githubusercontent.com/1424544/121401431-b8b8ef80-c926-11eb-9f2f-8fcfbc0f320b.png)
That is, the combining character renders correctly in my terminal if I directly output it, but displaying it via FTXUI does not appear to work.
The text was updated successfully, but these errors were encountered: