-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
utf-8 text broken? #2233
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
Comments
Default font won't have those characters. You need to provide the glyph ranges when loading and provide a font which has them.
Did you inspect in the imgui font previewer, or by some of your OS tool? I think we ought to provide a small tool when you can paste text and it tells you which characters are in the text so people can start understanding what is going on.
Outputs:
And
Outputs
|
Ah ok. Example now rendering text threw me off. As per this it seems like it really is my error. Good to know. Not setting up font ranges uses default latin range which is pretty minimal and does not include characters i tested. Somehow i expected that lack of explicit ranges would include all characters provided by font. Is it possible to somehow include all font characters in some easy way? Edit: Closing as indeed explicitly specifying correct range makes it all work. Future reader: unspecified font range defaults to minimal latin range, it does not include all characters provided by font. |
Before 1.61 it was not possible to just "load everything in the font", but now with a |
You are right the function should be reworked to do a pre-pass to count the characters.
It won’t be so harmful but it shouldn’t have any side effect so this is not ideal.
|
- Atlas width is now properly based on total surface rather than glyph count (unless overridden with TexDesiredWidth). - Fixed atlas builder so missing glyphs won't influence the atlas texture width. (#2233) - Fixed atlas builder so duplicate glyphs (when merging fonts) won't be included in the rasterized atlas.
- Fixed abnormally high atlas height. (#618) - Fixed support for any values of TexGlyphPadding (not just only 1). (#618) - Atlas width is now properly based on total surface rather than glyph count (unless overridden with TexDesiredWidth). (#618) - Fixed atlas builder so missing glyphs won't influence the atlas texture width. (#2233, #618) - Fixed atlas builder so duplicate glyphs (when merging fonts) won't be included in the rasterized atlas. (#618)
For some reason i am unable to print lithuanian characters (ąčęėįšųū) with ImGui. At first i thought it is something with my code, but even if i run official demo i see this:
No matter what i try - always get question marks in place of mentioned characters.
Tested official imgui samples: win32 dx12, linux sdl2 opengl2, linux sdl2 opengl2, linux glfw_opengl2.
Tested 1.66b release and latest snapshot of docking branch.
In my own application i tested printing text with
ImGui::TextColored
by passing it utf-8-encoded string. I even tried withu8"ąčęėį"
literal.I tested default font as well as google's noto fonts. I inspected my used fonts in font preview only to see that characters i am looking for indeed are supported. I do not specify any font ranges for noto fonts to include all characters.
I see no white squares as mentioned in font readme so texture must properly fit fonts. At this point i am still not sure if this is my error or the issue. Is demo supposed to show proper text instead of ????? there?
The text was updated successfully, but these errors were encountered: