The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

+2 votes

Hoping for a bit of assistance in diagnosing this issue.

I've created a minimal project here that showcases the issue. The graphics used are created by me and the font used is TinyPixie2 by Tiny Pixie via public domain from here

showing text resizing incorrectly when resizing the window

The main issue as you can see from this gif is that the font size/spacing jumps around when resizing the window (the font size/spacing isn't actually changing when observing the node, just the way it appears). Also it seems when using any window size that isn't a perfect scaling of the render size it will cause this issue (not jumping around but not fitting the bubble.)

In the project code I am using a NinePatchRect and RichTextLabel on the same level in the tree (with the label in front). In GDScript I get the size of the text with label.get_font("normal_font").get_string_size(label.get_text()) and use this to dynamically set the size of the ninepatch rect. I do this because in my actual project I am animating this with a tween.

So the size of the bubble is set to the size of the text and font with the above code. Even when I start the project at a different resolution (not changing the window size) the text will display condensed from the start but the above code will say it's longer. Like it isn't an issue that its happening dynamically, it's that the above code is returning a different value than what the text appears as.

I'm not sure if this is just an issue with this particular font or if this is a setting I can change somewhere.

I would really appreciate the help! Let me know if you have any other questions!

Godot version 3.2.3.stable.official
in Engine by (14 points)

Follow up:

I'm slowly deciding to move my project from 2d stretch mode to the viewport stretch mode to keep that chunky pixel-perfect look. I like the pixel-perfect look but I needed to convince myself it's a good idea.

Using viewport actually seems to fix this issue. The text no longer jumps around when scaled to different resolutions.

This isn't really a solution to the issue as not all projects can be set to viewport scaling, but I think it works for my project.

I would still be very interested if anyone knows of other workarounds to fix this text rendering.

This is a great question! I'm running into the same problem while trying to get multiple text labels to seamlessly sit side by side. Using an HBoxContainer or the label.get_font("normal_font").get_string_size(label.get_text()) method described above both work at the default resolution, but resizing the window causes a noticeable gap to form between the labels.

Unfortunately I can't use viewport scaling because it causes the font/art to be indecipherable at smaller resolutions. One workaround might be to pre-render all the text I need as images. Another one might be to limit the resolutions that the player can choose from. But neither sound ideal, so I'd be interested in knowing if anyone has any other solutions :)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.