summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/global/qnamespace.h4
-rw-r--r--src/corelib/global/qnamespace.qdoc1
-rw-r--r--src/gui/text/coretext/qfontengine_coretext.mm62
-rw-r--r--src/gui/text/freetype/qfontengine_ft.cpp18
-rw-r--r--src/gui/text/qfont.cpp4
-rw-r--r--src/gui/text/qfont.h4
-rw-r--r--src/gui/text/qfontengine.cpp10
-rw-r--r--src/gui/text/qfontengine_p.h2
-rw-r--r--src/gui/text/qtextengine.cpp5
-rw-r--r--src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp49
-rw-r--r--tests/auto/gui/text/qfont/tst_qfont.cpp2
-rw-r--r--tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp17
12 files changed, 26 insertions, 152 deletions
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index b367df0f11..9ac9d7ab34 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -235,10 +235,6 @@ namespace Qt {
// Ensures that the longest variant is always used when computing the
// size of a multi-variant string.
TextLongestVariant = 0x80000
-
-#if QT_DEPRECATED_SINCE(5, 11) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
- , TextBypassShaping = 0x100000
-#endif
};
enum TextElideMode {
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 50971798e4..d6eabaec0c 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -597,7 +597,6 @@
\value TextJustificationForced Ensures that text lines are justified.
\omitvalue TextLongestVariant
- \omitvalue TextBypassShaping
\omitvalue TextForceLeftToRight
\omitvalue TextForceRightToLeft
diff --git a/src/gui/text/coretext/qfontengine_coretext.mm b/src/gui/text/coretext/qfontengine_coretext.mm
index 57fbf6032e..68de945351 100644
--- a/src/gui/text/coretext/qfontengine_coretext.mm
+++ b/src/gui/text/coretext/qfontengine_coretext.mm
@@ -341,16 +341,9 @@ bool QCoreTextFontEngine::stringToCMap(const QChar *str, int len, QGlyphLayout *
glyph_metrics_t QCoreTextFontEngine::boundingBox(const QGlyphLayout &glyphs)
{
QFixed w;
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- bool round = fontDef.styleStrategy & QFont::ForceIntegerMetrics;
-QT_WARNING_POP
-
- for (int i = 0; i < glyphs.numGlyphs; ++i) {
- w += round ? glyphs.effectiveAdvance(i).round()
- : glyphs.effectiveAdvance(i);
- }
- return glyph_metrics_t(0, -(ascent()), w - lastRightBearing(glyphs, round), ascent()+descent(), w, 0);
+ for (int i = 0; i < glyphs.numGlyphs; ++i)
+ w += glyphs.effectiveAdvance(i);
+ return glyph_metrics_t(0, -(ascent()), w - lastRightBearing(glyphs), ascent()+descent(), w, 0);
}
glyph_metrics_t QCoreTextFontEngine::boundingBox(glyph_t glyph)
@@ -370,14 +363,6 @@ glyph_metrics_t QCoreTextFontEngine::boundingBox(glyph_t glyph)
ret.xoff = QFixed::fromReal(advances[0].width);
ret.yoff = QFixed::fromReal(advances[0].height);
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- if (fontDef.styleStrategy & QFont::ForceIntegerMetrics) {
-QT_WARNING_POP
- ret.xoff = ret.xoff.round();
- ret.yoff = ret.yoff.round();
- }
-
return ret;
}
@@ -396,32 +381,17 @@ QFixed QCoreTextFontEngine::capHeight() const
if (c <= 0)
return calculatedCapHeight();
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- if (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
-QT_WARNING_POP
- c = c.round();
-
return c;
}
QFixed QCoreTextFontEngine::xHeight() const
{
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- return (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
- ? QFixed::fromReal(CTFontGetXHeight(ctfont)).round()
- : QFixed::fromReal(CTFontGetXHeight(ctfont));
-QT_WARNING_POP
+ return QFixed::fromReal(CTFontGetXHeight(ctfont));
}
QFixed QCoreTextFontEngine::averageCharWidth() const
{
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- return (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
- ? avgCharWidth.round() : avgCharWidth;
-QT_WARNING_POP
+ return avgCharWidth;
}
qreal QCoreTextFontEngine::maxCharWidth() const
@@ -914,14 +884,8 @@ void QCoreTextFontEngine::loadAdvancesForGlyphs(QVarLengthArray<CGGlyph> &cgGlyp
QVarLengthArray<CGSize> advances(numGlyphs);
CTFontGetAdvancesForGlyphs(ctfont, kCTFontOrientationHorizontal, cgGlyphs.data(), advances.data(), numGlyphs);
- for (int i = 0; i < numGlyphs; ++i) {
- QFixed advance = QFixed::fromReal(advances[i].width);
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- glyphs->advances[i] = fontDef.styleStrategy & QFont::ForceIntegerMetrics
- ? advance.round() : advance;
-QT_WARNING_POP
- }
+ for (int i = 0; i < numGlyphs; ++i)
+ glyphs->advances[i] = QFixed::fromReal(advances[i].width);
}
QFontEngine::FaceId QCoreTextFontEngine::faceId() const
@@ -1029,18 +993,6 @@ QFontEngine::Properties QCoreTextFontEngine::properties() const
result.capHeight = QFixed::fromReal(CTFontGetCapHeight(ctfont) * scale);
result.lineWidth = QFixed::fromReal(CTFontGetUnderlineThickness(ctfont) * scale);
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- if (fontDef.styleStrategy & QFont::ForceIntegerMetrics) {
-QT_WARNING_POP
- result.ascent = result.ascent.round();
- result.descent = result.descent.round();
- result.leading = result.leading.round();
- result.italicAngle = result.italicAngle.round();
- result.capHeight = result.capHeight.round();
- result.lineWidth = result.lineWidth.round();
- }
-
return result;
}
diff --git a/src/gui/text/freetype/qfontengine_ft.cpp b/src/gui/text/freetype/qfontengine_ft.cpp
index 35b6fb3831..96f11e6e42 100644
--- a/src/gui/text/freetype/qfontengine_ft.cpp
+++ b/src/gui/text/freetype/qfontengine_ft.cpp
@@ -1326,10 +1326,7 @@ void QFontEngineFT::doKerning(QGlyphLayout *g, QFontEngine::ShaperFlags flags) c
}
}
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- if (shouldUseDesignMetrics(flags) && !(fontDef.styleStrategy & QFont::ForceIntegerMetrics))
-QT_WARNING_POP
+ if (shouldUseDesignMetrics(flags))
flags |= DesignMetrics;
else
flags &= ~DesignMetrics;
@@ -1662,14 +1659,6 @@ void QFontEngineFT::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlag
}
if (face)
unlockFace();
-
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- if (fontDef.styleStrategy & QFont::ForceIntegerMetrics) {
-QT_WARNING_POP
- for (int i = 0; i < glyphs->numGlyphs; ++i)
- glyphs->advances[i] = glyphs->advances[i].round();
- }
}
glyph_metrics_t QFontEngineFT::boundingBox(const QGlyphLayout &glyphs)
@@ -1749,11 +1738,6 @@ glyph_metrics_t QFontEngineFT::boundingBox(glyph_t glyph)
overall.width = g->width;
overall.height = g->height;
overall.xoff = g->advance;
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- if (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
-QT_WARNING_POP
- overall.xoff = overall.xoff.round();
if (!cacheEnabled && g != &emptyGlyph)
delete g;
} else {
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 0caffbea09..a62daea256 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -1355,8 +1355,6 @@ 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 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.
@@ -1375,8 +1373,6 @@ 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 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 06a71e93a9..08f8f57810 100644
--- a/src/gui/text/qfont.h
+++ b/src/gui/text/qfont.h
@@ -80,10 +80,6 @@ public:
PreferQuality = 0x0040,
PreferAntialias = 0x0080,
NoAntialias = 0x0100,
-#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
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 88499b32b8..b931de1945 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -495,7 +495,7 @@ QFixed QFontEngine::leading() const
if (!m_heightMetricsQueried)
initializeHeightMetrics();
- return (fontDef.styleStrategy & QFont::ForceIntegerMetrics) ? m_leading.round() : m_leading;
+ return m_leading;
}
QFixed QFontEngine::ascent() const
@@ -503,7 +503,7 @@ QFixed QFontEngine::ascent() const
if (!m_heightMetricsQueried)
initializeHeightMetrics();
- return (fontDef.styleStrategy & QFont::ForceIntegerMetrics) ? m_ascent.round() : m_ascent;
+ return m_ascent;
}
QFixed QFontEngine::descent() const
@@ -511,7 +511,7 @@ QFixed QFontEngine::descent() const
if (!m_heightMetricsQueried)
initializeHeightMetrics();
- return (fontDef.styleStrategy & QFont::ForceIntegerMetrics) ? m_descent.round() : m_descent;
+ return m_descent;
}
qreal QFontEngine::minLeftBearing() const
@@ -1483,13 +1483,13 @@ bool QFontEngine::hasUnreliableGlyphOutline() const
return glyphFormat == QFontEngine::Format_ARGB;
}
-QFixed QFontEngine::lastRightBearing(const QGlyphLayout &glyphs, bool round)
+QFixed QFontEngine::lastRightBearing(const QGlyphLayout &glyphs)
{
if (glyphs.numGlyphs >= 1) {
glyph_t glyph = glyphs.glyphs[glyphs.numGlyphs - 1];
glyph_metrics_t gi = boundingBox(glyph);
if (gi.isValid())
- return round ? qRound(gi.rightBearing()) : gi.rightBearing();
+ return gi.rightBearing();
}
return 0;
}
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index 7a0ccca6a0..58a810e856 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -364,7 +364,7 @@ public:
protected:
explicit QFontEngine(Type type);
- QFixed lastRightBearing(const QGlyphLayout &glyphs, bool round = false);
+ QFixed lastRightBearing(const QGlyphLayout &glyphs);
inline void setUserData(const QVariant &userData) { m_userData = userData; }
QFixed calculatedCapHeight() const;
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index c6054d3114..0500e54dde 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1736,10 +1736,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
g.glyphs[i] |= (engineIdx << 24);
}
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- if (!actualFontEngine->supportsSubPixelPositions() || (actualFontEngine->fontDef.styleStrategy & QFont::ForceIntegerMetrics)) {
-QT_WARNING_POP
+ if (!actualFontEngine->supportsSubPixelPositions()) {
for (uint i = 0; i < num_glyphs; ++i)
g.advances[i] = g.advances[i].round();
}
diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp
index 4c1bfc4d43..d96e65a532 100644
--- a/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp
+++ b/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp
@@ -515,13 +515,6 @@ void QWindowsFontEngineDirectWrite::recalcAdvances(QGlyphLayout *glyphs, QFontEn
qreal stretch = fontDef.stretch != QFont::AnyStretch ? fontDef.stretch / 100.0 : 1.0;
for (int i = 0; i < glyphs->numGlyphs; ++i)
glyphs->advances[i] = DESIGN_TO_LOGICAL(glyphMetrics[i].advanceWidth * stretch);
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- if (fontDef.styleStrategy & QFont::ForceIntegerMetrics) {
-QT_WARNING_POP
- for (int i = 0; i < glyphs->numGlyphs; ++i)
- glyphs->advances[i] = glyphs->advances[i].round();
- }
} else {
qErrnoWarning("%s: GetDesignGlyphMetrics failed", __FUNCTION__);
}
@@ -561,17 +554,9 @@ glyph_metrics_t QWindowsFontEngineDirectWrite::boundingBox(const QGlyphLayout &g
{
if (glyphs.numGlyphs == 0)
return glyph_metrics_t();
-
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- bool round = fontDef.styleStrategy & QFont::ForceIntegerMetrics;
-QT_WARNING_POP
-
QFixed w = 0;
- for (int i = 0; i < glyphs.numGlyphs; ++i) {
- w += round ? glyphs.effectiveAdvance(i).round() : glyphs.effectiveAdvance(i);
-
- }
+ for (int i = 0; i < glyphs.numGlyphs; ++i)
+ w += glyphs.effectiveAdvance(i);
return glyph_metrics_t(0, -ascent(), w - lastRightBearing(glyphs), ascent() + descent(), w, 0);
}
@@ -590,15 +575,6 @@ glyph_metrics_t QWindowsFontEngineDirectWrite::boundingBox(glyph_t g)
QFixed verticalOriginY = DESIGN_TO_LOGICAL(glyphMetrics.verticalOriginY);
QFixed topSideBearing = DESIGN_TO_LOGICAL(glyphMetrics.topSideBearing);
QFixed bottomSideBearing = DESIGN_TO_LOGICAL(glyphMetrics.bottomSideBearing);
-
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- if (fontDef.styleStrategy & QFont::ForceIntegerMetrics) {
-QT_WARNING_POP
- advanceWidth = advanceWidth.round();
- advanceHeight = advanceHeight.round();
- }
-
QFixed width = advanceWidth - leftSideBearing - rightSideBearing;
QFixed height = advanceHeight - topSideBearing - bottomSideBearing;
return glyph_metrics_t(leftSideBearing,
@@ -619,32 +595,17 @@ QFixed QWindowsFontEngineDirectWrite::capHeight() const
if (m_capHeight <= 0)
return calculatedCapHeight();
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- return fontDef.styleStrategy & QFont::ForceIntegerMetrics
- ? m_capHeight.round()
- : m_capHeight;
-QT_WARNING_POP
+ return m_capHeight;
}
QFixed QWindowsFontEngineDirectWrite::xHeight() const
{
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- return fontDef.styleStrategy & QFont::ForceIntegerMetrics
- ? m_xHeight.round()
- : m_xHeight;
-QT_WARNING_POP
+ return m_xHeight;
}
qreal QWindowsFontEngineDirectWrite::maxCharWidth() const
{
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- return fontDef.styleStrategy & QFont::ForceIntegerMetrics
- ? m_maxAdvanceWidth.round().toReal()
- : m_maxAdvanceWidth.toReal();
-QT_WARNING_POP
+ return m_maxAdvanceWidth.toReal();
}
QImage QWindowsFontEngineDirectWrite::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t)
diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp
index 0217c04788..eb9d83c525 100644
--- a/tests/auto/gui/text/qfont/tst_qfont.cpp
+++ b/tests/auto/gui/text/qfont/tst_qfont.cpp
@@ -109,8 +109,6 @@ void tst_QFont::getSetCheck()
QCOMPARE(QFont::StyleStrategy(QFont::PreferAntialias), obj1.styleStrategy());
obj1.setStyleStrategy(QFont::StyleStrategy(QFont::NoAntialias));
QCOMPARE(QFont::StyleStrategy(QFont::NoAntialias), obj1.styleStrategy());
- obj1.setStyleStrategy(QFont::StyleStrategy(QFont::OpenGLCompatible));
- QCOMPARE(QFont::StyleStrategy(QFont::OpenGLCompatible), obj1.styleStrategy());
}
void tst_QFont::exactMatch()
diff --git a/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp
index 6fe3e20083..e1db231a20 100644
--- a/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp
+++ b/tests/auto/gui/text/qfontmetrics/tst_qfontmetrics.cpp
@@ -47,11 +47,7 @@ private slots:
void elidedText();
void veryNarrowElidedText();
void averageCharWidth();
-
-#if QT_DEPRECATED_SINCE(5, 11) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void bypassShaping();
-#endif
-
void elidedMultiLength();
void elidedMultiLengthF();
void inFontUcs4();
@@ -193,22 +189,21 @@ void tst_QFontMetrics::averageCharWidth()
QVERIFY(fmf.averageCharWidth() != 0);
}
-#if QT_DEPRECATED_SINCE(5, 11) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void tst_QFontMetrics::bypassShaping()
{
QFont f;
- f.setStyleStrategy(QFont::ForceIntegerMetrics);
- QFontMetrics fm(f);
+ f.setStyleStrategy(QFont::PreferNoShaping);
+ f.setKerning(false);
+
+ QFontMetricsF fm(f);
QString text = " A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z";
- int textWidth = fm.width(text, -1, Qt::TextBypassShaping);
+ qreal textWidth = fm.horizontalAdvance(text);
QVERIFY(textWidth != 0);
- int charsWidth = 0;
+ qreal charsWidth = 0;
for (int i = 0; i < text.size(); ++i)
charsWidth += fm.horizontalAdvance(text[i]);
- // This assertion is needed in Qt WebKit's WebCore::Font::offsetForPositionForSimpleText
QCOMPARE(textWidth, charsWidth);
}
-#endif
template<class FontMetrics, typename PrimitiveType> void elidedMultiLength_helper()
{