Closed CLIDragon closed 2 weeks ago
Luckily we don’t have to completely rewrite the whole renderer, we can just swap over to using Freetype. ImGui even provides instructions, we just have to get around to it.
See also #73728, and #73120.
I tried following the provided link to include ImGui, but build fails with the following error:
ImGui-lib-vcpkg-static-Release-x64.lib(imgui_draw.obj) : error LNK2019: unresolved external symbol "struct ImFontBuilderIO const * __cdecl ImGuiFreeType::GetBuilderForFreeType(void)" (?GetBuilderForFreeType@ImGuiFreeType@@YAPEBUImFontBuilderIO@@XZ) referenced in function "public: bool __cdecl ImFontAtlas::Build(void)" (?Build@ImFontAtlas@@QEAA_NXZ)
Which is strange given that building imgui by itself succeeds.
Is this issue (not computing the right height) also causing the wrong vertical dimensions for pop-up windows, cropping content?
This is on Wayland (Sway) on 2024-09-12-1816 build.
No, that was #75698
Ignore the window on the left; that’s just for testing.
Is your feature request related to a problem? Please describe.
I think this screenshot makes the problem pretty clear. We are unable to detect the actual cap height of the text, leading to text being off centre.
Additionally, there is an extra 1px of space before and 3px of space after text (drawn in purple). This is the natural spacing embedded in the font, and it would be nice to remove it.
Solution you would like.
Change the current font rendering stack so that we can support autodetecting the cap height for different fonts and adjusting as necessary See https://github.com/CleverRaven/Cataclysm-DDA/pull/76404#issuecomment-2350813614 for initial direction.
Describe alternatives you have considered.
Hand adjusting text in all user-visible UIs. Unfortunately, this breaks if the user changes the font, the font size, the font height, the font width, the font rendering mode, etc.
Additional context
Naming this issue was hard. The scope is strange, and I feel like the current label isn't very clear about what the actual goal is. I certainly didn't start this with the goal of rewriting the font renderer, but I guess that's what I am doing now.