From d23286cc56cbbf051445f906083deeeae731534b Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Thu, 16 Aug 2018 13:52:01 +0200 Subject: Fix wrong initial glyph size with native pango_win32 font backend Turns out somebody (likely cairo or pango) calls SetWorldTransform() during initialization without resetting it. This resulted in the font selected on startup having a wrong (tiny) glyph size. Work around this by explicitly setting the "WorldTransform" again when subsequently selecting the font. --- src/libnrtype/FontInstance.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/libnrtype') diff --git a/src/libnrtype/FontInstance.cpp b/src/libnrtype/FontInstance.cpp index 733eb4dd5..d7a90bcd4 100644 --- a/src/libnrtype/FontInstance.cpp +++ b/src/libnrtype/FontInstance.cpp @@ -288,6 +288,16 @@ void font_instance::InitTheFace() FindFontMetrics(); } + +#ifdef USE_PANGO_WIN32 + // Someone (probably pango or cairo) sets the world transform during initialization and does not reset it. + // Work around this by explicitly setting it again (even if the font is already initialized) + XFORM identity = {1.0, 0.0, 0.0, 1.0, 0.0, 0.0}; + SetWorldTransform(parent->hScreenDC, &identity); + SetGraphicsMode(parent->hScreenDC, GM_COMPATIBLE); + SelectObject(parent->hScreenDC,theFace); +#endif + } void font_instance::FreeTheFace() -- cgit v1.2.3