Skip to content
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

Properly hint text and improve font rendering. #76420

Closed
CLIDragon opened this issue Sep 14, 2024 · 6 comments · Fixed by #76529
Closed

Properly hint text and improve font rendering. #76420

CLIDragon opened this issue Sep 14, 2024 · 6 comments · Fixed by #76529
Labels
<Suggestion / Discussion> Talk it out before implementing

Comments

@CLIDragon
Copy link
Contributor

CLIDragon commented Sep 14, 2024

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.
image

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.
Screenshot 2024-09-14 175153

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 #76404 (comment) 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.

@db48x
Copy link
Contributor

db48x commented Sep 14, 2024

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.

@CLIDragon
Copy link
Contributor Author

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.

@whirm
Copy link

whirm commented Sep 15, 2024

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.

2024-09-15T08:22:48,887212788+02:00
2024-09-15T08:29:24,672152633+02:00

@db48x
Copy link
Contributor

db48x commented Sep 15, 2024

No, that was #75698

@db48x
Copy link
Contributor

db48x commented Sep 18, 2024

Screenshot from 2024-09-18 10-27-55

Ignore the window on the left; that’s just for testing.

@db48x
Copy link
Contributor

db48x commented Sep 18, 2024

Screenshot from 2024-09-18 10-37-09

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Suggestion / Discussion> Talk it out before implementing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants