Fix soft-hyphen appearance at line-break
Replace it with '-' and set dontPrint to true; later we unset the dontPrint flag if soft-hyphen appears at the end of a line after line breaking. Task-number: QTBUG-44234 Change-Id: I05b69bcbbe07e1ee8a5d35d24372356ce8ab9db8 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
This commit is contained in:
parent
cfe3ac9c65
commit
cd1cdd1516
@ -1219,6 +1219,19 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *st
|
||||
case QChar::ParagraphSeparator:
|
||||
g.attributes[i].dontPrint = true;
|
||||
break;
|
||||
case QChar::SoftHyphen:
|
||||
if (!actualFontEngine->symbol) {
|
||||
// U+00AD [SOFT HYPHEN] is a default ignorable codepoint,
|
||||
// so we replace its glyph and metrics with ones for
|
||||
// U+002D [HYPHEN-MINUS] and make it visible if it appears at line-break
|
||||
g.glyphs[i] = actualFontEngine->glyphIndex('-');
|
||||
if (Q_LIKELY(g.glyphs[i] != 0)) {
|
||||
QGlyphLayout tmp = g.mid(i, 1);
|
||||
actualFontEngine->recalcAdvances(&tmp, 0);
|
||||
}
|
||||
g.attributes[i].dontPrint = true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user