summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2014-02-23 03:28:56 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-25 16:10:33 +0100
commit6a7747f30cc853f07501770a8704fee215eea322 (patch)
tree0656f2077d1add46f6c7b729b72c9e067e11e243
parentbb7bf6ca17061d835cf7980179ae0a607830048d (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>
-rw-r--r--src/gui/text/qtextengine.cpp15
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)