Closed 20milliliter closed 1 year ago
I have an issue with font rendering as well. On the left is rendered text in Godot (10px size) and on the right default Windows 10 font viewer
I've tried different import options. I use these options now because it looks the best of all other setting sets
The UI control and all it's parents are not scaled (1, 1, 1)
Here is an SDF approach. On the left is how it looks like in the editor, on the right how it looks in the game
I've tried different MSDF settings, it still looks awful
It worth noting that I use fixed viewport size and window override. Both have the same aspect ratio.
This is only when alignment is center (isn't it), so probably a devide-by-2 thing
This is not a bug; this occurs because you're displaying the font at a non-integer multiple. Pixel art fonts must be displayed at a multiple of the size they were designed for to look correct. If you follow this guidance correctly (including on the scale of Control nodes that display the font), you shouldn't even need to disable antialiasing on import – disabling subpixel positioning is enough.
For example, if I enable antialiasing, notice how all fonts turn blurry except the ones that are a multiple of the intended size (16 and 32):
Unifont is designed for size 16.
But then how to explain this?:
![Screenshot 2023-05-15 17:28:07](https://github.com/godotengine/godot/assets/115401023/b896548d-6a6e-402a-af9c-649384b766e1) | ![Screenshot 2023-05-15 17:28:07](https://github.com/godotengine/godot/assets/115401023/07a831ca-cedc-4708-8433-5cfa03ee0b79) |
viewport width 200 | width 199 |
@thornySoap If using the canvas_items
or viewport
stretch mode, this is likely an issue with the window size not being an integer multiple, which causes uneven pixel scaling. See https://github.com/godotengine/godot-proposals/issues/1666.
@Calinou this is with stretch mode disabled:
@thornySoap You have subpixel positioning set to Auto on fonts/Pixeloid/PixeloidSans.ttf
in the Import dock. Set it to Disabled, click Reimport then use Scene > Reload Saved Scene. Doing so fixes the font display for me in the MRP you uploaded.
@Calinou thank you yery much. Sorry for having annoyed you with that 😣
Unifont is designed for size 16.
@Calinou How do you know? Why does other software disagree with you?
12 pt is different from 16px :)
Different software uses different coventions for font sizes, so it's best to try different font sizes until you find one that looks "right".
Different software uses different coventions for font sizes
TIL. Very unintuitive. @Calinou Mention of this should also be included in your PR, I feel.
@Calinou Mention of this should also be included in your PR, I feel.
Great, thanks so much.
Godot version
4.0.stable
System information
Windows 10, Forward+, NVIDIA Studio 527.56
Issue description
A pixel font is being rendered incorrectly despite disabling Subpixel Positioning. (#70327)
*image is exact size
Steps to reproduce
The minimal reproduction project shows various sizes of the font, comparing their appearance in engine and how they are supposed to look (via a keep size texture rect containing an image created seperately).
The left column shows the text in engine, the right shows the texture rects. The font sizes from top to bottom are 12, 16, 24, 32, and 36.
Minimal reproduction project
Bug.zip