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

RichTextLabel not respecting the content_margin_bottom value. #87537

Closed
azagaya opened this issue Jan 24, 2024 · 2 comments · Fixed by #88167
Closed

RichTextLabel not respecting the content_margin_bottom value. #87537

azagaya opened this issue Jan 24, 2024 · 2 comments · Fixed by #88167

Comments

@azagaya
Copy link
Contributor

azagaya commented Jan 24, 2024

Tested versions

v4.2.1.stable.official [b09f793]

System information

Windows 11 and Ubuntu 22.04, all renderers

Issue description

When adding a style to a RichTextLabel, and setting content_margin_bot, the text does not respect these margin, which causes text being rendered on top of the margins.

Example:
image

Steps to reproduce

  • Add a RichTextLabel, fill it with text
  • Add a StyleBoxFlat to it
  • Set border width to 20 for all borders
  • Set content margin to 30 for all borders
  • Note how text overlaps with borders only in the bottom

Minimal reproduction project (MRP)

ThemeIssues.zip

@noidexe
Copy link
Contributor

noidexe commented Jan 24, 2024

I noticed that as you add to bottom_margin it adds extra blank content to scroll after the text.
Here's how it looks with content_margin_bottom = 100
image
image

So it seems to be adding to the content to be scrolled rather than calculate where to clip content rendering

@noidexe
Copy link
Contributor

noidexe commented Jan 25, 2024

The same problem happens with the right content margin

image

It works correctly when enabling "Fit Content"

image

Notice that the same happens with a regular label when you enable "Clip Text"

image

But it works correctly when "Text Overrun" is set to anything other than "Trim Nothing". Here's with "Trim Characters"

image

Also, you can see that setting direction to right-to-left makes results in the left content margin being ignored

image

What I think is happening is that the contents are rendered using the right offset as starting point, but then Clip Contents only cares about the control's rectangle even though it should consider content margins

DictyosteliumDiscoideum added a commit to DictyosteliumDiscoideum/godot that referenced this issue Feb 10, 2024
@akien-mga akien-mga added this to the 4.4 milestone Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants