-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Fix RichTextLabel bottom margin for text clipping #88167
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally (rebased on top of master
0e9caa2), it works as expected after fixing the compilation error mentioned in my above review comments.
Before
rtl_bottom_margin_before.mp4
After
rtl_bottom_margin_after.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine. There's also the same check for the autowrapped lines, and likely need the same change:
godot/scene/gui/rich_text_label.cpp
Lines 820 to 827 in da5f398
Size2 ctrl_size = get_size(); | |
// Draw text. | |
for (int line = 0; line < l.text_buf->get_line_count(); line++) { | |
if (line > 0) { | |
off.y += theme_cache.line_separation; | |
} | |
if (p_ofs.y + off.y >= ctrl_size.height) { |
Thanks! And congrats for your first merged Godot contribution 🎉 |
When a style with a bottom margin was added to a rich text label node,
the bottom margin would be added to the text but the text would not be
clipped.
This adds a line to subtract the bottom margin from the label height
before checking another line should be drawn.
Fixes #87537. Does not fix the additional issue raised regarding
the right margins.