Jeff Latimer : gdi: Added implementation of GetCharABCWidthsI.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Apr 19 13:15:21 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 07767bfd28ba6fc3a2e6a8af2e9fd76a4e9f3864
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=07767bfd28ba6fc3a2e6a8af2e9fd76a4e9f3864

Author: Jeff Latimer <lats at yless4u.com.au>
Date:   Wed Apr 19 19:20:50 2006 +1000

gdi: Added implementation of GetCharABCWidthsI.

---

 dlls/gdi/font.c        |   49 ++++++++++++++++++++++++++++++++++++++++++++++++
 dlls/gdi/freetype.c    |   38 +++++++++++++++++++++++++++++++++++++
 dlls/gdi/gdi32.spec    |    2 +-
 dlls/gdi/gdi_private.h |    2 ++
 include/wingdi.h       |    1 +
 5 files changed, 91 insertions(+), 1 deletions(-)

diff --git a/dlls/gdi/font.c b/dlls/gdi/font.c
index adc7e97..7d8782a 100644
--- a/dlls/gdi/font.c
+++ b/dlls/gdi/font.c
@@ -2358,6 +2358,55 @@ BOOL WINAPI GetCharABCWidthsW( HDC hdc, 
 }
 
 
+/******************************************************************************
+ * GetCharABCWidthsI [GDI32.@]
+ *
+ * Retrieves widths of characters in range.
+ *
+ * PARAMS
+ *    hdc       [I] Handle of device context
+ *    firstChar [I] First glyphs in range to query
+ *    count     [I] Last glyphs in range to query
+ *    pgi       [i] Array of glyphs to query
+ *    abc       [O] Address of character-width structure
+ *
+ * NOTES
+ *    Only works with TrueType fonts
+ *
+ * RETURNS
+ *    Success: TRUE
+ *    Failure: FALSE
+ */
+BOOL WINAPI GetCharABCWidthsI( HDC hdc, UINT firstChar, UINT count,
+                               LPWORD pgi, LPABC abc)
+{
+    DC *dc = DC_GetDCPtr(hdc);
+    unsigned int i;
+    BOOL ret = FALSE;
+
+    if (!dc) return FALSE;
+
+    if(dc->gdiFont)
+        ret = WineEngGetCharABCWidthsI( dc->gdiFont, firstChar, count, pgi, abc );
+    else
+        FIXME(": stub\n");
+
+    if (ret)
+    {
+        /* convert device units to logical */
+        for( i = firstChar; i <= count; i++, abc++ ) {
+            abc->abcA = INTERNAL_XDSTOWS(dc, abc->abcA);
+            abc->abcB = INTERNAL_XDSTOWS(dc, abc->abcB);
+            abc->abcC = INTERNAL_XDSTOWS(dc, abc->abcC);
+	}
+        ret = TRUE;
+    }
+
+    GDI_ReleaseObj(hdc);
+    return ret;
+}
+
+
 /***********************************************************************
  *           GetGlyphOutlineA    (GDI32.@)
  */
diff --git a/dlls/gdi/freetype.c b/dlls/gdi/freetype.c
index c0da05f..9546986 100644
--- a/dlls/gdi/freetype.c
+++ b/dlls/gdi/freetype.c
@@ -3809,6 +3809,44 @@ BOOL WineEngGetCharABCWidths(GdiFont fon
 }
 
 /*************************************************************
+ * WineEngGetCharABCWidthsI
+ *
+ */
+BOOL WineEngGetCharABCWidthsI(GdiFont font, UINT firstChar, UINT count, LPWORD pgi,
+			      LPABC buffer)
+{
+    UINT c;
+    GLYPHMETRICS gm;
+    FT_UInt glyph_index;
+    GdiFont linked_font;
+
+    if(!FT_IS_SCALABLE(font->ft_face))
+        return FALSE;
+
+    get_glyph_index_linked(font, 'a', &linked_font, &glyph_index);
+    if (!pgi)
+        for(c = firstChar; c < firstChar+count; c++) {
+            WineEngGetGlyphOutline(linked_font, c, GGO_METRICS | GGO_GLYPH_INDEX,
+                                   &gm, 0, NULL, NULL);
+            buffer[c - firstChar].abcA = linked_font->gm[c].lsb;
+            buffer[c - firstChar].abcB = linked_font->gm[c].bbx;
+            buffer[c - firstChar].abcC = linked_font->gm[c].adv - linked_font->gm[c].lsb 
+               - linked_font->gm[c].bbx;
+        }
+    else
+        for(c = 0; c < count; c++) {
+            WineEngGetGlyphOutline(linked_font, pgi[c], GGO_METRICS | GGO_GLYPH_INDEX,
+                                   &gm, 0, NULL, NULL);
+            buffer[c].abcA = linked_font->gm[pgi[c]].lsb;
+            buffer[c].abcB = linked_font->gm[pgi[c]].bbx;
+            buffer[c].abcC = linked_font->gm[pgi[c]].adv 
+               - linked_font->gm[pgi[c]].lsb - linked_font->gm[pgi[c]].bbx;
+        }
+
+    return TRUE;
+}
+
+/*************************************************************
  * WineEngGetTextExtentPoint
  *
  */
diff --git a/dlls/gdi/gdi32.spec b/dlls/gdi/gdi32.spec
index c71adc6..59c748d 100644
--- a/dlls/gdi/gdi32.spec
+++ b/dlls/gdi/gdi32.spec
@@ -237,7 +237,7 @@ # @ stub GetBrushAttributes
 @ stdcall GetCharABCWidthsA(long long long ptr)
 @ stdcall GetCharABCWidthsFloatA(long long long ptr)
 @ stdcall GetCharABCWidthsFloatW(long long long ptr)
-# @ stub GetCharABCWidthsI
+@ stdcall GetCharABCWidthsI(long long long ptr ptr)
 @ stdcall GetCharABCWidthsW(long long long ptr)
 @ stdcall GetCharWidth32A(long long long long)
 @ stdcall GetCharWidth32W(long long long long)
diff --git a/dlls/gdi/gdi_private.h b/dlls/gdi/gdi_private.h
index dc85d35..dfdb008 100644
--- a/dlls/gdi/gdi_private.h
+++ b/dlls/gdi/gdi_private.h
@@ -367,6 +367,8 @@ extern BOOL WineEngDestroyFontInstance(H
 extern DWORD WineEngEnumFonts(LPLOGFONTW, FONTENUMPROCW, LPARAM);
 extern BOOL WineEngGetCharABCWidths(GdiFont font, UINT firstChar,
                                     UINT lastChar, LPABC buffer);
+extern BOOL WineEngGetCharABCWidthsI(GdiFont font, UINT firstChar,
+                                    UINT count, LPWORD pgi, LPABC buffer);
 extern BOOL WineEngGetCharWidth(GdiFont, UINT, UINT, LPINT);
 extern DWORD WineEngGetFontData(GdiFont, DWORD, DWORD, LPVOID, DWORD);
 extern DWORD WineEngGetGlyphIndices(GdiFont font, LPCWSTR lpstr, INT count,
diff --git a/include/wingdi.h b/include/wingdi.h
index b4ea1b5..9375ff9 100644
--- a/include/wingdi.h
+++ b/include/wingdi.h
@@ -3394,6 +3394,7 @@ #define     GetCharABCWidths WINELIB_NAM
 BOOL      WINAPI GetCharABCWidthsFloatA(HDC,UINT,UINT,LPABCFLOAT);
 BOOL      WINAPI GetCharABCWidthsFloatW(HDC,UINT,UINT,LPABCFLOAT);
 #define     GetCharABCWidthsFloat WINELIB_NAME_AW(GetCharABCWidthsFloat)
+BOOL        WINAPI GetCharABCWidthsI(HDC,UINT,UINT,LPWORD,LPABC);
 DWORD     WINAPI GetCharacterPlacementA(HDC,LPCSTR,INT,INT,GCP_RESULTSA*,DWORD);
 DWORD     WINAPI GetCharacterPlacementW(HDC,LPCWSTR,INT,INT,GCP_RESULTSW*,DWORD);
 #define     GetCharacterPlacement WINELIB_NAME_AW(GetCharacterPlacement)




More information about the wine-cvs mailing list