diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-08-30 11:56:17 +0300 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-09-01 08:11:55 +0300 |
commit | 7aad14a4b6d7ef722851a8c4f9fcafa5b48666b3 (patch) | |
tree | 604c8c544701b5c5bf2eab55b9b3c62b952e9711 /scene/gui/label.cpp | |
parent | 1c037c89d4345789c17dfa19bf1e8bd67f702f09 (diff) | |
download | redot-engine-7aad14a4b6d7ef722851a8c4f9fcafa5b48666b3.tar.gz |
[TextServer] Add support for trimming edge spaces on line break.
Diffstat (limited to 'scene/gui/label.cpp')
-rw-r--r-- | scene/gui/label.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index cd68d1f001..fd174619d5 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -143,8 +143,9 @@ void Label::_shape() { case TextServer::AUTOWRAP_OFF: break; } - PackedInt32Array line_breaks = TS->shaped_text_get_line_breaks(text_rid, width, 0, autowrap_flags); + autowrap_flags = autowrap_flags | TextServer::BREAK_TRIM_EDGE_SPACES; + PackedInt32Array line_breaks = TS->shaped_text_get_line_breaks(text_rid, width, 0, autowrap_flags); for (int i = 0; i < line_breaks.size(); i = i + 2) { RID line = TS->shaped_text_substr(text_rid, line_breaks[i], line_breaks[i + 1] - line_breaks[i]); lines_rid.push_back(line); |