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

Incorrect set for FontScale in the SetCurrentWindow #7976

Closed
DDeimos opened this issue Sep 12, 2024 · 1 comment
Closed

Incorrect set for FontScale in the SetCurrentWindow #7976

DDeimos opened this issue Sep 12, 2024 · 1 comment

Comments

@DDeimos
Copy link

DDeimos commented Sep 12, 2024

Version/Branch of Dear ImGui:

Version 1.91.1, Branch: docking

Back-ends:

any

Compiler, OS:

Windows 11 + MSVS 2022

Full config/build information:

No response

Details:

I've just updated to 1.91.1 and noticed that if you resize a docked window, you won't get 3 dots after window's name. It looks like this:
image
Further investigation showed that the problem is in the ImGui::RenderTextEllipsis function. It calculates ellipsis size first, and it needs new FontScale property. The property must be in the draw list. But when the SetCurrentWindow function is being called, it updates FontSize this way:
g.FontSize = g.DrawListSharedData.FontSize = window->CalcFontSize();
and the FontScale is being update like this:
g.FontScale = g.FontSize / g.Font->FontSize;
I believe the correct version should be this:
g.FontScale = g.DrawListSharedData.FontScale = g.FontSize / g.Font->FontSize;
I tested the fix and the problem went away.
The commit we are taking about was made on July 2 - 0f63d3e. I tried to find any similar issue, but I couldn't. Am I right in understanding that this is a bug and no one has noticed it yet?
P.S. Please, tell me if you need me to provide any additional info.

Screenshots/Video:

Before 0f63d3e:
image
After 0f63d3e:
image

Minimal, Complete and Verifiable Example code:

No response

@ocornut
Copy link
Owner

ocornut commented Sep 12, 2024

You are absolutely correct, and somehow only Ellipsis rendering was effectively affected.
Pushed a fix dc6346b.
Thank you!

@ocornut ocornut closed this as completed Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants