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
Text rendering character advancing adds visual space for Unicode VARIATION_SELECTOR-16 codepoint #7471
Comments
The best way I can think of would be to adjust |
Ahh interesting. I like this, will give it a try. |
Version/Branch of Dear ImGui:
Version 1.90.5 WIP Docking branch
Back-ends:
imgui_impl_win32.cpp + imgui_impl_dx11.cpp
Compiler, OS:
Windows 10 22H2
Full config/build information:
Details:
My Issue/Question:
When rendering certain unicode characters (emojis primarily) on Text, or buttons, or tabs, the text rendering code advances an additional space when the character includes the variation selector 16 codepoint at the end of the emoji.
here is an example of a mouse emoji which uses this codepoint as well as one which does not:
https://unicode.scarfboy.com/?s=%F0%9F%96%B2%EF%B8%8F%F0%9F%96%B1
issue happens inside of imgui_draw.cpp in the function
void ImFont::RenderText(ImDrawList* draw_list, float size, const ImVec2& pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, float wrap_width, bool cpu_fine_clip) const
I am investigating where to put a fix right now, if I find it I will submit a PR. If someone else already knows where to skip past this character however I would most appreciate the info :)
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
UPDATE:
Some of the spacing issues were related to visual studio saving with BOM (byte order mark) enabled by default. Here is how to fix it for anyone who stumbles upon this: https://stackoverflow.com/questions/5406172/utf-8-without-bom
The text was updated successfully, but these errors were encountered: