MewPurPur / GodSVG

An application in early development for creating simple vector graphics. Built in Godot.
https://godsvg.com
MIT License
1.06k stars 48 forks source link

Potential to improve scaled UI appearance #762

Open Sievaxx opened 1 month ago

Sievaxx commented 1 month ago

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 commented 1 month ago

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 https://github.com/godotengine/godot/pull/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, https://github.com/godotengine/godot/pull/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 commented 2 weeks ago

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