From c3dd4b356e277c8ec2a2634dbae04cdc7e798ca9 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 22 Mar 2010 13:40:54 +0100 Subject: Recommit 1ebeb971d3382aec0fff927 This reverts commit 725c2c29c192349016b1332824a7716bbb992f31 which reverted the original commit because of a test failure on qws. This recommit adds a test for whether the metrics from QFontEngine::boundingBox() are valid, which is required for the bearings to be calculated. This test was also in the original logic. --- src/gui/text/qfontengine_win.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/gui/text/qfontengine_win.cpp') diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index 1a815d3d21..a133b48888 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -649,6 +649,30 @@ static const ushort char_table[] = { static const int char_table_entries = sizeof(char_table)/sizeof(ushort); +void QFontEngineWin::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qreal *rightBearing) +{ + HDC hdc = shared_dc(); + SelectObject(hdc, hfont); + +#ifndef Q_WS_WINCE + if (ttf) +#endif + + { + ABC abcWidths; + GetCharABCWidthsI(hdc, glyph, 1, 0, &abcWidths); + if (leftBearing) + *leftBearing = abcWidths.abcA; + if (rightBearing) + *rightBearing = abcWidths.abcC; + } + +#ifndef Q_WS_WINCE + else { + QFontEngine::getGlyphBearings(glyph, leftBearing, rightBearing); + } +#endif +} qreal QFontEngineWin::minLeftBearing() const { -- cgit v1.2.3