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

Potential to improve scaled UI appearance #762

Open
sievaxx opened this issue May 26, 2024 · 2 comments
Open

Potential to improve scaled UI appearance #762

sievaxx opened this issue May 26, 2024 · 2 comments
Labels

Comments

@sievaxx
Copy link

sievaxx commented May 26, 2024

Godot's default rendering settings for fonts and icons is not the best for applications if they want to support HiDPI / UI Scaling.

For fonts, I would recommend turning on Multichannel Signed Distance Fields for font rendering. Some fonts however will create artifacts when used with MSDF, which requires trial and error with the Pixel Range and Size settings, or replacing with a font that does not have issues.
The default Mono font that GodSVG uses (JetBrains Mono) is one font that has bad rendering with MSDF no matter how hard you try to correct it, so in this case it would require being replaced with another.

For icons, you could import their SVGs with their scale set to above 1, however this would cause the buttons and related Control nodes to resize to match.
image

You can fix this by setting max_icon_width in the theme settings for Button and it's derived classes. Note that this will not work currently for CheckBox and CheckButton, but it has been fixed for 4.3.
image

There are a few places where GodSVG manually draws using draw_texture(). If used with upscaled SVGs as is, these would also break.
image

Changing them with draw_texture_rect(tex, Rect2(Vector2.ZERO, [original texture size], false) would fix the issue.
image

I had already made all these changes on my local copy of the project to test if it would work before submitting this request. I won't be submitting a PR though, as I have done them in a very straight way with no possibility of customizing it.
image

@MewPurPur
Copy link
Owner

MewPurPur commented May 26, 2024

Thanks for this proposal! In theory, we agree with everything here. In practice, the reason we're not dealing with it is because we hope that godotengine/godot#86022 will make it into Godot 4.4, which would allow us to test it and see if it works. (The first GodSVG stable will probably not release in Godot 4.3). This is mainly to deal with the fact that you need hacks to deal with the issues.

You can fix this by setting max_icon_width in the theme settings for Button and it's derived classes. Note that this will not work currently for CheckBox and CheckButton, godotengine/godot#91700.

This is the worst hack of the ones that would be needed. I'm aware of the possibility, it's just that it would be a sort of last resort.

I'll keep this proposal around as it outlines excellently everything that is needed.

@MewPurPur
Copy link
Owner

MewPurPur commented Jun 14, 2024

An issue that wasn't mentioned here, but we'll likely eventually get it solved for free in a minor version or 4.4: godotengine/godot#92997

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants