Fix incorrect justification of last line in paragraph

This commit is contained in:
Dave Allie 2025-12-21 18:57:30 +11:00
parent 955c78de64
commit a97dd9607b
No known key found for this signature in database
GPG Key ID: F2FDDB3AD8D0276F

View File

@ -144,7 +144,7 @@ void ParsedText::extractLine(const size_t breakIndex, const int pageWidth, const
const int spareSpace = pageWidth - lineWordWidthSum; const int spareSpace = pageWidth - lineWordWidthSum;
int spacing = spaceWidth; int spacing = spaceWidth;
const bool isLastLine = lineBreak == words.size(); const bool isLastLine = breakIndex == lineBreakIndices.size() - 1;
if (style == TextBlock::JUSTIFIED && !isLastLine && lineWordCount >= 2) { if (style == TextBlock::JUSTIFIED && !isLastLine && lineWordCount >= 2) {
spacing = spareSpace / (lineWordCount - 1); spacing = spareSpace / (lineWordCount - 1);