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>
This commit is contained in:
Konstantin Ritt 2014-02-23 03:28:56 +02:00 committed by The Qt Project
parent bb7bf6ca17
commit 6a7747f30c

View File

@ -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)