summaryrefslogtreecommitdiffstats
path: root/scene/resources/text_paragraph.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-11-01 15:11:20 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-11-01 15:11:20 +0100
commit3d0041ff971419123c8aaf241f5dddf1fecfc4ef (patch)
tree6117ef15cd2180e711e0fd26700b038f7d4a60ef /scene/resources/text_paragraph.cpp
parent1ea46ad4c3be43bcb7e8a2d539d5a6650794925b (diff)
parent9ad55dc32df2ae06eface1a4ebb5a37478600134 (diff)
downloadredot-engine-3d0041ff971419123c8aaf241f5dddf1fecfc4ef.tar.gz
Merge pull request #84287 from bruvzg/rtl_img_resize_and_dropcap_flow
[TextServer] Fix line breaks for dropcap and resizing embedded objects.
Diffstat (limited to 'scene/resources/text_paragraph.cpp')
-rw-r--r--scene/resources/text_paragraph.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/scene/resources/text_paragraph.cpp b/scene/resources/text_paragraph.cpp
index 239ecb500e..147c9044b8 100644
--- a/scene/resources/text_paragraph.cpp
+++ b/scene/resources/text_paragraph.cpp
@@ -175,17 +175,16 @@ void TextParagraph::_shape_lines() {
for (int i = 0; i < line_breaks.size(); i = i + 2) {
RID line = TS->shaped_text_substr(rid, line_breaks[i], line_breaks[i + 1] - line_breaks[i]);
float h = (TS->shaped_text_get_orientation(line) == TextServer::ORIENTATION_HORIZONTAL) ? TS->shaped_text_get_size(line).y : TS->shaped_text_get_size(line).x;
- if (v_offset < h) {
- TS->free_rid(line);
- break;
- }
if (!tab_stops.is_empty()) {
TS->shaped_text_tab_align(line, tab_stops);
}
- dropcap_lines++;
- v_offset -= h;
start = line_breaks[i + 1];
lines_rid.push_back(line);
+ if (v_offset < h) {
+ break;
+ }
+ dropcap_lines++;
+ v_offset -= h;
}
}
// Use fixed for the rest of lines.