Fix formatting

This commit is contained in:
spfenwick
2026-05-02 17:07:10 +12:00
parent 0a5fee2839
commit 3f4db13c29
2 changed files with 10 additions and 16 deletions
+8 -13
View File
@@ -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<size_t> ParsedText::computeLineBreaks(const GfxRenderer& renderer, c
size_t ParsedText::computeSingleLineBreakNoHyphen(const GfxRenderer& renderer, const int fontId, const int pageWidth,
const std::vector<uint16_t>& wordWidths,
const std::vector<bool>& continuesVec,
const size_t lineStartIndex, const int firstLineIndent) const {
const std::vector<bool>& 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<size_t> ParsedText::computeHyphenatedLineBreaks(const GfxRenderer& renderer, const int fontId,
const int pageWidth, std::vector<uint16_t>& wordWidths,
std::vector<bool>& continuesVec,
std::vector<bool>& lineEndsWithHyphenatedWord,
std::vector<int>& splitPrefixWordIndexes,
std::vector<bool>& splitInsertedHyphen,
const int firstLineIndent) {
std::vector<size_t> ParsedText::computeHyphenatedLineBreaks(
const GfxRenderer& renderer, const int fontId, const int pageWidth, std::vector<uint16_t>& wordWidths,
std::vector<bool>& continuesVec, std::vector<bool>& lineEndsWithHyphenatedWord,
std::vector<int>& splitPrefixWordIndexes, std::vector<bool>& 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
+2 -3
View File
@@ -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<uint16_t>& wordWidths, std::vector<bool>& continuesVec,
std::vector<bool>& lineEndsWithHyphenatedWord,
std::vector<int>& splitPrefixWordIndexes,
std::vector<bool>& splitInsertedHyphen,
int firstLineIndent);
std::vector<bool>& 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<size_t> computeHyphenatedLineBreaksFromIndex(const GfxRenderer& renderer, int fontId, int pageWidth,