From 3a84d92f5736da3dc3f6a385bf3723984a5640ed Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 18 Feb 2014 14:03:05 +0100 Subject: [PATCH 1/2] Make unicode ranges in font take precedence over codepage Change 4b2c73b4767bcb512cbc17f65186eac5d004db07 triggered a regression on Android, because the DroidSansFallback.ttf font has codepage ranges that list Arabic as a supported codepage despite the fact that the font has no glyphs for Arabic. If a font has valid unicode ranges which does not specify support for e.g. Arabic, then the code page ranges for the same script should be ignored. [ChangeLog][Android][Fonts] Fixed support for Arabic text. Task-number: QTBUG-36789 Change-Id: I7c5a0e303fd9ed2733275814fe752ae0fb54a207 Reviewed-by: Konstantin Ritt --- src/gui/text/qplatformfontdatabase.cpp | 104 +++++++++++++------------ 1 file changed, 53 insertions(+), 51 deletions(-) diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp index 37610a9099..a25c814d4a 100644 --- a/src/gui/text/qplatformfontdatabase.cpp +++ b/src/gui/text/qplatformfontdatabase.cpp @@ -502,58 +502,60 @@ QSupportedWritingSystems QPlatformFontDatabase::writingSystemsFromTrueTypeBits(q } } } - if (codePageRange[0] & ((1 << Latin1CsbBit) | (1 << CentralEuropeCsbBit) | (1 << TurkishCsbBit) | (1 << BalticCsbBit))) { - writingSystems.setSupported(QFontDatabase::Latin); - hasScript = true; - //qDebug("font %s supports Latin", familyName.latin1()); + if (!hasScript) { + if (codePageRange[0] & ((1 << Latin1CsbBit) | (1 << CentralEuropeCsbBit) | (1 << TurkishCsbBit) | (1 << BalticCsbBit))) { + writingSystems.setSupported(QFontDatabase::Latin); + hasScript = true; + //qDebug("font %s supports Latin", familyName.latin1()); + } + if (codePageRange[0] & (1 << CyrillicCsbBit)) { + writingSystems.setSupported(QFontDatabase::Cyrillic); + hasScript = true; + //qDebug("font %s supports Cyrillic", familyName.latin1()); + } + if (codePageRange[0] & (1 << GreekCsbBit)) { + writingSystems.setSupported(QFontDatabase::Greek); + hasScript = true; + //qDebug("font %s supports Greek", familyName.latin1()); + } + if (codePageRange[0] & (1 << HebrewCsbBit)) { + writingSystems.setSupported(QFontDatabase::Hebrew); + hasScript = true; + //qDebug("font %s supports Hebrew", familyName.latin1()); + } + if (codePageRange[0] & (1 << ArabicCsbBit)) { + writingSystems.setSupported(QFontDatabase::Arabic); + hasScript = true; + //qDebug("font %s supports Arabic", familyName.latin1()); + } + if (codePageRange[0] & (1 << VietnameseCsbBit)) { + writingSystems.setSupported(QFontDatabase::Vietnamese); + hasScript = true; + //qDebug("font %s supports Vietnamese", familyName.latin1()); + } + if (codePageRange[0] & (1 << SimplifiedChineseCsbBit)) { + writingSystems.setSupported(QFontDatabase::SimplifiedChinese); + hasScript = true; + //qDebug("font %s supports Simplified Chinese", familyName.latin1()); + } + if (codePageRange[0] & (1 << TraditionalChineseCsbBit)) { + writingSystems.setSupported(QFontDatabase::TraditionalChinese); + hasScript = true; + //qDebug("font %s supports Traditional Chinese", familyName.latin1()); + } + if (codePageRange[0] & (1 << JapaneseCsbBit)) { + writingSystems.setSupported(QFontDatabase::Japanese); + hasScript = true; + //qDebug("font %s supports Japanese", familyName.latin1()); + } + if (codePageRange[0] & ((1 << KoreanCsbBit) | (1 << KoreanJohabCsbBit))) { + writingSystems.setSupported(QFontDatabase::Korean); + hasScript = true; + //qDebug("font %s supports Korean", familyName.latin1()); + } + if (!hasScript) + writingSystems.setSupported(QFontDatabase::Symbol); } - if (codePageRange[0] & (1 << CyrillicCsbBit)) { - writingSystems.setSupported(QFontDatabase::Cyrillic); - hasScript = true; - //qDebug("font %s supports Cyrillic", familyName.latin1()); - } - if (codePageRange[0] & (1 << GreekCsbBit)) { - writingSystems.setSupported(QFontDatabase::Greek); - hasScript = true; - //qDebug("font %s supports Greek", familyName.latin1()); - } - if (codePageRange[0] & (1 << HebrewCsbBit)) { - writingSystems.setSupported(QFontDatabase::Hebrew); - hasScript = true; - //qDebug("font %s supports Hebrew", familyName.latin1()); - } - if (codePageRange[0] & (1 << ArabicCsbBit)) { - writingSystems.setSupported(QFontDatabase::Arabic); - hasScript = true; - //qDebug("font %s supports Arabic", familyName.latin1()); - } - if (codePageRange[0] & (1 << VietnameseCsbBit)) { - writingSystems.setSupported(QFontDatabase::Vietnamese); - hasScript = true; - //qDebug("font %s supports Vietnamese", familyName.latin1()); - } - if (codePageRange[0] & (1 << SimplifiedChineseCsbBit)) { - writingSystems.setSupported(QFontDatabase::SimplifiedChinese); - hasScript = true; - //qDebug("font %s supports Simplified Chinese", familyName.latin1()); - } - if (codePageRange[0] & (1 << TraditionalChineseCsbBit)) { - writingSystems.setSupported(QFontDatabase::TraditionalChinese); - hasScript = true; - //qDebug("font %s supports Traditional Chinese", familyName.latin1()); - } - if (codePageRange[0] & (1 << JapaneseCsbBit)) { - writingSystems.setSupported(QFontDatabase::Japanese); - hasScript = true; - //qDebug("font %s supports Japanese", familyName.latin1()); - } - if (codePageRange[0] & ((1 << KoreanCsbBit) | (1 << KoreanJohabCsbBit))) { - writingSystems.setSupported(QFontDatabase::Korean); - hasScript = true; - //qDebug("font %s supports Korean", familyName.latin1()); - } - if (!hasScript) - writingSystems.setSupported(QFontDatabase::Symbol); return writingSystems; } From 08cbbde61778276ccdda73d89fd64d02c623779f Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 3 Jan 2014 16:08:38 +0100 Subject: [PATCH 2/2] QtConcurrent: Extend workaround GCC bug 58800 in median calculation GNU/Linux distributions like Fedora update the __GLIBCXX__ date (e.g. because of applied extra patches on top) and thus make the current workaround useless. As long as no official gcc/libstdc++ version is released, we can increment the "upper bound" date to cover such cases. See also comment #1 at QTCREATORBUG-11129. Change-Id: I1fdf6f312664163f6a99a8eddf490646ff25a87d Reviewed-by: Olivier Goffart Reviewed-by: Marc Mutz --- src/concurrent/qtconcurrentmedian.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/concurrent/qtconcurrentmedian.h b/src/concurrent/qtconcurrentmedian.h index ce2afb9c28..5dd43a015e 100644 --- a/src/concurrent/qtconcurrentmedian.h +++ b/src/concurrent/qtconcurrentmedian.h @@ -104,8 +104,10 @@ public: dirty = false; // This is a workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58800 -// Avoid using std::nth_element for stdlibc++ <= 4.7.3 || (>= 4.8.0 && <= 4.8.2) -#if defined(__GLIBCXX__) && (__GLIBCXX__ <= 20130411 || (__GLIBCXX__ >= 20130322 && __GLIBCXX__ <= 20131016)) +// Avoid using std::nth_element for the affected stdlibc++ releases 4.7.3 and 4.8.2. +// Note that the official __GLIBCXX__ value of the releases is not used since that +// one might be patched on some GNU/Linux distributions. +#if defined(__GLIBCXX__) && __GLIBCXX__ <= 20140107 QVector sorted = values; std::sort(sorted.begin(), sorted.end()); currentMedian = sorted.at(bufferSize / 2);