A fork of https://github.com/crosspoint-reader/crosspoint-reader
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: Prevent line breaks on common English contractions (#1405)

authored by

Zach Nelson and committed by
GitHub
dc394803 b5df6cb2

+4 -4
+2 -2
lib/Epub/Epub/hyphenation/Hyphenator.cpp
··· 102 102 void appendApostropheContractionBreaks(const std::vector<CodepointInfo>& cps, 103 103 std::vector<Hyphenator::BreakInfo>& outBreaks) { 104 104 constexpr size_t kMinLeftSegmentLen = 3; 105 - constexpr size_t kMinRightSegmentLen = 2; 105 + constexpr size_t kMinRightSegmentLen = 3; 106 106 size_t segmentStart = 0; 107 107 108 108 for (size_t i = 0; i < cps.size(); ++i) { ··· 123 123 } 124 124 } 125 125 126 - // Avoid stranding short clitics like "l'"/"d'" or tiny suffixes like "'t". 126 + // Avoid stranding short clitics like "l'"/"d'" or contraction tails like "'ve"/"'re"/"'ll". 127 127 if (leftPrefixLen >= kMinLeftSegmentLen && rightSuffixLen >= kMinRightSegmentLen) { 128 128 outBreaks.push_back({cps[i + 1].byteOffset, false}); 129 129 }
+2 -2
lib/Epub/Epub/hyphenation/Hyphenator.h
··· 26 26 // 2. Apostrophe contractions between letters (e.g. all'improvviso). 27 27 // Liang patterns are run per alphabetic segment around apostrophes. 28 28 // A direct break at the apostrophe boundary is allowed only when the left 29 - // segment has at least 3 letters and the right segment has at least 2 letters, 30 - // avoiding short clitics (e.g. l', d') and short contraction tails (e.g. can't). 29 + // segment has at least 3 letters and the right segment has at least 3 letters, 30 + // avoiding short clitics (e.g. l', d') and contraction tails (e.g. 've, 're, 'll). 31 31 // 3. Language-specific Liang patterns (e.g. German de_patterns). 32 32 // Example: "Quadratkilometer" -> Qua|drat|ki|lo|me|ter. 33 33 // 4. Fallback every-N-chars splitting (only when includeFallback is true AND no