From 4073a3dd7799c0e791ab8d443399490bb0200903 Mon Sep 17 00:00:00 2001 From: Louai Al-Khanji Date: Mon, 22 Sep 2014 13:53:08 +0300 Subject: [PATCH] direct2d: Fix font size when display scaling is in use Since we already tell direct2d that we are using pixel sizes in the QWindowsDirect2DDeviceContextPrivate constructor and thereby enable scaling inside direct2d, there is no need to scale the font size again. Change-Id: Id9c9ed4d2848bcd09f997e41fb87802a3fe2432b Reviewed-by: Andrew Knight --- .../direct2d/qwindowsdirect2dpaintengine.cpp | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp index 2c60409dff..e765812024 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp @@ -109,13 +109,6 @@ static inline ID2D1Factory1 *factory() return QWindowsDirect2DContext::instance()->d2dFactory(); } -inline static FLOAT pixelSizeToDIP(int pixelSize) -{ - FLOAT dpiX, dpiY; - QWindowsDirect2DContext::instance()->d2dFactory()->GetDesktopDpi(&dpiX, &dpiY); - return FLOAT(pixelSize) * 96.0f / dpiY; -} - class Direct2DPathGeometryWriter { public: @@ -866,14 +859,14 @@ public: Q_Q(QWindowsDirect2DPaintEngine); DWRITE_GLYPH_RUN glyphRun = { - fontFace, // IDWriteFontFace *fontFace; - pixelSizeToDIP(fontDef.pixelSize), // FLOAT fontEmSize; - numGlyphs, // UINT32 glyphCount; - glyphIndices, // const UINT16 *glyphIndices; - glyphAdvances, // const FLOAT *glyphAdvances; - glyphOffsets, // const DWRITE_GLYPH_OFFSET *glyphOffsets; - FALSE, // BOOL isSideways; - rtl ? 1 : 0 // UINT32 bidiLevel; + fontFace, // IDWriteFontFace *fontFace; + fontDef.pixelSize, // FLOAT fontEmSize; + numGlyphs, // UINT32 glyphCount; + glyphIndices, // const UINT16 *glyphIndices; + glyphAdvances, // const FLOAT *glyphAdvances; + glyphOffsets, // const DWRITE_GLYPH_OFFSET *glyphOffsets; + FALSE, // BOOL isSideways; + rtl ? 1 : 0 // UINT32 bidiLevel; }; const bool antiAlias = bool((q->state()->renderHints & QPainter::TextAntialiasing)