Fix formatting
This commit is contained in:
@@ -325,9 +325,8 @@ void ParsedText::layoutAndExtractLines(
|
|||||||
|
|
||||||
// Keep previous lines fixed; recompute only this specific line without hyphenation.
|
// Keep previous lines fixed; recompute only this specific line without hyphenation.
|
||||||
// Suppression is intentionally line-local.
|
// Suppression is intentionally line-local.
|
||||||
const size_t retryBreak =
|
const size_t retryBreak = computeSingleLineBreakNoHyphen(renderer, fontId, pageWidth, wordWidths, wordContinues,
|
||||||
computeSingleLineBreakNoHyphen(renderer, fontId, pageWidth, wordWidths, wordContinues, lineStart,
|
lineStart, firstLineIndent);
|
||||||
firstLineIndent);
|
|
||||||
|
|
||||||
lineBreakIndices.resize(i + 1);
|
lineBreakIndices.resize(i + 1);
|
||||||
lineEndsWithHyphenatedWord.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,
|
size_t ParsedText::computeSingleLineBreakNoHyphen(const GfxRenderer& renderer, const int fontId, const int pageWidth,
|
||||||
const std::vector<uint16_t>& wordWidths,
|
const std::vector<uint16_t>& wordWidths,
|
||||||
const std::vector<bool>& continuesVec,
|
const std::vector<bool>& continuesVec, const size_t lineStartIndex,
|
||||||
const size_t lineStartIndex, const int firstLineIndent) const {
|
const int firstLineIndent) const {
|
||||||
// One-line non-hyphenating breaker used by the page-boundary retry path.
|
// One-line non-hyphenating breaker used by the page-boundary retry path.
|
||||||
if (lineStartIndex >= wordWidths.size()) {
|
if (lineStartIndex >= wordWidths.size()) {
|
||||||
return lineStartIndex;
|
return lineStartIndex;
|
||||||
@@ -681,14 +680,10 @@ void ParsedText::applyBionicReadingTransform() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Builds break indices while opportunistically splitting the word that would overflow the current line.
|
// 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,
|
std::vector<size_t> ParsedText::computeHyphenatedLineBreaks(
|
||||||
const int pageWidth, std::vector<uint16_t>& wordWidths,
|
const GfxRenderer& renderer, const int fontId, const int pageWidth, std::vector<uint16_t>& wordWidths,
|
||||||
std::vector<bool>& continuesVec,
|
std::vector<bool>& continuesVec, std::vector<bool>& lineEndsWithHyphenatedWord,
|
||||||
std::vector<bool>& lineEndsWithHyphenatedWord,
|
std::vector<int>& splitPrefixWordIndexes, std::vector<bool>& splitInsertedHyphen, const int firstLineIndent) {
|
||||||
std::vector<int>& splitPrefixWordIndexes,
|
|
||||||
std::vector<bool>& splitInsertedHyphen,
|
|
||||||
const int firstLineIndent) {
|
|
||||||
|
|
||||||
// Pre-compute inter-word gaps to avoid repeated codepoint scanning and renderer
|
// 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
|
// 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
|
// a placeholder gap (0) at that position to keep the vector in sync; the remainder
|
||||||
|
|||||||
@@ -39,8 +39,7 @@ class ParsedText {
|
|||||||
std::vector<uint16_t>& wordWidths, std::vector<bool>& continuesVec,
|
std::vector<uint16_t>& wordWidths, std::vector<bool>& continuesVec,
|
||||||
std::vector<bool>& lineEndsWithHyphenatedWord,
|
std::vector<bool>& lineEndsWithHyphenatedWord,
|
||||||
std::vector<int>& splitPrefixWordIndexes,
|
std::vector<int>& splitPrefixWordIndexes,
|
||||||
std::vector<bool>& splitInsertedHyphen,
|
std::vector<bool>& splitInsertedHyphen, int firstLineIndent);
|
||||||
int firstLineIndent);
|
|
||||||
// Recompute hyphenated breaks for a suffix that starts at startIndex.
|
// Recompute hyphenated breaks for a suffix that starts at startIndex.
|
||||||
// Used after a single-line retry so later lines keep normal hyphenation.
|
// Used after a single-line retry so later lines keep normal hyphenation.
|
||||||
std::vector<size_t> computeHyphenatedLineBreaksFromIndex(const GfxRenderer& renderer, int fontId, int pageWidth,
|
std::vector<size_t> computeHyphenatedLineBreaksFromIndex(const GfxRenderer& renderer, int fontId, int pageWidth,
|
||||||
|
|||||||
Reference in New Issue
Block a user