GetTextMetrics goes unicode

Huw D M Davies h.davies1 at physics.ox.ac.uk
Thu Mar 15 10:18:10 CST 2001


	Huw D M Davies <hdavies at codeweavers.com>
	Move GetTextMetrics to unicode.
-------------- next part --------------
Index: dlls/ttydrv/graphics.c
===================================================================
RCS file: /home/wine/wine/dlls/ttydrv/graphics.c,v
retrieving revision 1.4
diff -u -r1.4 graphics.c
--- dlls/ttydrv/graphics.c	2000/11/28 22:40:58	1.4
+++ dlls/ttydrv/graphics.c	2001/03/15 15:39:18
@@ -442,7 +442,7 @@
 /***********************************************************************
  *		TTYDRV_DC_GetTextMetrics
  */
-BOOL TTYDRV_DC_GetTextMetrics(DC *dc, LPTEXTMETRICA lptm)
+BOOL TTYDRV_DC_GetTextMetrics(DC *dc, LPTEXTMETRICW lptm)
 {
   TTYDRV_PDEVICE *physDev = (TTYDRV_PDEVICE *) dc->physDev;
 
Index: dlls/ttydrv/ttydrv.h
===================================================================
RCS file: /home/wine/wine/dlls/ttydrv/ttydrv.h,v
retrieving revision 1.6
diff -u -r1.6 ttydrv.h
--- dlls/ttydrv/ttydrv.h	2000/12/10 23:01:34	1.6
+++ dlls/ttydrv/ttydrv.h	2001/03/15 15:39:18
@@ -88,7 +88,7 @@
 extern COLORREF TTYDRV_DC_GetPixel(struct tagDC *dc, INT x, INT y);
 
 extern BOOL TTYDRV_DC_GetTextExtentPoint(struct tagDC *dc, LPCWSTR str, INT count, LPSIZE size);
-extern BOOL TTYDRV_DC_GetTextMetrics(struct tagDC *dc, TEXTMETRICA *metrics);
+extern BOOL TTYDRV_DC_GetTextMetrics(struct tagDC *dc, TEXTMETRICW *metrics);
 extern BOOL TTYDRV_DC_LineTo(struct tagDC *dc, INT x, INT y);
 extern BOOL TTYDRV_DC_PaintRgn(struct tagDC *dc, HRGN hrgn);
 extern BOOL TTYDRV_DC_PatBlt(struct tagDC *dc, INT left, INT top, INT width, INT height, DWORD rop);
Index: dlls/wineps/font.c
===================================================================
RCS file: /home/wine/wine/dlls/wineps/font.c,v
retrieving revision 1.7
diff -u -r1.7 font.c
--- dlls/wineps/font.c	2001/02/14 22:56:38	1.7
+++ dlls/wineps/font.c	2001/03/15 15:39:18
@@ -166,7 +166,7 @@
 /***********************************************************************
  *           PSDRV_GetTextMetrics
  */
-BOOL PSDRV_GetTextMetrics(DC *dc, TEXTMETRICA *metrics)
+BOOL PSDRV_GetTextMetrics(DC *dc, TEXTMETRICW *metrics)
 {
     PSDRV_PDEVICE *physDev = (PSDRV_PDEVICE *)dc->physDev;
 
Index: dlls/wineps/psdrv.h
===================================================================
RCS file: /home/wine/wine/dlls/wineps/psdrv.h,v
retrieving revision 1.6
diff -u -r1.6 psdrv.h
--- dlls/wineps/psdrv.h	2001/02/14 22:56:38	1.6
+++ dlls/wineps/psdrv.h	2001/03/15 15:39:18
@@ -192,13 +192,13 @@
 } PSCOLOR;
 
 typedef struct {
-    AFM			*afm;
-    TEXTMETRICA	tm;
-    INT		size;
-    float		scale;
-    INT		escapement;
-    PSCOLOR		color;
-    BOOL		set;		/* Have we done a setfont yet */
+    AFM                 *afm;
+    TEXTMETRICW         tm;
+    INT                 size;
+    float               scale;
+    INT                 escapement;
+    PSCOLOR             color;
+    BOOL                set;		/* Have we done a setfont yet */
 } PSFONT;
 
 typedef struct {
@@ -339,7 +339,7 @@
 				  LPINT buffer );
 extern BOOL PSDRV_GetTextExtentPoint( DC *dc, LPCWSTR str, INT count,
 					LPSIZE size );
-extern BOOL PSDRV_GetTextMetrics( DC *dc, TEXTMETRICA *metrics );
+extern BOOL PSDRV_GetTextMetrics( DC *dc, TEXTMETRICW *metrics );
 extern BOOL PSDRV_LineTo( DC *dc, INT x, INT y );
 extern BOOL PSDRV_PatBlt( DC *dc, INT x, INT y, INT width, INT height, DWORD
 			  dwRop);
Index: graphics/win16drv/font.c
===================================================================
RCS file: /home/wine/wine/graphics/win16drv/font.c,v
retrieving revision 1.18
diff -u -r1.18 font.c
--- graphics/win16drv/font.c	2001/02/14 22:56:39	1.18
+++ graphics/win16drv/font.c	2001/03/15 15:39:18
@@ -50,13 +50,13 @@
 /***********************************************************************
  *           WIN16DRV_GetTextMetrics
  */
-BOOL WIN16DRV_GetTextMetrics( DC *dc, TEXTMETRICA *metrics )
+BOOL WIN16DRV_GetTextMetrics( DC *dc, TEXTMETRICW *metrics )
 {
     WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
 
     TRACE("%04x \n", dc->hSelf);
 
-    FONT_TextMetric16ToA( &physDev->tm, metrics );
+    FONT_TextMetric16ToW( &physDev->tm, metrics );
 
     TRACE(
 	  "H %ld, A %ld, D %ld, Int %ld, Ext %ld, AW %ld, MW %ld, W %ld\n",
Index: graphics/x11drv/xfont.c
===================================================================
RCS file: /home/wine/wine/graphics/x11drv/xfont.c,v
retrieving revision 1.68
diff -u -r1.68 xfont.c
--- graphics/x11drv/xfont.c	2001/03/05 19:34:20	1.68
+++ graphics/x11drv/xfont.c	2001/03/15 15:55:39
@@ -3176,15 +3176,16 @@
 /***********************************************************************
  *           X11DRV_GetTextMetrics
  */
-BOOL X11DRV_GetTextMetrics(DC *dc, TEXTMETRICA *metrics)
+BOOL X11DRV_GetTextMetrics(DC *dc, TEXTMETRICW *metrics)
 {
     X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
+    TEXTMETRICA tmA;
 
     if( CHECK_PFONT(physDev->font) )
     {
 	fontObject* pfo = __PFONT(physDev->font);
-	X11DRV_cptable[pfo->fi->cptable].pGetTextMetricsA( pfo, metrics );
-
+	X11DRV_cptable[pfo->fi->cptable].pGetTextMetricsA( pfo, &tmA );
+	FONT_TextMetricAToW(&tmA, metrics);
 	return TRUE;
     }
     return FALSE;
Index: include/gdi.h
===================================================================
RCS file: /home/wine/wine/include/gdi.h,v
retrieving revision 1.41
diff -u -r1.41 gdi.h
--- include/gdi.h	2001/02/14 22:56:39	1.41
+++ include/gdi.h	2001/03/15 15:39:19
@@ -202,7 +202,7 @@
     COLORREF (*pGetPixel)(DC*,INT,INT);
     INT      (*pGetPixelFormat)(DC*);
     BOOL     (*pGetTextExtentPoint)(DC*,LPCWSTR,INT,LPSIZE);
-    BOOL     (*pGetTextMetrics)(DC*,TEXTMETRICA*);
+    BOOL     (*pGetTextMetrics)(DC*,TEXTMETRICW*);
     INT      (*pIntersectClipRect)(DC*,INT,INT,INT,INT);
     BOOL     (*pInvertRgn)(DC*,HRGN);    
     BOOL     (*pLineTo)(DC*,INT,INT);
Index: include/win16drv.h
===================================================================
RCS file: /home/wine/wine/include/win16drv.h,v
retrieving revision 1.13
diff -u -r1.13 win16drv.h
--- include/win16drv.h	2001/02/14 22:56:39	1.13
+++ include/win16drv.h	2001/03/15 15:39:19
@@ -211,7 +211,7 @@
 
 extern BOOL WIN16DRV_GetTextExtentPoint( DC *dc, LPCWSTR str, INT count,
                                            LPSIZE size );
-extern BOOL WIN16DRV_GetTextMetrics( DC *dc, TEXTMETRICA *metrics );
+extern BOOL WIN16DRV_GetTextMetrics( DC *dc, TEXTMETRICW *metrics );
 
 extern BOOL WIN16DRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
                                   const RECT *lprect, LPCWSTR str, UINT count,
Index: include/x11drv.h
===================================================================
RCS file: /home/wine/wine/include/x11drv.h,v
retrieving revision 1.71
diff -u -r1.71 x11drv.h
--- include/x11drv.h	2001/02/14 22:56:39	1.71
+++ include/x11drv.h	2001/03/15 15:39:19
@@ -99,7 +99,7 @@
 extern BOOL X11DRV_GetDCOrgEx( struct tagDC *dc, LPPOINT lpp );
 extern BOOL X11DRV_GetTextExtentPoint( struct tagDC *dc, LPCWSTR str,
                                          INT count, LPSIZE size );
-extern BOOL X11DRV_GetTextMetrics(struct tagDC *dc, TEXTMETRICA *metrics);
+extern BOOL X11DRV_GetTextMetrics(struct tagDC *dc, TEXTMETRICW *metrics);
 extern BOOL X11DRV_PatBlt( struct tagDC *dc, INT left, INT top,
                              INT width, INT height, DWORD rop );
 extern VOID   X11DRV_SetDeviceClipping(struct tagDC *dc);
Index: objects/font.c
===================================================================
RCS file: /home/wine/wine/objects/font.c,v
retrieving revision 1.37
diff -u -r1.37 font.c
--- objects/font.c	2001/02/14 22:56:39	1.37
+++ objects/font.c	2001/03/15 15:39:20
@@ -1173,10 +1173,10 @@
  */
 BOOL16 WINAPI GetTextMetrics16( HDC16 hdc, TEXTMETRIC16 *metrics )
 {
-    TEXTMETRICA tm32;
+    TEXTMETRICW tm32;
 
-    if (!GetTextMetricsA( (HDC)hdc, &tm32 )) return FALSE;
-    FONT_TextMetricATo16( &tm32, metrics );
+    if (!GetTextMetricsW( (HDC)hdc, &tm32 )) return FALSE;
+    FONT_TextMetricWTo16( &tm32, metrics );
     return TRUE;
 }
 
@@ -1185,7 +1185,19 @@
  *           GetTextMetricsA    (GDI32.@)
  */
 BOOL WINAPI GetTextMetricsA( HDC hdc, TEXTMETRICA *metrics )
-    {
+{
+    TEXTMETRICW tm32;
+
+    if (!GetTextMetricsW( hdc, &tm32 )) return FALSE;
+    FONT_TextMetricWToA( &tm32, metrics );
+    return TRUE;
+}
+
+/***********************************************************************
+ *           GetTextMetricsW    (GDI32.@)
+ */
+BOOL WINAPI GetTextMetricsW( HDC hdc, TEXTMETRICW *metrics )
+{
     BOOL ret = FALSE;
     DC * dc = DC_GetDCPtr( hdc );
     if (!dc) return FALSE;
@@ -1213,10 +1225,10 @@
         ret = TRUE;
 
     TRACE("text metrics:\n"
-          "    Weight = %03li\t FirstChar = %03i\t AveCharWidth = %li\n"
-          "    Italic = % 3i\t LastChar = %03i\t\t MaxCharWidth = %li\n"
-          "    UnderLined = %01i\t DefaultChar = %03i\t Overhang = %li\n"
-          "    StruckOut = %01i\t BreakChar = %03i\t CharSet = %i\n"
+          "    Weight = %03li\t FirstChar = %i\t AveCharWidth = %li\n"
+          "    Italic = % 3i\t LastChar = %i\t\t MaxCharWidth = %li\n"
+          "    UnderLined = %01i\t DefaultChar = %i\t Overhang = %li\n"
+          "    StruckOut = %01i\t BreakChar = %i\t CharSet = %i\n"
           "    PitchAndFamily = %02x\n"
           "    --------------------\n"
           "    InternalLeading = %li\n"
@@ -1239,18 +1251,6 @@
 
 
 /***********************************************************************
- *           GetTextMetricsW    (GDI32.@)
- */
-BOOL WINAPI GetTextMetricsW( HDC hdc, TEXTMETRICW *metrics )
-{
-    TEXTMETRICA tm;
-    if (!GetTextMetricsA( (HDC16)hdc, &tm )) return FALSE;
-    FONT_TextMetricAToW( &tm, metrics );
-    return TRUE;
-}
-
-
-/***********************************************************************
  * GetOutlineTextMetrics16 [GDI.308]  Gets metrics for TrueType fonts.
  *
  * NOTES


More information about the wine-patches mailing list