From 3f4db13c29f5e320540d0d53c4c1fe8063d45df5 Mon Sep 17 00:00:00 2001 From: spfenwick Date: Sat, 2 May 2026 17:05:19 +1200 Subject: [PATCH] Fix formatting --- lib/Epub/Epub/ParsedText.cpp | 21 ++++++++------------- lib/Epub/Epub/ParsedText.h | 5 ++--- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/lib/Epub/Epub/ParsedText.cpp b/lib/Epub/Epub/ParsedText.cpp index 75553560..c1abcaab 100644 --- a/lib/Epub/Epub/ParsedText.cpp +++ b/lib/Epub/Epub/ParsedText.cpp @@ -325,9 +325,8 @@ void ParsedText::layoutAndExtractLines( // Keep previous lines fixed; recompute only this specific line without hyphenation. // Suppression is intentionally line-local. - const size_t retryBreak = - computeSingleLineBreakNoHyphen(renderer, fontId, pageWidth, wordWidths, wordContinues, lineStart, - firstLineIndent); + const size_t retryBreak = computeSingleLineBreakNoHyphen(renderer, fontId, pageWidth, wordWidths, wordContinues, + lineStart, firstLineIndent); lineBreakIndices.resize(i + 1); lineEndsWithHyphenatedWord.resize(i + 1); @@ -529,8 +528,8 @@ std::vector ParsedText::computeLineBreaks(const GfxRenderer& renderer, c size_t ParsedText::computeSingleLineBreakNoHyphen(const GfxRenderer& renderer, const int fontId, const int pageWidth, const std::vector& wordWidths, - const std::vector& continuesVec, - const size_t lineStartIndex, const int firstLineIndent) const { + const std::vector& continuesVec, const size_t lineStartIndex, + const int firstLineIndent) const { // One-line non-hyphenating breaker used by the page-boundary retry path. if (lineStartIndex >= wordWidths.size()) { return lineStartIndex; @@ -681,14 +680,10 @@ void ParsedText::applyBionicReadingTransform() { } // Builds break indices while opportunistically splitting the word that would overflow the current line. -std::vector ParsedText::computeHyphenatedLineBreaks(const GfxRenderer& renderer, const int fontId, - const int pageWidth, std::vector& wordWidths, - std::vector& continuesVec, - std::vector& lineEndsWithHyphenatedWord, - std::vector& splitPrefixWordIndexes, - std::vector& splitInsertedHyphen, - const int firstLineIndent) { - +std::vector ParsedText::computeHyphenatedLineBreaks( + const GfxRenderer& renderer, const int fontId, const int pageWidth, std::vector& wordWidths, + std::vector& continuesVec, std::vector& lineEndsWithHyphenatedWord, + std::vector& splitPrefixWordIndexes, std::vector& splitInsertedHyphen, const int firstLineIndent) { // Pre-compute inter-word gaps to avoid repeated codepoint scanning and renderer // calls in the inner loop. When hyphenateWordAtIndex inserts a new word, we insert // a placeholder gap (0) at that position to keep the vector in sync; the remainder diff --git a/lib/Epub/Epub/ParsedText.h b/lib/Epub/Epub/ParsedText.h index 486054ec..f60388bb 100644 --- a/lib/Epub/Epub/ParsedText.h +++ b/lib/Epub/Epub/ParsedText.h @@ -27,7 +27,7 @@ class ParsedText { bool extraParagraphSpacing; bool hyphenationEnabled; bool bionicReadingEnabled; - bool isContinuation_ = false; ///< true after an intermediate flush; suppresses re-applying paragraph indent + bool isContinuation_ = false; ///< true after an intermediate flush; suppresses re-applying paragraph indent size_t bionicTransformedUpTo_ = 0; ///< words[0..bionicTransformedUpTo_) have already been bionic-transformed void applyParagraphIndent(); @@ -39,8 +39,7 @@ class ParsedText { std::vector& wordWidths, std::vector& continuesVec, std::vector& lineEndsWithHyphenatedWord, std::vector& splitPrefixWordIndexes, - std::vector& splitInsertedHyphen, - int firstLineIndent); + std::vector& splitInsertedHyphen, int firstLineIndent); // Recompute hyphenated breaks for a suffix that starts at startIndex. // Used after a single-line retry so later lines keep normal hyphenation. std::vector computeHyphenatedLineBreaksFromIndex(const GfxRenderer& renderer, int fontId, int pageWidth,