1
0
forked from pool/libqt5-qtbase
libqt5-qtbase/0003-Support-autohint-and-lcdfilter-fontconfig-configurat.patch
Stephan Kulow e4c21e8f38 Accepting request 255354 from KDE:Qt5
- 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
2014-10-14 11:24:52 +00:00

94 lines
3.7 KiB
Diff

From e5d61b2531ce2000e7e230d4cfdb793fa2b686e8 Mon Sep 17 00:00:00 2001
From: Allan Sandfeld Jensen <allan.jensen@digia.com>
Date: Mon, 11 Aug 2014 14:03:35 +0200
Subject: [PATCH 3/4] Support autohint and lcdfilter fontconfig configuration
This patch adds support for reading autohint and lcdfilter settings
from fontconfig and pass them on to freetype.
Task-number: QTBUG-32254
Change-Id: Iaa69b70f7005ee7f21126a8d984c07b3a46a3e7f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
(cherry picked from commit b35176f43a953d56380414f05834c7918762cb83)
---
src/gui/text/qfontengine_ft.cpp | 4 ++++
src/gui/text/qfontengine_ft_p.h | 1 +
.../fontdatabases/fontconfig/qfontconfigdatabase.cpp | 20 ++++++++++++++++++++
3 files changed, 25 insertions(+)
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index ad4276b..eef316b 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -678,6 +678,7 @@ QFontEngineFT::QFontEngineFT(const QFontDef &fd)
const QByteArray env = qgetenv("QT_NO_FT_CACHE");
cacheEnabled = env.isEmpty() || env.toInt() == 0;
m_subPixelPositionCount = 4;
+ forceAutoHint = false;
}
QFontEngineFT::~QFontEngineFT()
@@ -832,6 +833,9 @@ int QFontEngineFT::loadFlags(QGlyphSet *set, GlyphFormat format, int flags,
else
load_flags |= load_target;
+ if (forceAutoHint)
+ load_flags |= FT_LOAD_FORCE_AUTOHINT;
+
return load_flags;
}
diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h
index ba603b9..09c70c5 100644
--- a/src/gui/text/qfontengine_ft_p.h
+++ b/src/gui/text/qfontengine_ft_p.h
@@ -307,6 +307,7 @@ protected:
int lcdFilterType;
bool embeddedbitmap;
bool cacheEnabled;
+ bool forceAutoHint;
private:
friend class QFontEngineFTRawFont;
diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
index d95bcb9..0bf119c 100644
--- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
+++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
@@ -625,6 +625,16 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, void *usrPtr)
if (match) {
engine->setDefaultHintStyle(defaultHintStyleFromMatch((QFont::HintingPreference)f.hintingPreference, match));
+ FcBool fc_autohint;
+ if (FcPatternGetBool(match, FC_AUTOHINT,0, &fc_autohint) == FcResultMatch)
+ engine->forceAutoHint = fc_autohint;
+
+#if defined(FT_LCD_FILTER_H)
+ int lcdFilter;
+ if (FcPatternGetInteger(match, FC_LCD_FILTER, 0, &lcdFilter) == FcResultMatch)
+ engine->lcdFilterType = lcdFilter;
+#endif
+
if (antialias) {
// If antialiasing is not fully disabled, fontconfig may still disable it on a font match basis.
FcBool fc_antialias;
@@ -686,6 +696,16 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QByteArray &fontData, qreal p
if (match) {
engine->setDefaultHintStyle(defaultHintStyleFromMatch(hintingPreference, match));
+ FcBool fc_autohint;
+ if (FcPatternGetBool(match, FC_AUTOHINT,0, &fc_autohint) == FcResultMatch)
+ engine->forceAutoHint = fc_autohint;
+
+#if defined(FT_LCD_FILTER_H)
+ int lcdFilter;
+ if (FcPatternGetInteger(match, FC_LCD_FILTER, 0, &lcdFilter) == FcResultMatch)
+ engine->lcdFilterType = lcdFilter;
+#endif
+
FcBool fc_antialias;
if (FcPatternGetBool(match, FC_ANTIALIAS,0, &fc_antialias) != FcResultMatch)
fc_antialias = true;
--
2.1.1