summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>2016-02-09 15:51:28 +0100
committerJani Heikkinen <jani.heikkinen@theqtcompany.com>2016-02-09 18:04:21 +0000
commit8c2b4266002736da499d169a0da187e5cdc5381a (patch)
tree5a51d23032d81dd36e7abba5e4a2d2a59c5f43d0 /src
parentf5b9cdbb0844dd149d9b945b28da42d56977f844 (diff)
Account for hinting preference in alpha map bounding box
We would ignore the vertical hinting when calculating the bounding box, giving an off-by-one error in the base line of some characters when rendering with PreferVerticalHinting, which is the default when doing High-DPI on Windows. Task-number: QTBUG-50940 Change-Id: I2846765ec044eaf317026ee8c7bb9588257bf05c Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
index bb4f4b1abd..d99a6caecd 100644
--- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
@@ -759,12 +759,17 @@ glyph_metrics_t QWindowsFontEngineDirectWrite::alphaMapBoundingBox(glyph_t glyph
transform.m21 = matrix.m21();
transform.m22 = matrix.m22();
+ DWRITE_RENDERING_MODE renderMode =
+ fontDef.hintingPreference == QFont::PreferNoHinting
+ ? DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC
+ : DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL;
+
IDWriteGlyphRunAnalysis *glyphAnalysis = NULL;
HRESULT hr = m_fontEngineData->directWriteFactory->CreateGlyphRunAnalysis(
&glyphRun,
1.0f,
&transform,
- DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC,
+ renderMode,
DWRITE_MEASURING_MODE_NATURAL,
0.0, 0.0,
&glyphAnalysis