summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2015-03-24 12:43:27 +0400
committerKonstantin Ritt <ritt.ks@gmail.com>2015-03-26 20:00:45 +0000
commitcd1cdd1516c7904902e08a26605f9e62032489fe (patch)
tree834f07f7ce7251e37d0c72c11538ae3ce4c70930 /src
parentcfe3ac9c653dc25ad4654387a7547dc93eb2e482 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qtextengine.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 0841afe1b8..873f6b37d9 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -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;
}