MCPcopy Create free account
hub / github.com/crosspoint-reader/crosspoint-reader / computeJustifyExtra

Function computeJustifyExtra

lib/Epub/Epub/ParsedText.cpp:179–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177}
178
179int computeJustifyExtra(const int spareSpace, const size_t gapCount) {
180 if (gapCount < MIN_JUSTIFY_GAPS || spareSpace <= 0) return 0;
181 // Distribute the spare space evenly across gaps. Do NOT bail out to 0 when the
182 // per-gap stretch is large: a sparse line (few words on a wide page) legitimately
183 // needs big gaps to reach the margin. Returning 0 there disables justification for
184 // that line, leaving it right-aligned (RTL) / left-aligned (LTR) — the mismatched
185 // alignment bug. Match the un-capped behavior of the old code.
186 return spareSpace / static_cast<int>(gapCount);
187}
188
189// Removes every soft hyphen in-place so rendered glyphs match measured widths.
190void stripSoftHyphensInPlace(std::string& word) {

Callers 1

extractLineMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected