PATCH: GetCharABCWidths

Marcus Meissner marcus at jet.franken.de
Sat Apr 21 03:38:00 CDT 2001


Hi,

This adds support for GetCharABCWidths*, by just setting A and C to 0 and
using the character width for B. 

Works just wonderful with the Invitation Demo of http://ms.demo.org/2001/
(available on http://ms.demo.org/2000/dl/ms2000.zip) which uses it to
display characters in DDRAW mode.

I also fixed the 32A -> 16 mapping code.

Ciao, Marcus

Changelog:
	Implemented GetCharABCWidths with GetCharWidth.

Index: objects/font.c
===================================================================
RCS file: /home/wine/wine/objects/font.c,v
retrieving revision 1.41
diff -u -r1.41 font.c
--- objects/font.c	2001/04/16 19:33:51	1.41
+++ objects/font.c	2001/04/21 09:37:10
@@ -1475,11 +1475,20 @@
 BOOL16 WINAPI GetCharABCWidths16( HDC16 hdc, UINT16 firstChar, UINT16 lastChar,
                                   LPABC16 abc )
 {
-    ABC abc32;
-    if (!GetCharABCWidthsA( hdc, firstChar, lastChar, &abc32 )) return FALSE;
-    abc->abcA = abc32.abcA;
-    abc->abcB = abc32.abcB;
-    abc->abcC = abc32.abcC;
+    LPABC	abc32 = HeapAlloc(GetProcessHeap(),0,sizeof(ABC)*(lastChar-firstChar+1));
+    int		i;
+
+    if (!GetCharABCWidthsA( hdc, firstChar, lastChar, abc32 )) {
+	HeapFree(GetProcessHeap(),0,abc32);
+	return FALSE;
+    }
+
+    for (i=firstChar;i<=lastChar;i++) {
+	abc[i-firstChar].abcA = abc32[i-firstChar].abcA;
+	abc[i-firstChar].abcB = abc32[i-firstChar].abcB;
+	abc[i-firstChar].abcC = abc32[i-firstChar].abcC;
+    }
+    HeapFree(GetProcessHeap(),0,abc32);
     return TRUE;
 }
 
@@ -1513,9 +1522,20 @@
 BOOL WINAPI GetCharABCWidthsW( HDC hdc, UINT firstChar, UINT lastChar,
                                    LPABC abc )
 {
-    /* No TrueType fonts in Wine so far */
-    FIXME("(%04x,%04x,%04x,%p): stub\n", hdc, firstChar, lastChar, abc);
-    return FALSE;
+    int		i;
+    LPINT	widths = HeapAlloc(GetProcessHeap(),0,(lastChar-firstChar+1)*sizeof(INT));
+
+    FIXME("(%04x,%04x,%04x,%p), returns slightly bogus values.\n", hdc, firstChar, lastChar, abc);
+
+    GetCharWidth32A(hdc,firstChar,lastChar,widths);
+
+    for (i=firstChar;i<=lastChar;i++) {
+	abc[i-firstChar].abcA = 0;	/* left distance */
+	abc[i-firstChar].abcB = widths[i-firstChar];/* width */
+	abc[i-firstChar].abcC = 0;	/* right distance */
+    }
+    HeapFree(GetProcessHeap(),0,widths);
+    return TRUE;
 }
 
 




More information about the wine-patches mailing list