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

SetWindowFontScale doesn't inherit parent scale for full chain of parent windows #2701

Closed
vegorovinno opened this issue Jul 29, 2019 · 4 comments

Comments

@vegorovinno
Copy link

Version: 1.72
Branch: master v1.72 tag

Back-ends: custom
Compiler: Visual Studio 2019
Operating System: Windows 10

My Issue/Question:

Recent 1.72 update made a change to window font scale: Fixed old SetWindowFontScale() api value from not being inherited by child window. Added comments about the right way to scale your UI

But the value is only being inherited from an immediate parent (not the whole window set up to the root).

Screenshots/Video

Image

ImGui::Begin("Issue");

	ImGui::SetWindowFontScale(1.0f);

	ImGui::Text("TEXT 1");

	{
		ImGui::BeginChild("Issue - Part 2");

		ImGui::SetWindowFontScale(2.0f);

		ImGui::Text("TEXT 2");

		{
			ImGui::BeginChild("Issue - Part 3");

			ImGui::Text("TEXT 3");

			{
				ImGui::BeginChild("Issue - Part 4");

				ImGui::Text("TEXT 4");

				ImGui::End();
			}

			ImGui::End();
		}

		ImGui::End();
	}

	ImGui::End();

"TEXT 4" doesn't inherit 2x scale from "Part 2" child.

@ocornut
Copy link
Owner

ocornut commented Jul 29, 2019

I'll look into fixing this, thank you.
Are you actually using this old function, or did you only found about it because recent changelog?

Attachment:
image

@vegorovinno
Copy link
Author

We were using it since April so at first we thought that now we can remove this call after each ImGui::BeginChild.

@ocornut ocornut added the bug label Aug 16, 2019
@n00bmind
Copy link

My 2 cents on this..
We are using this function, our app has a main scalable canvas where we want to vary the font size, and child panel windows where we want it to stay constant, so for us it'd be good to be able to disable the scaling applied from the parent..
Any chance of having a flag passed to the function to control this behaviour?

Thanks!

@ocornut
Copy link
Owner

ocornut commented Jan 16, 2025

This is now fixed by b7c27c5.
Note that an upcoming major release should make this obsolete as we will introduce better font scaling functions, but in the meanwhile it works better now.

@ocornut ocornut closed this as completed Jan 16, 2025
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

3 participants