diff --git a/es-core/src/resources/Font.cpp b/es-core/src/resources/Font.cpp index 7edc67a79..b4d6c5e94 100644 --- a/es-core/src/resources/Font.cpp +++ b/es-core/src/resources/Font.cpp @@ -882,7 +882,12 @@ void Font::wrapText(std::vector& segmentsHB, // New row. size_t offset {0}; - if (lastSpace == i && !lastSegmentSpace) { + bool shapedSegmentChange {false}; + if (lastSpace == 0 && resultSegments.size() > 0 && + !resultSegments.back().lineBreak) + shapedSegmentChange = true; + + if (lastSpace == i && !lastSegmentSpace && !shapedSegmentChange) { if (segment.rightToLeft) newSegment.glyphIndexes.insert(newSegment.glyphIndexes.begin(), segment.glyphIndexes[i]); @@ -906,6 +911,9 @@ void Font::wrapText(std::vector& segmentsHB, spaceAccum = 0; } } + else if (shapedSegmentChange) { + offset = i; + } else { if (lastSpace == 0) ++spaceAccum;