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

Bad font quality when downscalling #30729

Closed
zaksnet opened this issue Jul 21, 2019 · 9 comments
Closed

Bad font quality when downscalling #30729

zaksnet opened this issue Jul 21, 2019 · 9 comments

Comments

@zaksnet
Copy link
Contributor

zaksnet commented Jul 21, 2019

Godot version:
3.2 Dev

OS/device including version:
Windows 10

Issue description:
Scale= 1:
Screenshot_21
Scale = 0.7:
Screenshot_19
As seen in the picture, fonts look bad when downscalling.

Also strech mode doesn't seem to make any diffrence:
Screenshot_20

  • Oversampling is enabled.
  • The font is a dynamic .otf font (also tried ttf).

EDIT: Use Mipmaps and use Filter does seem to improve it but i think it looks little blurry.
Screenshot_23

@zaksnet zaksnet changed the title Bad font quality Bad font quality when downscalling Jul 21, 2019
@Calinou
Copy link
Member

Calinou commented Jul 21, 2019

This is expected when downscaling an image that doesn't use mipmaps. You can enable mipmaps to improve the interpolation quality, but it will then look blurry. There's no way to solve this when downscaling by a non-integer factor – you will run into the same issue when downscaling an image in GIMP, for instance.

Font oversampling is a "global" property which is meant to render fonts at an higher (or lower) resolution depending on the window size. It has no effect on scaled controls.

As a workaround, create a separate font resource with a smaller size, and avoid scaling the Control. (Scaling a control for animation purposes is fine, just make sure to enable Filter on the font then.)

@zaksnet
Copy link
Contributor Author

zaksnet commented Jul 21, 2019

Thank you @Calinou . Can you please tell me if there is a way to prevent just the font from being scaled? Images seem to be scaled nicely so far. I'm trying to create a UI for multiple resolutions without having to recreate the graphics and so far only fonts don't render nice when downscaled.

@Calinou
Copy link
Member

Calinou commented Jul 21, 2019

I'm trying to create a UI for multiple resolutions without having to recreate the graphics and so far only fonts don't render nice when downscaled.

Just set up GUI anchors correctly, and use the 2d stretch mode and expand stretch aspect as you did. You don't need to scale controls manually; Godot will do it for you as the window size changes. See Multiple resolutions in the documentation for details.

Scaling control nodes is mainly useful for animation purposes; you should avoid doing it otherwise.

@TheDuriel
Copy link
Contributor

See #30643

Note that i've not seen a case in which mipmapping a font resource did anything.

@zaksnet
Copy link
Contributor Author

zaksnet commented Jul 24, 2019

Note that i've not seen a case in which mipmapping a font resource did anything.

Although my knowledge about mipmap goes as far as what @Calinou explained, i also haven't seen any difference when enabling mipmap.

Just set up GUI anchors correctly, and use the 2d stretch mode and expand stretch aspect as you did. You don't need to scale controls manually; Godot will do it for you as the window size changes. See Multiple resolutions in the documentation for details.

Scaling control nodes is mainly useful for animation purposes; you should avoid doing it otherwise.

Well, Godot does resize the controls, it does not scale them. Although this is all you need is most cases, For future reference, @Calinou was right, the UI is being scaled. what i want is to give users the option to shrink or enlarge the UI interface (much like HiDPi but customizable) which seemed to work out of the box by just scaling the parent control of the UI, except the font. Also, i would like this scaling to happen depending on the resolution (which i failed to explain in my previous comment). Finally, i concluded that i will have 3 different variations of the UI and apply them depending on the resolution. As far as this issue is concerned, i think its a duplicate of #30643.

EDIT: Well, not realy a duplicate because #30643 suggests that filter should be turned on automatically. Although i am not against this suggestion, fonts that have good quality when not scaled (and oversampling is enabled) seem to be blurry when filter is on.

This can be reopened (or not, you decide).

@naturally-intelligent
Copy link

I'm also running into this issue with Godot 3.5

Specifically running a 1920x1080 game at 1366x768
The fonts are barely readable even with filter + mipmap on.

Ironically images with text downscale better, than a TTF font!
May post an image if anyone is interested...

@Calinou
Copy link
Member

Calinou commented Aug 16, 2022

I'm also running into this issue with Godot 3.5

In 4.0, this is fixed when using MSDF fonts, although very small text will remain hard to read as MSDF doesn't use hinting.

Can you take screenshots of the text in 1920×1080 and 1366×768 respectively? Did you scale Control nodes (which should be avoided except for animation purposes)? Also, please upload a minimal reproduction project.

@Zireael07
Copy link
Contributor

@xahon: You said the control is NOT scaled, therefore this is a different issue. I think you're seeing a duplicate of #74694

@xahon
Copy link

xahon commented Mar 20, 2023

@Zireael07 thanks, moved my comments there

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

8 participants