Fixed an issue where text was not correctly centered after line breaks

This commit is contained in:
Leon Styhre 2024-08-03 00:18:41 +02:00
parent c87d2e7584
commit 908788da25

View file

@ -218,10 +218,9 @@ TextCache* Font::buildTextCache(const std::string& text,
if (!segment.doShape && character == '\n') { if (!segment.doShape && character == '\n') {
y += getHeight(lineSpacing); y += getHeight(lineSpacing);
x = offset[0] + x = offset[0] +
(xLen != 0 ? getNewlineStartOffset(text, (xLen != 0 ? getNewlineStartOffset(
static_cast<const unsigned int>( text, static_cast<const unsigned int>(segment.startPos + 1),
cursor) /* cursor is already advanced */, xLen, alignment) :
xLen, alignment) :
0); 0);
continue; continue;
} }