diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2014-02-23 03:28:56 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-25 16:10:33 +0100 |
commit | 6a7747f30cc853f07501770a8704fee215eea322 (patch) | |
tree | 0656f2077d1add46f6c7b729b72c9e067e11e243 /src | |
parent | bb7bf6ca17061d835cf7980179ae0a607830048d (diff) |
HarfBuzz-NG: Hide characters that should normally be invisible
These are non-ambigue NLF characters that should only imply the
sctructure of the document.
For details, see http://www.unicode.org/reports/tr13/ .
The issue could be reproduced with use of multi-line QML Text element.
Change-Id: Ibb4d5cd26bc0ac6b79a4cb549e6a3cd7633bd071
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/text/qtextengine.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index eb31c520ed..63e2af8d15 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1133,6 +1133,21 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *st uint cluster = infos[i].cluster; if (last_cluster != cluster) { + if (Q_UNLIKELY(g.glyphs[i] == 0)) { + // hide characters that should normally be invisible + switch (string[item_pos + str_pos]) { + case QChar::LineFeed: + case 0x000c: // FormFeed + case QChar::CarriageReturn: + case QChar::LineSeparator: + case QChar::ParagraphSeparator: + g.attributes[i].dontPrint = true; + break; + default: + break; + } + } + // fix up clusters so that the cluster indices will be monotonic // and thus we never return out-of-order indices while (last_cluster++ < cluster && str_pos < item_length) |