Alexandre Julliard : gdi32: Implement GetTextMetrics as a standard driver entry point.

Alexandre Julliard julliard at winehq.org
Mon Oct 24 13:43:55 CDT 2011


Module: wine
Branch: master
Commit: 20070d0838e5b28a75a64a1a26ef3eef14eeb80d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=20070d0838e5b28a75a64a1a26ef3eef14eeb80d

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Oct 19 14:12:23 2011 +0200

gdi32: Implement GetTextMetrics as a standard driver entry point.

---

 dlls/gdi32/font.c        |   10 +++-------
 dlls/gdi32/freetype.c    |   22 +++++++++++-----------
 dlls/gdi32/gdi_private.h |    1 -
 3 files changed, 14 insertions(+), 19 deletions(-)

diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index d08ba4b..9770f1e 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -1222,17 +1222,13 @@ BOOL WINAPI GetTextMetricsA( HDC hdc, TEXTMETRICA *metrics )
  */
 BOOL WINAPI GetTextMetricsW( HDC hdc, TEXTMETRICW *metrics )
 {
+    PHYSDEV physdev;
     BOOL ret = FALSE;
     DC * dc = get_dc_ptr( hdc );
     if (!dc) return FALSE;
 
-    if (dc->gdiFont)
-        ret = WineEngGetTextMetrics(dc->gdiFont, metrics);
-    else
-    {
-        PHYSDEV physdev = GET_DC_PHYSDEV( dc, pGetTextMetrics );
-        ret = physdev->funcs->pGetTextMetrics( physdev, metrics );
-    }
+    physdev = GET_DC_PHYSDEV( dc, pGetTextMetrics );
+    ret = physdev->funcs->pGetTextMetrics( physdev, metrics );
 
     if (ret)
     {
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index ad20bf8..a2b57eb 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -6209,16 +6209,22 @@ DWORD WineEngGetGlyphOutline(GdiFont *font, UINT glyph, UINT format,
 }
 
 /*************************************************************
- * WineEngGetTextMetrics
- *
+ * freetype_GetTextMetrics
  */
-BOOL WineEngGetTextMetrics(GdiFont *font, LPTEXTMETRICW ptm)
+static BOOL freetype_GetTextMetrics( PHYSDEV dev, TEXTMETRICW *metrics )
 {
+    struct freetype_physdev *physdev = get_freetype_dev( dev );
     BOOL ret;
 
+    if (!physdev->font)
+    {
+        dev = GET_NEXT_PHYSDEV( dev, pGetTextMetrics );
+        return dev->funcs->pGetTextMetrics( dev, metrics );
+    }
+
     GDI_CheckNotLock();
     EnterCriticalSection( &freetype_cs );
-    ret = get_text_metrics( font, ptm );
+    ret = get_text_metrics( physdev->font, metrics );
     LeaveCriticalSection( &freetype_cs );
     return ret;
 }
@@ -7089,7 +7095,7 @@ static const struct gdi_dc_funcs freetype_funcs =
     NULL,                               /* pGetPixelFormat */
     NULL,                               /* pGetSystemPaletteEntries */
     freetype_GetTextExtentExPoint,      /* pGetTextExtentExPoint */
-    NULL,                               /* pGetTextMetrics */
+    freetype_GetTextMetrics,            /* pGetTextMetrics */
     NULL,                               /* pIntersectClipRect */
     NULL,                               /* pInvertRgn */
     NULL,                               /* pLineTo */
@@ -7196,12 +7202,6 @@ DWORD WineEngGetGlyphOutline(GdiFont *font, UINT glyph, UINT format,
     return GDI_ERROR;
 }
 
-BOOL WineEngGetTextMetrics(GdiFont *font, LPTEXTMETRICW ptm)
-{
-    ERR("called but we don't have FreeType\n");
-    return FALSE;
-}
-
 UINT WineEngGetOutlineTextMetrics(GdiFont *font, UINT cbSize,
 				  OUTLINETEXTMETRICW *potm)
 {
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index ad7b049..51fbf2e 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -312,7 +312,6 @@ extern UINT WineEngGetOutlineTextMetrics(GdiFont*, UINT, LPOUTLINETEXTMETRICW) D
 extern UINT WineEngGetTextCharsetInfo(GdiFont *font, LPFONTSIGNATURE fs, DWORD flags) DECLSPEC_HIDDEN;
 extern BOOL WineEngGetTextExtentExPointI(GdiFont*, const WORD *, INT, INT, LPINT, LPINT, LPSIZE) DECLSPEC_HIDDEN;
 extern INT  WineEngGetTextFace(GdiFont*, INT, LPWSTR) DECLSPEC_HIDDEN;
-extern BOOL WineEngGetTextMetrics(GdiFont*, LPTEXTMETRICW) DECLSPEC_HIDDEN;
 extern BOOL WineEngFontIsLinked(GdiFont*) DECLSPEC_HIDDEN;
 extern BOOL WineEngInit(void) DECLSPEC_HIDDEN;
 extern BOOL WineEngRealizationInfo(GdiFont*, realization_info_t*) DECLSPEC_HIDDEN;




More information about the wine-cvs mailing list