Remove deprecated text-related enums
Fixes: QTBUG-82367 Change-Id: Iff2645759657f8e350754e90e791dbd583017671 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
18e8519dcd
commit
078c3b7d68
@ -235,10 +235,6 @@ namespace Qt {
|
|||||||
// Ensures that the longest variant is always used when computing the
|
// Ensures that the longest variant is always used when computing the
|
||||||
// size of a multi-variant string.
|
// size of a multi-variant string.
|
||||||
TextLongestVariant = 0x80000
|
TextLongestVariant = 0x80000
|
||||||
|
|
||||||
#if QT_DEPRECATED_SINCE(5, 11) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
, TextBypassShaping = 0x100000
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum TextElideMode {
|
enum TextElideMode {
|
||||||
|
@ -597,7 +597,6 @@
|
|||||||
\value TextJustificationForced Ensures that text lines are justified.
|
\value TextJustificationForced Ensures that text lines are justified.
|
||||||
|
|
||||||
\omitvalue TextLongestVariant
|
\omitvalue TextLongestVariant
|
||||||
\omitvalue TextBypassShaping
|
|
||||||
\omitvalue TextForceLeftToRight
|
\omitvalue TextForceLeftToRight
|
||||||
\omitvalue TextForceRightToLeft
|
\omitvalue TextForceRightToLeft
|
||||||
|
|
||||||
|
@ -341,16 +341,9 @@ bool QCoreTextFontEngine::stringToCMap(const QChar *str, int len, QGlyphLayout *
|
|||||||
glyph_metrics_t QCoreTextFontEngine::boundingBox(const QGlyphLayout &glyphs)
|
glyph_metrics_t QCoreTextFontEngine::boundingBox(const QGlyphLayout &glyphs)
|
||||||
{
|
{
|
||||||
QFixed w;
|
QFixed w;
|
||||||
QT_WARNING_PUSH
|
for (int i = 0; i < glyphs.numGlyphs; ++i)
|
||||||
QT_WARNING_DISABLE_DEPRECATED
|
w += glyphs.effectiveAdvance(i);
|
||||||
bool round = fontDef.styleStrategy & QFont::ForceIntegerMetrics;
|
return glyph_metrics_t(0, -(ascent()), w - lastRightBearing(glyphs), ascent()+descent(), w, 0);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glyph_metrics_t QCoreTextFontEngine::boundingBox(glyph_t glyph)
|
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.xoff = QFixed::fromReal(advances[0].width);
|
||||||
ret.yoff = QFixed::fromReal(advances[0].height);
|
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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,32 +381,17 @@ QFixed QCoreTextFontEngine::capHeight() const
|
|||||||
if (c <= 0)
|
if (c <= 0)
|
||||||
return calculatedCapHeight();
|
return calculatedCapHeight();
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
|
||||||
QT_WARNING_DISABLE_DEPRECATED
|
|
||||||
if (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
|
|
||||||
QT_WARNING_POP
|
|
||||||
c = c.round();
|
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
QFixed QCoreTextFontEngine::xHeight() const
|
QFixed QCoreTextFontEngine::xHeight() const
|
||||||
{
|
{
|
||||||
QT_WARNING_PUSH
|
return QFixed::fromReal(CTFontGetXHeight(ctfont));
|
||||||
QT_WARNING_DISABLE_DEPRECATED
|
|
||||||
return (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
|
|
||||||
? QFixed::fromReal(CTFontGetXHeight(ctfont)).round()
|
|
||||||
: QFixed::fromReal(CTFontGetXHeight(ctfont));
|
|
||||||
QT_WARNING_POP
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QFixed QCoreTextFontEngine::averageCharWidth() const
|
QFixed QCoreTextFontEngine::averageCharWidth() const
|
||||||
{
|
{
|
||||||
QT_WARNING_PUSH
|
return avgCharWidth;
|
||||||
QT_WARNING_DISABLE_DEPRECATED
|
|
||||||
return (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
|
|
||||||
? avgCharWidth.round() : avgCharWidth;
|
|
||||||
QT_WARNING_POP
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal QCoreTextFontEngine::maxCharWidth() const
|
qreal QCoreTextFontEngine::maxCharWidth() const
|
||||||
@ -914,14 +884,8 @@ void QCoreTextFontEngine::loadAdvancesForGlyphs(QVarLengthArray<CGGlyph> &cgGlyp
|
|||||||
QVarLengthArray<CGSize> advances(numGlyphs);
|
QVarLengthArray<CGSize> advances(numGlyphs);
|
||||||
CTFontGetAdvancesForGlyphs(ctfont, kCTFontOrientationHorizontal, cgGlyphs.data(), advances.data(), numGlyphs);
|
CTFontGetAdvancesForGlyphs(ctfont, kCTFontOrientationHorizontal, cgGlyphs.data(), advances.data(), numGlyphs);
|
||||||
|
|
||||||
for (int i = 0; i < numGlyphs; ++i) {
|
for (int i = 0; i < numGlyphs; ++i)
|
||||||
QFixed advance = QFixed::fromReal(advances[i].width);
|
glyphs->advances[i] = 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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QFontEngine::FaceId QCoreTextFontEngine::faceId() const
|
QFontEngine::FaceId QCoreTextFontEngine::faceId() const
|
||||||
@ -1029,18 +993,6 @@ QFontEngine::Properties QCoreTextFontEngine::properties() const
|
|||||||
result.capHeight = QFixed::fromReal(CTFontGetCapHeight(ctfont) * scale);
|
result.capHeight = QFixed::fromReal(CTFontGetCapHeight(ctfont) * scale);
|
||||||
result.lineWidth = QFixed::fromReal(CTFontGetUnderlineThickness(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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1326,10 +1326,7 @@ void QFontEngineFT::doKerning(QGlyphLayout *g, QFontEngine::ShaperFlags flags) c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
if (shouldUseDesignMetrics(flags))
|
||||||
QT_WARNING_DISABLE_DEPRECATED
|
|
||||||
if (shouldUseDesignMetrics(flags) && !(fontDef.styleStrategy & QFont::ForceIntegerMetrics))
|
|
||||||
QT_WARNING_POP
|
|
||||||
flags |= DesignMetrics;
|
flags |= DesignMetrics;
|
||||||
else
|
else
|
||||||
flags &= ~DesignMetrics;
|
flags &= ~DesignMetrics;
|
||||||
@ -1662,14 +1659,6 @@ void QFontEngineFT::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlag
|
|||||||
}
|
}
|
||||||
if (face)
|
if (face)
|
||||||
unlockFace();
|
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)
|
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.width = g->width;
|
||||||
overall.height = g->height;
|
overall.height = g->height;
|
||||||
overall.xoff = g->advance;
|
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)
|
if (!cacheEnabled && g != &emptyGlyph)
|
||||||
delete g;
|
delete g;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1355,8 +1355,6 @@ QFont::StyleHint QFont::styleHint() const
|
|||||||
\value NoAntialias don't antialias the fonts.
|
\value NoAntialias don't antialias the fonts.
|
||||||
\value NoSubpixelAntialias avoid subpixel antialiasing on the fonts if possible.
|
\value NoSubpixelAntialias avoid subpixel antialiasing on the fonts if possible.
|
||||||
\value PreferAntialias antialias 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
|
\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
|
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.
|
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
|
\value PreferQuality prefer the best quality font. The font matcher
|
||||||
will use the nearest standard point size that the font
|
will use the nearest standard point size that the font
|
||||||
supports.
|
supports.
|
||||||
\value ForceIntegerMetrics This style strategy has been deprecated. Use \l QFontMetrics to
|
|
||||||
retrieve rounded font metrics.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -80,10 +80,6 @@ public:
|
|||||||
PreferQuality = 0x0040,
|
PreferQuality = 0x0040,
|
||||||
PreferAntialias = 0x0080,
|
PreferAntialias = 0x0080,
|
||||||
NoAntialias = 0x0100,
|
NoAntialias = 0x0100,
|
||||||
#if QT_DEPRECATED_SINCE(5, 15)
|
|
||||||
OpenGLCompatible Q_DECL_ENUMERATOR_DEPRECATED = 0x0200,
|
|
||||||
ForceIntegerMetrics Q_DECL_ENUMERATOR_DEPRECATED = 0x0400,
|
|
||||||
#endif
|
|
||||||
NoSubpixelAntialias = 0x0800,
|
NoSubpixelAntialias = 0x0800,
|
||||||
PreferNoShaping = 0x1000,
|
PreferNoShaping = 0x1000,
|
||||||
NoFontMerging = 0x8000
|
NoFontMerging = 0x8000
|
||||||
|
@ -495,7 +495,7 @@ QFixed QFontEngine::leading() const
|
|||||||
if (!m_heightMetricsQueried)
|
if (!m_heightMetricsQueried)
|
||||||
initializeHeightMetrics();
|
initializeHeightMetrics();
|
||||||
|
|
||||||
return (fontDef.styleStrategy & QFont::ForceIntegerMetrics) ? m_leading.round() : m_leading;
|
return m_leading;
|
||||||
}
|
}
|
||||||
|
|
||||||
QFixed QFontEngine::ascent() const
|
QFixed QFontEngine::ascent() const
|
||||||
@ -503,7 +503,7 @@ QFixed QFontEngine::ascent() const
|
|||||||
if (!m_heightMetricsQueried)
|
if (!m_heightMetricsQueried)
|
||||||
initializeHeightMetrics();
|
initializeHeightMetrics();
|
||||||
|
|
||||||
return (fontDef.styleStrategy & QFont::ForceIntegerMetrics) ? m_ascent.round() : m_ascent;
|
return m_ascent;
|
||||||
}
|
}
|
||||||
|
|
||||||
QFixed QFontEngine::descent() const
|
QFixed QFontEngine::descent() const
|
||||||
@ -511,7 +511,7 @@ QFixed QFontEngine::descent() const
|
|||||||
if (!m_heightMetricsQueried)
|
if (!m_heightMetricsQueried)
|
||||||
initializeHeightMetrics();
|
initializeHeightMetrics();
|
||||||
|
|
||||||
return (fontDef.styleStrategy & QFont::ForceIntegerMetrics) ? m_descent.round() : m_descent;
|
return m_descent;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal QFontEngine::minLeftBearing() const
|
qreal QFontEngine::minLeftBearing() const
|
||||||
@ -1483,13 +1483,13 @@ bool QFontEngine::hasUnreliableGlyphOutline() const
|
|||||||
return glyphFormat == QFontEngine::Format_ARGB;
|
return glyphFormat == QFontEngine::Format_ARGB;
|
||||||
}
|
}
|
||||||
|
|
||||||
QFixed QFontEngine::lastRightBearing(const QGlyphLayout &glyphs, bool round)
|
QFixed QFontEngine::lastRightBearing(const QGlyphLayout &glyphs)
|
||||||
{
|
{
|
||||||
if (glyphs.numGlyphs >= 1) {
|
if (glyphs.numGlyphs >= 1) {
|
||||||
glyph_t glyph = glyphs.glyphs[glyphs.numGlyphs - 1];
|
glyph_t glyph = glyphs.glyphs[glyphs.numGlyphs - 1];
|
||||||
glyph_metrics_t gi = boundingBox(glyph);
|
glyph_metrics_t gi = boundingBox(glyph);
|
||||||
if (gi.isValid())
|
if (gi.isValid())
|
||||||
return round ? qRound(gi.rightBearing()) : gi.rightBearing();
|
return gi.rightBearing();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -364,7 +364,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
explicit QFontEngine(Type type);
|
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; }
|
inline void setUserData(const QVariant &userData) { m_userData = userData; }
|
||||||
QFixed calculatedCapHeight() const;
|
QFixed calculatedCapHeight() const;
|
||||||
|
@ -1736,10 +1736,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
|
|||||||
g.glyphs[i] |= (engineIdx << 24);
|
g.glyphs[i] |= (engineIdx << 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
if (!actualFontEngine->supportsSubPixelPositions()) {
|
||||||
QT_WARNING_DISABLE_DEPRECATED
|
|
||||||
if (!actualFontEngine->supportsSubPixelPositions() || (actualFontEngine->fontDef.styleStrategy & QFont::ForceIntegerMetrics)) {
|
|
||||||
QT_WARNING_POP
|
|
||||||
for (uint i = 0; i < num_glyphs; ++i)
|
for (uint i = 0; i < num_glyphs; ++i)
|
||||||
g.advances[i] = g.advances[i].round();
|
g.advances[i] = g.advances[i].round();
|
||||||
}
|
}
|
||||||
|
@ -515,13 +515,6 @@ void QWindowsFontEngineDirectWrite::recalcAdvances(QGlyphLayout *glyphs, QFontEn
|
|||||||
qreal stretch = fontDef.stretch != QFont::AnyStretch ? fontDef.stretch / 100.0 : 1.0;
|
qreal stretch = fontDef.stretch != QFont::AnyStretch ? fontDef.stretch / 100.0 : 1.0;
|
||||||
for (int i = 0; i < glyphs->numGlyphs; ++i)
|
for (int i = 0; i < glyphs->numGlyphs; ++i)
|
||||||
glyphs->advances[i] = DESIGN_TO_LOGICAL(glyphMetrics[i].advanceWidth * stretch);
|
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 {
|
} else {
|
||||||
qErrnoWarning("%s: GetDesignGlyphMetrics failed", __FUNCTION__);
|
qErrnoWarning("%s: GetDesignGlyphMetrics failed", __FUNCTION__);
|
||||||
}
|
}
|
||||||
@ -561,17 +554,9 @@ glyph_metrics_t QWindowsFontEngineDirectWrite::boundingBox(const QGlyphLayout &g
|
|||||||
{
|
{
|
||||||
if (glyphs.numGlyphs == 0)
|
if (glyphs.numGlyphs == 0)
|
||||||
return glyph_metrics_t();
|
return glyph_metrics_t();
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
|
||||||
QT_WARNING_DISABLE_DEPRECATED
|
|
||||||
bool round = fontDef.styleStrategy & QFont::ForceIntegerMetrics;
|
|
||||||
QT_WARNING_POP
|
|
||||||
|
|
||||||
QFixed w = 0;
|
QFixed w = 0;
|
||||||
for (int i = 0; i < glyphs.numGlyphs; ++i) {
|
for (int i = 0; i < glyphs.numGlyphs; ++i)
|
||||||
w += round ? glyphs.effectiveAdvance(i).round() : glyphs.effectiveAdvance(i);
|
w += glyphs.effectiveAdvance(i);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return glyph_metrics_t(0, -ascent(), w - lastRightBearing(glyphs), ascent() + descent(), w, 0);
|
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 verticalOriginY = DESIGN_TO_LOGICAL(glyphMetrics.verticalOriginY);
|
||||||
QFixed topSideBearing = DESIGN_TO_LOGICAL(glyphMetrics.topSideBearing);
|
QFixed topSideBearing = DESIGN_TO_LOGICAL(glyphMetrics.topSideBearing);
|
||||||
QFixed bottomSideBearing = DESIGN_TO_LOGICAL(glyphMetrics.bottomSideBearing);
|
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 width = advanceWidth - leftSideBearing - rightSideBearing;
|
||||||
QFixed height = advanceHeight - topSideBearing - bottomSideBearing;
|
QFixed height = advanceHeight - topSideBearing - bottomSideBearing;
|
||||||
return glyph_metrics_t(leftSideBearing,
|
return glyph_metrics_t(leftSideBearing,
|
||||||
@ -619,32 +595,17 @@ QFixed QWindowsFontEngineDirectWrite::capHeight() const
|
|||||||
if (m_capHeight <= 0)
|
if (m_capHeight <= 0)
|
||||||
return calculatedCapHeight();
|
return calculatedCapHeight();
|
||||||
|
|
||||||
QT_WARNING_PUSH
|
return m_capHeight;
|
||||||
QT_WARNING_DISABLE_DEPRECATED
|
|
||||||
return fontDef.styleStrategy & QFont::ForceIntegerMetrics
|
|
||||||
? m_capHeight.round()
|
|
||||||
: m_capHeight;
|
|
||||||
QT_WARNING_POP
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QFixed QWindowsFontEngineDirectWrite::xHeight() const
|
QFixed QWindowsFontEngineDirectWrite::xHeight() const
|
||||||
{
|
{
|
||||||
QT_WARNING_PUSH
|
return m_xHeight;
|
||||||
QT_WARNING_DISABLE_DEPRECATED
|
|
||||||
return fontDef.styleStrategy & QFont::ForceIntegerMetrics
|
|
||||||
? m_xHeight.round()
|
|
||||||
: m_xHeight;
|
|
||||||
QT_WARNING_POP
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal QWindowsFontEngineDirectWrite::maxCharWidth() const
|
qreal QWindowsFontEngineDirectWrite::maxCharWidth() const
|
||||||
{
|
{
|
||||||
QT_WARNING_PUSH
|
return m_maxAdvanceWidth.toReal();
|
||||||
QT_WARNING_DISABLE_DEPRECATED
|
|
||||||
return fontDef.styleStrategy & QFont::ForceIntegerMetrics
|
|
||||||
? m_maxAdvanceWidth.round().toReal()
|
|
||||||
: m_maxAdvanceWidth.toReal();
|
|
||||||
QT_WARNING_POP
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage QWindowsFontEngineDirectWrite::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t)
|
QImage QWindowsFontEngineDirectWrite::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t)
|
||||||
|
@ -109,8 +109,6 @@ void tst_QFont::getSetCheck()
|
|||||||
QCOMPARE(QFont::StyleStrategy(QFont::PreferAntialias), obj1.styleStrategy());
|
QCOMPARE(QFont::StyleStrategy(QFont::PreferAntialias), obj1.styleStrategy());
|
||||||
obj1.setStyleStrategy(QFont::StyleStrategy(QFont::NoAntialias));
|
obj1.setStyleStrategy(QFont::StyleStrategy(QFont::NoAntialias));
|
||||||
QCOMPARE(QFont::StyleStrategy(QFont::NoAntialias), obj1.styleStrategy());
|
QCOMPARE(QFont::StyleStrategy(QFont::NoAntialias), obj1.styleStrategy());
|
||||||
obj1.setStyleStrategy(QFont::StyleStrategy(QFont::OpenGLCompatible));
|
|
||||||
QCOMPARE(QFont::StyleStrategy(QFont::OpenGLCompatible), obj1.styleStrategy());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QFont::exactMatch()
|
void tst_QFont::exactMatch()
|
||||||
|
@ -47,11 +47,7 @@ private slots:
|
|||||||
void elidedText();
|
void elidedText();
|
||||||
void veryNarrowElidedText();
|
void veryNarrowElidedText();
|
||||||
void averageCharWidth();
|
void averageCharWidth();
|
||||||
|
|
||||||
#if QT_DEPRECATED_SINCE(5, 11) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
void bypassShaping();
|
void bypassShaping();
|
||||||
#endif
|
|
||||||
|
|
||||||
void elidedMultiLength();
|
void elidedMultiLength();
|
||||||
void elidedMultiLengthF();
|
void elidedMultiLengthF();
|
||||||
void inFontUcs4();
|
void inFontUcs4();
|
||||||
@ -193,22 +189,21 @@ void tst_QFontMetrics::averageCharWidth()
|
|||||||
QVERIFY(fmf.averageCharWidth() != 0);
|
QVERIFY(fmf.averageCharWidth() != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_DEPRECATED_SINCE(5, 11) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
void tst_QFontMetrics::bypassShaping()
|
void tst_QFontMetrics::bypassShaping()
|
||||||
{
|
{
|
||||||
QFont f;
|
QFont f;
|
||||||
f.setStyleStrategy(QFont::ForceIntegerMetrics);
|
f.setStyleStrategy(QFont::PreferNoShaping);
|
||||||
QFontMetrics fm(f);
|
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";
|
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);
|
QVERIFY(textWidth != 0);
|
||||||
int charsWidth = 0;
|
qreal charsWidth = 0;
|
||||||
for (int i = 0; i < text.size(); ++i)
|
for (int i = 0; i < text.size(); ++i)
|
||||||
charsWidth += fm.horizontalAdvance(text[i]);
|
charsWidth += fm.horizontalAdvance(text[i]);
|
||||||
// This assertion is needed in Qt WebKit's WebCore::Font::offsetForPositionForSimpleText
|
|
||||||
QCOMPARE(textWidth, charsWidth);
|
QCOMPARE(textWidth, charsWidth);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
template<class FontMetrics, typename PrimitiveType> void elidedMultiLength_helper()
|
template<class FontMetrics, typename PrimitiveType> void elidedMultiLength_helper()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user