From 592614ea3ecd90ede2ae1b8e6579d1b898f474ec Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 21 Oct 2016 10:13:20 +0200 Subject: Don't claim all fonts are smoothly scalable on Windows Since 40ebda3efbcf00c3393cb70c9eee203c68a57311, bitmap fonts are detected as smoothly scalable on Windows. While the fontsAlwaysScalable() does say whether or not the font engine can rasterize the fonts at any size, it does not determine whether or not the result is "attractive" as the documentation for isSmoothlyScalable() says. Only outline fonts are smoothly scalable, and this fact is used in Qt Quick to determine whether we can use the distance field renderer for the font or if we have to fall back to the native renderer. The consequence was that the fonts were no longer usable in Qt Quick. We also need to revert the optimization for isBitmapScalable() since there a font that is smoothly scalable should not be identified as bitmap scalable (basically this means: Font is not smoothly scalable, but it can be scaled with bitmap scaling artifacts). [ChangeLog][QtGui][Text] Fixed a regression where raster fonts on Windows were detected as smoothly scalable and thus rendering with said fonts in Qt Quick would break. Task-number: QTBUG-56659 Change-Id: Ia7db6fee8249aca347233a488388be5c3a00c2df Reviewed-by: Lars Knoll --- src/gui/text/qfontdatabase.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src/gui/text/qfontdatabase.cpp') diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index f063541249..04081a5ca7 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -1657,9 +1657,6 @@ bool QFontDatabase::isFixedPitch(const QString &family, bool QFontDatabase::isBitmapScalable(const QString &family, const QString &style) const { - if (QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable()) - return true; - bool bitmapScalable = false; QString familyName, foundryName; parseFontName(family, foundryName, familyName); @@ -1700,9 +1697,6 @@ bool QFontDatabase::isBitmapScalable(const QString &family, */ bool QFontDatabase::isSmoothlyScalable(const QString &family, const QString &style) const { - if (QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable()) - return true; - bool smoothScalable = false; QString familyName, foundryName; parseFontName(family, foundryName, familyName); -- cgit v1.2.3 From aa2e2a8d5e4712d93879098675c0a46df0fd7a41 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 25 Oct 2016 11:56:33 +0200 Subject: Android: Fix synthesized oblique for non-latin scripts In 5e3e34731b7880ac775e8f1fa156ce016e6820f1, a default implementation of QPlatformFontDatabase::fallbacksForFamily() was added, but this implementation included only the fonts with a matching style in the returned list. The result of this was that if a font face for a specific language did not have e.g. an italic font, then we would show missing glyph boxes instead. On Android, it would be impossible to show any italic text in Chinese, Japanese, Hebrew, or Arabic. [ChangeLog][QtGui][Text] Fixed synthesized oblique for non-latin text on platforms using the basic font database, such as Android. Task-number: QTBUG-51223 Change-Id: I494d8ad87292b65d4380a2e600c1c0dc7fc8f937 Reviewed-by: Lars Knoll Reviewed-by: Konstantin Ritt --- src/gui/text/qfontdatabase.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/gui/text/qfontdatabase.cpp') diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 04081a5ca7..f1b2e84a1e 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -805,7 +805,8 @@ QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFo Q_UNUSED(family); Q_UNUSED(styleHint); - QStringList retList; + QStringList preferredFallbacks; + QStringList otherFallbacks; size_t writingSystem = std::find(scriptForWritingSystem, scriptForWritingSystem + QFontDatabase::WritingSystemsCount, @@ -826,18 +827,18 @@ QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFo QtFontFoundry *foundry = f->foundries[j]; for (int k = 0; k < foundry->count; ++k) { - if (style == foundry->styles[k]->key.style) { - if (foundry->name.isEmpty()) - retList.append(f->name); - else - retList.append(f->name + QLatin1String(" [") + foundry->name + QLatin1Char(']')); - break; - } + QString name = foundry->name.isEmpty() + ? f->name + : f->name + QLatin1String(" [") + foundry->name + QLatin1Char(']'); + if (style == foundry->styles[k]->key.style) + preferredFallbacks.append(name); + else + otherFallbacks.append(name); } } } - return retList; + return preferredFallbacks + otherFallbacks; } static void initializeDb(); -- cgit v1.2.3