mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Add properties to configure space trimming on line break.
This commit is contained in:
@@ -45,7 +45,7 @@ void ItemList::_shape_text(int p_idx) {
|
||||
}
|
||||
item.text_buf->add_string(item.xl_text, theme_cache.font, theme_cache.font_size, item.language);
|
||||
if (icon_mode == ICON_MODE_TOP && max_text_lines > 0) {
|
||||
item.text_buf->set_break_flags(TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND | TextServer::BREAK_GRAPHEME_BOUND | TextServer::BREAK_TRIM_EDGE_SPACES);
|
||||
item.text_buf->set_break_flags(TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND | TextServer::BREAK_GRAPHEME_BOUND | TextServer::BREAK_TRIM_START_EDGE_SPACES | TextServer::BREAK_TRIM_END_EDGE_SPACES);
|
||||
} else {
|
||||
item.text_buf->set_break_flags(TextServer::BREAK_NONE);
|
||||
}
|
||||
@@ -558,7 +558,7 @@ void ItemList::set_max_text_lines(int p_lines) {
|
||||
max_text_lines = p_lines;
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
if (icon_mode == ICON_MODE_TOP && max_text_lines > 0) {
|
||||
items.write[i].text_buf->set_break_flags(TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND | TextServer::BREAK_GRAPHEME_BOUND | TextServer::BREAK_TRIM_EDGE_SPACES);
|
||||
items.write[i].text_buf->set_break_flags(TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND | TextServer::BREAK_GRAPHEME_BOUND | TextServer::BREAK_TRIM_START_EDGE_SPACES | TextServer::BREAK_TRIM_END_EDGE_SPACES);
|
||||
items.write[i].text_buf->set_max_lines_visible(p_lines);
|
||||
} else {
|
||||
items.write[i].text_buf->set_break_flags(TextServer::BREAK_NONE);
|
||||
@@ -608,7 +608,7 @@ void ItemList::set_icon_mode(IconMode p_mode) {
|
||||
icon_mode = p_mode;
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
if (icon_mode == ICON_MODE_TOP && max_text_lines > 0) {
|
||||
items.write[i].text_buf->set_break_flags(TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND | TextServer::BREAK_GRAPHEME_BOUND | TextServer::BREAK_TRIM_EDGE_SPACES);
|
||||
items.write[i].text_buf->set_break_flags(TextServer::BREAK_MANDATORY | TextServer::BREAK_WORD_BOUND | TextServer::BREAK_GRAPHEME_BOUND | TextServer::BREAK_TRIM_START_EDGE_SPACES | TextServer::BREAK_TRIM_END_EDGE_SPACES);
|
||||
} else {
|
||||
items.write[i].text_buf->set_break_flags(TextServer::BREAK_NONE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user