From 6a7747f30cc853f07501770a8704fee215eea322 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Sun, 23 Feb 2014 03:28:56 +0200 Subject: 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 --- src/gui/text/qtextengine.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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) -- cgit v1.2.3