From 908788da254d449152046ae9908c986738471a66 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sat, 3 Aug 2024 00:18:41 +0200 Subject: [PATCH] Fixed an issue where text was not correctly centered after line breaks --- es-core/src/resources/Font.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/es-core/src/resources/Font.cpp b/es-core/src/resources/Font.cpp index e325aa4a6..4ec764707 100644 --- a/es-core/src/resources/Font.cpp +++ b/es-core/src/resources/Font.cpp @@ -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( - cursor) /* cursor is already advanced */, - xLen, alignment) : + (xLen != 0 ? getNewlineStartOffset( + text, static_cast(segment.startPos + 1), + xLen, alignment) : 0); continue; }