src/gui/text/qfontengine_win.cpp
branchRCL_3
changeset 7 3f74d0d4af4c
parent 4 3b1da2848fc7
child 13 c0432d11811c
--- a/src/gui/text/qfontengine_win.cpp	Mon Mar 15 12:43:09 2010 +0200
+++ b/src/gui/text/qfontengine_win.cpp	Thu Apr 08 14:19:33 2010 +0300
@@ -39,6 +39,11 @@
 **
 ****************************************************************************/
 
+#if _WIN32_WINNT < 0x0500
+#undef _WIN32_WINNT
+#define _WIN32_WINNT 0x0500
+#endif
+
 #include "qfontengine_p.h"
 #include "qtextengine_p.h"
 #include <qglobal.h>
@@ -649,6 +654,30 @@
 
 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
 {