UI text appears slightly squashed (1–2 pixels) with canvas_item stretch and fractional scaling

Godot Version

4.6

Question

Hello,
I have a problem with text in my Ui, it appears slightly squashed by about 1-2 pixels.
I am developing a 3D game with fixed resolutions such as 1920x1080, 2560x1440, 3840x2160, etc.

Example (you can see it on the S in the middle):

My Display → Window → Stretch settings are:

  • Mode: canvas_item

  • Aspect: expand

  • Scale: 1.0

  • Scale Mode: fractional

My Rendering → 2DSnap settings are:

  • Snap 2D Transforms to Pixel: true

  • Snap 2D Vertices to Pixel: true

Scale Mode: integer is not a option, because of the black areas with some resolutions.

How can I prevent this?

Do I need to configure something specific to ensure pixel perfect fonts, so they don’t appear slightly squashed?

Double click your font in the editor and an Advanced Import Settings dialog opens. There are a lot of settings which affect how the font is rendered. I don’t have a slightest clue which setting might help with this exact rendering problem, so try each setting (one at a time) and see if the problem is fixed.

If this problem occurs only with the character S, the font itself could be the problem. If that’s the case, find an another font.

That’s right, I’ve tried a lot of things, but I’m also talking about Godot’s default font, those settings aren’t really available there. That said, the problem persists with both options.

I’ve now implemented scaling for the UI.
Unfortunately, there’s no better way to solve the problem if there’s no native resolution available.