@@ -1006,7 +1006,10 @@ void ParsedText::extractLine(const size_t breakIndex, const int pageWidth, const
|
|||||||
int advance =
|
int advance =
|
||||||
renderer.getKerning(fontId, lastCodepoint(reorderedWordsScratch[wordIdx]),
|
renderer.getKerning(fontId, lastCodepoint(reorderedWordsScratch[wordIdx]),
|
||||||
firstCodepoint(reorderedWordsScratch[wordIdx + 1]), reorderedStylesScratch[wordIdx]);
|
firstCodepoint(reorderedWordsScratch[wordIdx + 1]), reorderedStylesScratch[wordIdx]);
|
||||||
if (reorderedWordsScratch[wordIdx] == " " && reorderedContinuesScratch[wordIdx] &&
|
// wordIdx > 0 mirrors the gap accounting above (which skips index 0): a leading
|
||||||
|
// no-break space must not receive justifyExtra, or the line over-stretches by one
|
||||||
|
// gap and the last word is pushed past the right margin (issue #2185).
|
||||||
|
if (wordIdx > 0 && reorderedWordsScratch[wordIdx] == " " && reorderedContinuesScratch[wordIdx] &&
|
||||||
effectiveAlignment == CssTextAlign::Justify && !isLastLine) {
|
effectiveAlignment == CssTextAlign::Justify && !isLastLine) {
|
||||||
advance += reorderedJustifyExtra;
|
advance += reorderedJustifyExtra;
|
||||||
}
|
}
|
||||||
@@ -1048,7 +1051,8 @@ void ParsedText::extractLine(const size_t breakIndex, const int pageWidth, const
|
|||||||
// Cross-boundary kerning for continuation words
|
// Cross-boundary kerning for continuation words
|
||||||
int advance = renderer.getKerning(fontId, lastCodepoint(lineWords[wordIdx]),
|
int advance = renderer.getKerning(fontId, lastCodepoint(lineWords[wordIdx]),
|
||||||
firstCodepoint(lineWords[wordIdx + 1]), lineWordStyles[wordIdx]);
|
firstCodepoint(lineWords[wordIdx + 1]), lineWordStyles[wordIdx]);
|
||||||
if (lineWords[wordIdx] == " " && continuesVec[lastBreakAt + wordIdx] &&
|
// wordIdx > 0: see the LTR branch — a leading no-break space is not a justifiable gap.
|
||||||
|
if (wordIdx > 0 && lineWords[wordIdx] == " " && continuesVec[lastBreakAt + wordIdx] &&
|
||||||
effectiveAlignment == CssTextAlign::Justify && !isLastLine) {
|
effectiveAlignment == CssTextAlign::Justify && !isLastLine) {
|
||||||
advance += justifyExtra;
|
advance += justifyExtra;
|
||||||
}
|
}
|
||||||
@@ -1086,7 +1090,10 @@ void ParsedText::extractLine(const size_t breakIndex, const int pageWidth, const
|
|||||||
int advance = wordWidths[lastBreakAt + wordIdx];
|
int advance = wordWidths[lastBreakAt + wordIdx];
|
||||||
advance += renderer.getKerning(fontId, lastCodepoint(lineWords[wordIdx]),
|
advance += renderer.getKerning(fontId, lastCodepoint(lineWords[wordIdx]),
|
||||||
firstCodepoint(lineWords[wordIdx + 1]), lineWordStyles[wordIdx]);
|
firstCodepoint(lineWords[wordIdx + 1]), lineWordStyles[wordIdx]);
|
||||||
if (lineWords[wordIdx] == " " && continuesVec[lastBreakAt + wordIdx] &&
|
// wordIdx > 0 mirrors the gap accounting above (which skips index 0): a leading
|
||||||
|
// no-break space must not receive justifyExtra, or the line over-stretches by one
|
||||||
|
// gap and the last word is pushed past the right margin (issue #2185).
|
||||||
|
if (wordIdx > 0 && lineWords[wordIdx] == " " && continuesVec[lastBreakAt + wordIdx] &&
|
||||||
effectiveAlignment == CssTextAlign::Justify && !isLastLine) {
|
effectiveAlignment == CssTextAlign::Justify && !isLastLine) {
|
||||||
advance += justifyExtra;
|
advance += justifyExtra;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user