summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-11-25 15:59:04 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-11-29 12:03:18 +0000
commitd4e3442fdbb98b5c635448031ff9958819a46bc5 (patch)
treee4e66db8e8d155ec011f5c9859d1c4b70279aab0 /src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
parent1f998e040eb7202691f4a4eb5fb77499247b2aab (diff)
CoreText: Modernize font smoothing and antialiasing threshold detection
The way macOS does font smoothing has changed in Mojave, and we need to take both this new algorithm into account, as well as support users who set legacy preferences to revert back to subpixel font smoothing. As a followup to this patch we will tweak some of the existing logic to take the new font smoothing algorithm into account, so this is just a first step. Change-Id: If37014c18515f406b8bb8194c9df7a75c2eb10fc Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h')
-rw-r--r--src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
index 7ed2faff8e..2ce46a4706 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
@@ -53,6 +53,7 @@
#include <private/qfontengine_p.h>
#include <private/qcore_mac_p.h>
+#include <QtCore/qloggingcategory.h>
#ifdef Q_OS_OSX
#include <ApplicationServices/ApplicationServices.h>
@@ -63,8 +64,12 @@
QT_BEGIN_NAMESPACE
+Q_DECLARE_LOGGING_CATEGORY(lcQpaFonts)
+
class QCoreTextFontEngine : public QFontEngine
{
+ Q_GADGET
+
public:
QCoreTextFontEngine(CTFontRef font, const QFontDef &def);
QCoreTextFontEngine(CGFontRef font, const QFontDef &def);
@@ -118,13 +123,17 @@ public:
QFontEngine::Properties properties() const override;
+ enum FontSmoothing { Disabled, Subpixel, Grayscale };
+ Q_ENUM(FontSmoothing);
+
+ static FontSmoothing fontSmoothing();
+ static int antialiasingThreshold();
+
static bool ct_getSfntTable(void *user_data, uint tag, uchar *buffer, uint *length);
static QFont::Weight qtWeightFromCFWeight(float value);
- static int antialiasingThreshold;
- static QFontEngine::GlyphFormat defaultGlyphFormat;
-
static QCoreTextFontEngine *create(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference);
+
protected:
QCoreTextFontEngine(const QFontDef &def);
void init();