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

Pixel perfect GUI text, DPI awareness font scaling #84

Closed
iaomw opened this issue Apr 8, 2022 · 0 comments · Fixed by #85
Closed

Pixel perfect GUI text, DPI awareness font scaling #84

iaomw opened this issue Apr 8, 2022 · 0 comments · Fixed by #85
Labels
enhancement New feature or request

Comments

@iaomw
Copy link
Contributor

iaomw commented Apr 8, 2022

GUI text is blurred because not considering DPI while loading the TTF font.

DPI blind DPI awareness
image image

Pilot is using AddFontFromFileTTF to load font. It should also consider DPI because the second parameter is measured in pixel.

ImFont* ImFontAtlas::AddFontFromFileTTF(const char* filename, float size_pixels, const ImFontConfig* font_cfg_template, const ImWchar* glyph_ranges)

Reference: ocornut/imgui#2956

Then, how to get correct DPI?

Through my experiment ImGui::GetMainViewport()->DpiScale is not good enough to get DPI. It's buggy and always return 0 before ImGui::NewFrame(). That's a bit too late for fonts loading with DPI info.

@iaomw iaomw added the enhancement New feature or request label Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant