src/gui/text/qfontengine_win.cpp
changeset 19 fcece45ef507
parent 18 2f34d5167611
child 14 c0432d11811c
equal deleted inserted replaced
18:2f34d5167611 19:fcece45ef507
    36 **
    36 **
    37 **
    37 **
    38 ** $QT_END_LICENSE$
    38 ** $QT_END_LICENSE$
    39 **
    39 **
    40 ****************************************************************************/
    40 ****************************************************************************/
       
    41 
       
    42 #if _WIN32_WINNT < 0x0500
       
    43 #undef _WIN32_WINNT
       
    44 #define _WIN32_WINNT 0x0500
       
    45 #endif
    41 
    46 
    42 #include "qfontengine_p.h"
    47 #include "qfontengine_p.h"
    43 #include "qtextengine_p.h"
    48 #include "qtextengine_p.h"
    44 #include <qglobal.h>
    49 #include <qglobal.h>
    45 #include "qt_windows.h"
    50 #include "qt_windows.h"
   647         0
   652         0
   648 };
   653 };
   649 
   654 
   650 static const int char_table_entries = sizeof(char_table)/sizeof(ushort);
   655 static const int char_table_entries = sizeof(char_table)/sizeof(ushort);
   651 
   656 
       
   657 void QFontEngineWin::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qreal *rightBearing)
       
   658 {
       
   659     HDC hdc = shared_dc();
       
   660     SelectObject(hdc, hfont);
       
   661 
       
   662 #ifndef Q_WS_WINCE
       
   663     if (ttf)
       
   664 #endif
       
   665 
       
   666     {
       
   667         ABC abcWidths;
       
   668         GetCharABCWidthsI(hdc, glyph, 1, 0, &abcWidths);
       
   669         if (leftBearing)
       
   670             *leftBearing = abcWidths.abcA;
       
   671         if (rightBearing)
       
   672             *rightBearing = abcWidths.abcC;
       
   673     }
       
   674 
       
   675 #ifndef Q_WS_WINCE
       
   676     else {
       
   677         QFontEngine::getGlyphBearings(glyph, leftBearing, rightBearing);
       
   678     }
       
   679 #endif
       
   680 }
   652 
   681 
   653 qreal QFontEngineWin::minLeftBearing() const
   682 qreal QFontEngineWin::minLeftBearing() const
   654 {
   683 {
   655     if (lbearing == SHRT_MIN)
   684     if (lbearing == SHRT_MIN)
   656         minRightBearing(); // calculates both
   685         minRightBearing(); // calculates both