diff options
Diffstat (limited to 'src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp')
-rw-r--r-- | src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp index 45ce396d5e..b11ad46bc7 100644 --- a/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp @@ -509,7 +509,10 @@ 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(); } @@ -553,7 +556,10 @@ 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) { @@ -579,7 +585,10 @@ glyph_metrics_t QWindowsFontEngineDirectWrite::boundingBox(glyph_t g) 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(); } @@ -601,9 +610,12 @@ glyph_metrics_t QWindowsFontEngineDirectWrite::boundingBox(glyph_t g) QFixed QWindowsFontEngineDirectWrite::ascent() const { +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED return fontDef.styleStrategy & QFont::ForceIntegerMetrics ? m_ascent.round() : m_ascent; +QT_WARNING_POP } QFixed QWindowsFontEngineDirectWrite::capHeight() const @@ -611,37 +623,52 @@ 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 } QFixed QWindowsFontEngineDirectWrite::descent() const { +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED return fontDef.styleStrategy & QFont::ForceIntegerMetrics ? m_descent.round() : m_descent; +QT_WARNING_POP } QFixed QWindowsFontEngineDirectWrite::leading() const { +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED return fontDef.styleStrategy & QFont::ForceIntegerMetrics ? m_lineGap.round() : m_lineGap; +QT_WARNING_POP } QFixed QWindowsFontEngineDirectWrite::xHeight() const { +QT_WARNING_PUSH +QT_WARNING_DISABLE_DEPRECATED return fontDef.styleStrategy & QFont::ForceIntegerMetrics ? m_xHeight.round() : m_xHeight; +QT_WARNING_POP } 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 } QImage QWindowsFontEngineDirectWrite::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) @@ -720,7 +747,7 @@ QImage QWindowsFontEngineDirectWrite::imageForGlyph(glyph_t t, &transform, renderMode, measureMode, - 0.0, 0.0, + margin, margin, &glyphAnalysis ); @@ -1022,6 +1049,7 @@ glyph_metrics_t QWindowsFontEngineDirectWrite::alphaMapBoundingBox(glyph_t glyph hintingPreferenceToRenderingMode(QFont::HintingPreference(fontDef.hintingPreference)); DWRITE_MEASURING_MODE measureMode = renderModeToMeasureMode(renderMode); + const int margin = glyphMargin(QFontEngine::Format_A32); IDWriteGlyphRunAnalysis *glyphAnalysis = NULL; HRESULT hr = m_fontEngineData->directWriteFactory->CreateGlyphRunAnalysis( &glyphRun, @@ -1029,7 +1057,7 @@ glyph_metrics_t QWindowsFontEngineDirectWrite::alphaMapBoundingBox(glyph_t glyph &transform, renderMode, measureMode, - 0.0, 0.0, + margin, margin, &glyphAnalysis ); @@ -1038,8 +1066,6 @@ glyph_metrics_t QWindowsFontEngineDirectWrite::alphaMapBoundingBox(glyph_t glyph glyphAnalysis->GetAlphaTextureBounds(DWRITE_TEXTURE_CLEARTYPE_3x1, &rect); glyphAnalysis->Release(); - int margin = glyphMargin(QFontEngine::Format_A32); - return glyph_metrics_t(rect.left - margin, rect.top - margin, rect.right - rect.left + margin * 2, |