Merge pull request #119761 from sydist/fix/rich-text-label-tab-size-clamping
Fix RichTextLabel tab_size 0 causing 1px indent on lists and indents
This commit is contained in:
@@ -3638,7 +3638,9 @@ int RichTextLabel::_find_margin(Item *p_item, const Ref<Font> &p_base_font, int
|
||||
if (font_size_it && font_size_it->font_size > 0) {
|
||||
font_size = font_size_it->font_size;
|
||||
}
|
||||
margin += MAX(1, tab_size * (font->get_char_size(' ', font_size).width + font->get_spacing(TextServer::SPACING_SPACE)));
|
||||
if (tab_size > 0) {
|
||||
margin += MAX(1, tab_size * (font->get_char_size(' ', font_size).width + font->get_spacing(TextServer::SPACING_SPACE)));
|
||||
}
|
||||
|
||||
} else if (item->type == ITEM_LIST) {
|
||||
Ref<Font> font = p_base_font;
|
||||
@@ -3657,7 +3659,9 @@ int RichTextLabel::_find_margin(Item *p_item, const Ref<Font> &p_base_font, int
|
||||
if (font_size_it && font_size_it->font_size > 0) {
|
||||
font_size = font_size_it->font_size;
|
||||
}
|
||||
margin += MAX(1, tab_size * (font->get_char_size(' ', font_size).width + font->get_spacing(TextServer::SPACING_SPACE)));
|
||||
if (tab_size > 0) {
|
||||
margin += MAX(1, tab_size * (font->get_char_size(' ', font_size).width + font->get_spacing(TextServer::SPACING_SPACE)));
|
||||
}
|
||||
}
|
||||
|
||||
item = item->parent;
|
||||
|
||||
Reference in New Issue
Block a user