forked from pool/libqt5-qtbase
e4c21e8f38
- Added 0001-QFileDialog-emit-urlsSelected-urlSelected-in-accept.patch, 0002-QUrl-fromLocalFile-QString-should-lead-to-an-empty-U.patch, 0003-QFileDialog-turn-workingDirectory-into-a-QUrl.patch and 0004-QFileDialog-implement-getOpenFileUrl-and-friends-for.patch from upstream to improve QFileDialog behaviour with both local and remote URL's - Added 0001-QKdeTheme-use-system-wide-kdeglobals-as-a-fallback.patch: QTBUG-36184 - Added 0001-Add-QFont-strategy-to-disable-subpixel-antialiasing.patch, 0002-Move-SubpixelAntialiasingType-from-QFontEngineFT-to-.patch, 0003-Support-autohint-and-lcdfilter-fontconfig-configurat.patch and 0004-GTK2-theme-should-use-GTK-configured-font-variant.patch QTBUG-40396, QTBUG-32254, QTBUG-39643 OBS-URL: https://build.opensuse.org/request/show/255354 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtbase?expand=0&rev=30
111 lines
5.1 KiB
Diff
111 lines
5.1 KiB
Diff
From 820b20e593b7b0d92e6a78e7b23457f321aa0bc1 Mon Sep 17 00:00:00 2001
|
|
From: Allan Sandfeld Jensen <allan.jensen@digia.com>
|
|
Date: Thu, 24 Jul 2014 14:33:00 +0200
|
|
Subject: [PATCH 1/4] Add QFont strategy to disable subpixel antialiasing
|
|
|
|
This patch adds the option to disable subpixel antialiasing on QFont
|
|
basis. This can be useful when painting to offscreen surfaces. On OS X
|
|
this option disables the aggressive LCD font smoothing, which can be
|
|
necessary for certain fonts it may otherwise ruin.
|
|
|
|
Task-number: QTBUG-40396
|
|
Change-Id: I1664b636520ae63ee1503b5df7436748106b9f5c
|
|
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
|
|
(cherry picked from commit 7ff4621100b3df7ba9b336ac60204da4b548e642)
|
|
---
|
|
src/gui/text/qfont.cpp | 1 +
|
|
src/gui/text/qfont.h | 1 +
|
|
.../fontdatabases/fontconfig/qfontconfigdatabase.cpp | 4 +++-
|
|
src/plugins/platforms/cocoa/qpaintengine_mac.mm | 7 +++++++
|
|
src/plugins/platforms/windows/qwindowsfontdatabase.cpp | 4 +++-
|
|
5 files changed, 15 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
|
|
index cf40dd0..82676d7 100644
|
|
--- a/src/gui/text/qfont.cpp
|
|
+++ b/src/gui/text/qfont.cpp
|
|
@@ -1376,6 +1376,7 @@ QFont::StyleHint QFont::styleHint() const
|
|
\value PreferOutline prefers outline fonts (as opposed to bitmap fonts).
|
|
\value ForceOutline forces the use of outline fonts.
|
|
\value NoAntialias don't antialias the fonts.
|
|
+ \value NoSubpixelAntialias avoid subpixel antialiasing on the fonts if possible.
|
|
\value PreferAntialias antialias if possible.
|
|
\value OpenGLCompatible forces the use of OpenGL compatible
|
|
fonts.
|
|
diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h
|
|
index 7fbaf24..f48f4cf 100644
|
|
--- a/src/gui/text/qfont.h
|
|
+++ b/src/gui/text/qfont.h
|
|
@@ -83,6 +83,7 @@ public:
|
|
NoAntialias = 0x0100,
|
|
OpenGLCompatible = 0x0200,
|
|
ForceIntegerMetrics = 0x0400,
|
|
+ NoSubpixelAntialias = 0x0800,
|
|
NoFontMerging = 0x8000
|
|
};
|
|
|
|
diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
|
|
index b8da972..e10e10b 100644
|
|
--- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
|
|
+++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
|
|
@@ -634,7 +634,9 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, void *usrPtr)
|
|
}
|
|
|
|
if (antialias) {
|
|
- QFontEngineFT::SubpixelAntialiasingType subpixelType = subpixelTypeFromMatch(match);
|
|
+ QFontEngineFT::SubpixelAntialiasingType subpixelType = QFontEngineFT::Subpixel_None;
|
|
+ if (!(f.styleStrategy & QFont::NoSubpixelAntialias))
|
|
+ subpixelType = subpixelTypeFromMatch(match);
|
|
engine->subpixelType = subpixelType;
|
|
|
|
format = (subpixelType == QFontEngineFT::Subpixel_None)
|
|
diff --git a/src/plugins/platforms/cocoa/qpaintengine_mac.mm b/src/plugins/platforms/cocoa/qpaintengine_mac.mm
|
|
index f4cd071..d48cbdf 100644
|
|
--- a/src/plugins/platforms/cocoa/qpaintengine_mac.mm
|
|
+++ b/src/plugins/platforms/cocoa/qpaintengine_mac.mm
|
|
@@ -1084,6 +1084,10 @@ void QCoreGraphicsPaintEngine::drawTextItem(const QPointF &pos, const QTextItem
|
|
if (textAA != lineAA)
|
|
CGContextSetShouldAntialias(d->hd, textAA);
|
|
|
|
+ const bool smoothing = textAA && !(fe->fontDef.styleStrategy & QFont::NoSubpixelAntialias);
|
|
+ if (d->disabledSmoothFonts == smoothing)
|
|
+ CGContextSetShouldSmoothFonts(d->hd, smoothing);
|
|
+
|
|
if (ti.glyphs.numGlyphs) {
|
|
switch (fe->type()) {
|
|
case QFontEngine::Mac:
|
|
@@ -1100,6 +1104,9 @@ void QCoreGraphicsPaintEngine::drawTextItem(const QPointF &pos, const QTextItem
|
|
if (textAA != lineAA)
|
|
CGContextSetShouldAntialias(d->hd, !textAA);
|
|
|
|
+ if (smoothing == d->disabledSmoothFonts)
|
|
+ CGContextSetShouldSmoothFonts(d->hd, !d->disabledSmoothFonts);
|
|
+
|
|
updatePen(oldPen);
|
|
updateBrush(oldBrush, oldBrushOrigin);
|
|
}
|
|
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
|
|
index f30dcba..27262ec 100644
|
|
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
|
|
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
|
|
@@ -1521,13 +1521,15 @@ LOGFONT QWindowsFontDatabase::fontDefToLOGFONT(const QFontDef &request)
|
|
#endif
|
|
|
|
if (request.styleStrategy & QFont::PreferAntialias) {
|
|
- if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP) {
|
|
+ if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && !(request.styleStrategy & QFont::NoSubpixelAntialias)) {
|
|
qual = CLEARTYPE_QUALITY;
|
|
} else {
|
|
qual = ANTIALIASED_QUALITY;
|
|
}
|
|
} else if (request.styleStrategy & QFont::NoAntialias) {
|
|
qual = NONANTIALIASED_QUALITY;
|
|
+ } else if ((request.styleStrategy & QFont::NoSubpixelAntialias) && sharedFontData()->clearTypeEnabled) {
|
|
+ qual = ANTIALIASED_QUALITY;
|
|
}
|
|
|
|
lf.lfQuality = qual;
|
|
--
|
|
2.1.1
|
|
|