From 4c56466f431b237f636f66c263d21d3bc9152260 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 23 May 2016 15:39:19 +0200 Subject: [PATCH] Add line feed and carriage return to blacklisted characters In order to avoid loading and checking all fonts on the system when the string contains a line separator, we blacklisted it in 98a23b974509bd1b6d9459e6c79677bdcbaa0108 in Qt 4. The same logic applies for paragraph separators, line feeds and carriage returns. Task-number: QTBUG-51934 Change-Id: I121dce17a8ac79b5b790e24c6596438e501e871a Reviewed-by: Konstantin Ritt --- src/gui/text/qfontengine.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 74317e99c3..16c654dcb7 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1846,7 +1846,11 @@ QFontEngine *QFontEngineMulti::loadEngine(int at) glyph_t QFontEngineMulti::glyphIndex(uint ucs4) const { glyph_t glyph = engine(0)->glyphIndex(ucs4); - if (glyph == 0 && ucs4 != QChar::LineSeparator) { + if (glyph == 0 + && ucs4 != QChar::LineSeparator + && ucs4 != QChar::LineFeed + && ucs4 != QChar::CarriageReturn + && ucs4 != QChar::ParagraphSeparator) { if (!m_fallbackFamiliesQueried) const_cast(this)->ensureFallbackFamiliesQueried(); for (int x = 1, n = qMin(m_engines.size(), 256); x < n; ++x) { @@ -1884,7 +1888,11 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len, QStringIterator it(str, str + len); while (it.hasNext()) { const uint ucs4 = it.peekNext(); - if (glyphs->glyphs[glyph_pos] == 0 && ucs4 != QChar::LineSeparator) { + if (glyphs->glyphs[glyph_pos] == 0 + && ucs4 != QChar::LineSeparator + && ucs4 != QChar::LineFeed + && ucs4 != QChar::CarriageReturn + && ucs4 != QChar::ParagraphSeparator) { if (!m_fallbackFamiliesQueried) const_cast(this)->ensureFallbackFamiliesQueried(); for (int x = 1, n = qMin(m_engines.size(), 256); x < n; ++x) {