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') {
y += getHeight(lineSpacing);
x = offset[0] +
(xLen != 0 ? getNewlineStartOffset(text,
static_cast<const unsigned int>(
cursor) /* cursor is already advanced */,
xLen, alignment) :
(xLen != 0 ? getNewlineStartOffset(
text, static_cast<const unsigned int>(segment.startPos + 1),
xLen, alignment) :
0);
continue;
}