Fixed a line breaking issue

This commit is contained in:
Leon Styhre 2024-09-04 17:19:36 +02:00
parent 281b967e8f
commit c80ba5be86

View file

@ -882,7 +882,12 @@ void Font::wrapText(std::vector<ShapeSegment>& 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<ShapeSegment>& segmentsHB,
spaceAccum = 0;
}
}
else if (shapedSegmentChange) {
offset = i;
}
else {
if (lastSpace == 0)
++spaceAccum;