From dd17456a8a69501428f3fdd2d2e25bb4286899da Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 20 Jan 2020 13:00:56 +0100 Subject: [PATCH] Deprecate QFont::ForceIntegerMetrics and QFont::OpenGLCompatible The ForceIntegerMetrics flag was added in Qt 4.7 specifically because of WebKit, which was rounding text metrics and getting mismatches with the underlying font engine whenever it supported fractional advances. For backwards compatibility with how the CoreText engine worked before this, we added a flag to allow rounding all metrics. Rounding advances gives very broken rendering and is hopefully not used by anyone anymore, so lets remove this flag in Qt 6. As for OpenGLCompatible, this flag is not used anywhere. I am not exactly sure what this flag did, but all fonts are "OpenGL-compatible" at this point. [ChangeLog][QtGui][QFont] Deprecated QFont::ForceIntegerMetrics and QFont::OpenGLCompatible, with the intention of removing them in Qt 6.0.0. Change-Id: I0a492c153348023f00d561bab8ab4b5104c6c7c4 Reviewed-by: Lars Knoll --- src/gui/text/qfont.cpp | 8 ++++---- src/gui/text/qfont.h | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 9ede90d8de..2e7d898a70 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -1353,8 +1353,8 @@ QFont::StyleHint QFont::styleHint() const \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. + \value OpenGLCompatible This style strategy has been deprecated. All fonts are + OpenGL-compatible by default. \value NoFontMerging If the font selected for a certain writing system does not contain a character requested to draw, then Qt automatically chooses a similar looking font that contains the character. The NoFontMerging flag disables this feature. @@ -1373,8 +1373,8 @@ QFont::StyleHint QFont::styleHint() const \value PreferQuality prefer the best quality font. The font matcher will use the nearest standard point size that the font supports. - \value ForceIntegerMetrics forces the use of integer values in font engines that support fractional - font metrics. + \value ForceIntegerMetrics This style strategy has been deprecated. Use \l QFontMetrics to + retrieve rounded font metrics. */ /*! diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h index 683aa3bf65..e5734679ed 100644 --- a/src/gui/text/qfont.h +++ b/src/gui/text/qfont.h @@ -80,8 +80,10 @@ public: PreferQuality = 0x0040, PreferAntialias = 0x0080, NoAntialias = 0x0100, - OpenGLCompatible = 0x0200, - ForceIntegerMetrics = 0x0400, +#if QT_DEPRECATED_SINCE(5, 15) + OpenGLCompatible Q_DECL_ENUMERATOR_DEPRECATED = 0x0200, + ForceIntegerMetrics Q_DECL_ENUMERATOR_DEPRECATED = 0x0400, +#endif NoSubpixelAntialias = 0x0800, PreferNoShaping = 0x1000, NoFontMerging = 0x8000