src/gui/text/qfontengine_win.cpp
changeset 7 f7bc934e204c
parent 3 41300fa6a67c
--- a/src/gui/text/qfontengine_win.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/src/gui/text/qfontengine_win.cpp	Wed Mar 31 11:06:36 2010 +0300
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -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
 {