You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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:
// Here's some code anyone can copy and paste to reproduce your issueImGui::Begin("Example Bug");
if(ImGui::BeginTabBar("#tabBar1", ImGuiTabBarFlags_FittingPolicyResizeDown | ImGuiTabBarFlags_NoCloseWithMiddleMouseButton || ImGuiTabBarFlags_NoTabListScrollingButtons)) {
if(ImGui::BeginTabItem((constchar*)u8"🖱InputConfig")) {
}
if(ImGui::BeginTabItem((constchar*)u8"🖲️InputConfigBroken")) {
}
ImGui::EndTabBar();
}
ImGui::End();
The text was updated successfully, but these errors were encountered:
ocornut
changed the title
BUG: Text rendering character advancing adds visual space for Unicode VARIATION_SELECTOR-16 codepoint
Text rendering character advancing adds visual space for Unicode VARIATION_SELECTOR-16 codepoint
Apr 4, 2024
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 :)
The best way I can think of would be to adjust ImFontGlyph::AdvanceX for the glyphs in question when loading a font, plus the corresponding entries of ImFont::IndexAdvanceX.
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 :)
The best way I can think of would be to adjust ImFontGlyph::AdvanceX for the glyphs in question when loading a font, plus the corresponding entries of ImFont::IndexAdvanceX.
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: