Hans Leidekker : gdi32: Implement GetCharWidthI.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jan 2 14:17:29 CST 2007


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

Author: Hans Leidekker <hans at it.vu.nl>
Date:   Tue Jan  2 14:18:31 2007 +0100

gdi32: Implement GetCharWidthI.

---

 dlls/gdi32/font.c |   39 ++++++++++++++++++++++++++++++++++++---
 include/wingdi.h  |    1 +
 2 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index b92ea82..527a0d9 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -3186,11 +3186,44 @@ BOOL WINAPI EnableEUDC(BOOL fEnableEUDC)
 
 /***********************************************************************
  *           GetCharWidthI    (GDI32.@)
+ *
+ * Retrieve widths of characters.
+ *
+ * PARAMS
+ *  hdc    [I] Handle to a device context.
+ *  first  [I] First glyph in range to query.
+ *  count  [I] Number of glyph indices to query.
+ *  glyphs [I] Array of glyphs to query.
+ *  buffer [O] Buffer to receive character widths.
+ *
+ * NOTES
+ *  Only works with TrueType fonts.
+ *
+ * RETURNS
+ *  Success: TRUE
+ *  Failure: FALSE
  */
-BOOL WINAPI GetCharWidthI(HDC hdc, UINT giFirst, UINT cgi, LPWORD pgi, LPINT lpBuffer)
+BOOL WINAPI GetCharWidthI(HDC hdc, UINT first, UINT count, LPWORD glyphs, LPINT buffer)
 {
-    FIXME("(%p, %d, %d, %p, %p): stub\n", hdc, giFirst, cgi, pgi, lpBuffer);
-    return FALSE;
+    ABC *abc;
+    unsigned int i;
+
+    TRACE("(%p, %d, %d, %p, %p)\n", hdc, first, count, glyphs, buffer);
+
+    if (!(abc = HeapAlloc(GetProcessHeap(), 0, count * sizeof(ABC))))
+        return FALSE;
+
+    if (!GetCharABCWidthsI(hdc, first, count, glyphs, abc))
+    {
+        HeapFree(GetProcessHeap(), 0, abc);
+        return FALSE;
+    }
+
+    for (i = 0; i < count; i++)
+        buffer[i] = abc->abcA + abc->abcB + abc->abcC;
+
+    HeapFree(GetProcessHeap(), 0, abc);
+    return TRUE;
 }
 
 /***********************************************************************
diff --git a/include/wingdi.h b/include/wingdi.h
index 34b54eb..a357c77 100644
--- a/include/wingdi.h
+++ b/include/wingdi.h
@@ -3423,6 +3423,7 @@ BOOL        WINAPI GetCharWidth32A(HDC,U
 BOOL        WINAPI GetCharWidth32W(HDC,UINT,UINT,LPINT);
 #define     GetCharWidth32 WINELIB_NAME_AW(GetCharWidth32)
 BOOL        WINAPI GetCharWidthA(HDC,UINT,UINT,LPINT);
+BOOL        WINAPI GetCharWidthI(HDC,UINT,UINT,LPWORD,LPINT);
 BOOL        WINAPI GetCharWidthW(HDC,UINT,UINT,LPINT);
 #define     GetCharWidth WINELIB_NAME_AW(GetCharWidth)
 BOOL        WINAPI GetCharWidthFloatA(HDC,UINT,UINT,PFLOAT);




More information about the wine-cvs mailing list