godot icon indicating copy to clipboard operation
godot copied to clipboard

Label lines disappear when line spacing is set to a negative number

Open fguillen opened this issue 2 years ago • 1 comments

Godot version

4.0.3.stable

System information

MacOS - Ventura 13.1 - Godot 4.0.stable

Issue description

In all programs I use that deal with text, when you set a negative number in the "Font line spacing" the lines get closer until they even intersect. I want to reduce the space between lines in my label but 0 is not enough closer so I want to go on to negative numbers. What happens now is that the text in the second line disappears.

Steps to reproduce

Add a Label to the Scene. Set a text with 2 lines. Set:

Theme Overrites > Constants > Line Spacing

to -1

Minimal reproduction project

Reproduction steps are trivial

fguillen avatar Jul 10 '23 15:07 fguillen

I can't reproduce this on 4.1.stable:

https://github.com/godotengine/godot/assets/180032/91042381-ac89-4f35-b203-75dfeceed36b

Note that when you override the value to -1, you're decreasing the default value by 4 pixels as the default value is actually 3 (even though the inspector displays 0 until you override the value).

Calinou avatar Jul 10 '23 15:07 Calinou

I am reproducing it in 4.1.stable (Mac OS):

https://github.com/godotengine/godot/assets/23043/24753385-b5d0-4c89-b165-f7973ea6e583

I am attaching the test project: godot_test.zip

fguillen avatar Jul 10 '23 19:07 fguillen

I am reproducing it in 4.1.stable (Mac OS):

Ah, that's a different use case when the label's extents are just tall enough to fit the number of lines.

I can confirm this on 4.1.stable. As a workaround, resize the label to be taller than it needs to be. If the Label is within a container, set a custom minimum height that's tall enough to fit more than two lines.

Calinou avatar Jul 10 '23 19:07 Calinou

In a slightly different circumstance/edge case, I just encountered this also with single-line text - but only on the web export!

Under Linux and Windows (Wine) my credits screen looked like this: Screenshot_20230913_133220

The same project when "run in browser" from the editor: Screenshot_20230913_133423

However, giving the label a sufficiently tall minimum height did indeed work around the issue.

EDIT: Apparently the minimum height needed to work around the issue varies between browsers. In my case, Chromium needed a larger minimum height than Firefox.

romlok avatar Sep 13 '23 11:09 romlok