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

Alexandre Julliard julliard at winehq.org
Tue Oct 25 13:50:29 CDT 2011


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Oct 20 16:30:32 2011 +0200

gdi32: Implement GetGlyphIndices as a standard driver entry point.

---

 dlls/gdi32/font.c        |    8 ++++----
 dlls/gdi32/freetype.c    |   31 +++++++++++++++----------------
 dlls/gdi32/gdi_private.h |    2 --
 3 files changed, 19 insertions(+), 22 deletions(-)

diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 72490c9..8fa9173 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -2837,16 +2837,16 @@ DWORD WINAPI GetGlyphIndicesW(HDC hdc, LPCWSTR lpstr, INT count,
 			      LPWORD pgi, DWORD flags)
 {
     DC *dc = get_dc_ptr(hdc);
-    DWORD ret = GDI_ERROR;
+    PHYSDEV dev;
+    DWORD ret;
 
     TRACE("(%p, %s, %d, %p, 0x%x)\n",
           hdc, debugstr_wn(lpstr, count), count, pgi, flags);
 
     if(!dc) return GDI_ERROR;
 
-    if(dc->gdiFont)
-	ret = WineEngGetGlyphIndices(dc->gdiFont, lpstr, count, pgi, flags);
-
+    dev = GET_DC_PHYSDEV( dc, pGetGlyphIndices );
+    ret = dev->funcs->pGetGlyphIndices( dev, lpstr, count, pgi, flags );
     release_dc_ptr( dc );
     return ret;
 }
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 11245d6..da9de0d 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -4947,16 +4947,21 @@ static FT_UInt get_glyph_index(const GdiFont *font, UINT glyph)
 }
 
 /*************************************************************
- * WineEngGetGlyphIndices
- *
+ * freetype_GetGlyphIndices
  */
-DWORD WineEngGetGlyphIndices(GdiFont *font, LPCWSTR lpstr, INT count,
-				LPWORD pgi, DWORD flags)
+static DWORD freetype_GetGlyphIndices( PHYSDEV dev, LPCWSTR lpstr, INT count, LPWORD pgi, DWORD flags )
 {
+    struct freetype_physdev *physdev = get_freetype_dev( dev );
     int i;
     WORD default_char;
     BOOL got_default = FALSE;
 
+    if (!physdev->font)
+    {
+        dev = GET_NEXT_PHYSDEV( dev, pGetGlyphIndices );
+        return dev->funcs->pGetGlyphIndices( dev, lpstr, count, pgi, flags );
+    }
+
     if (flags & GGI_MARK_NONEXISTING_GLYPHS)
     {
         default_char = 0xffff;  /* XP would use 0x1f for bitmap fonts */
@@ -4968,20 +4973,20 @@ DWORD WineEngGetGlyphIndices(GdiFont *font, LPCWSTR lpstr, INT count,
 
     for(i = 0; i < count; i++)
     {
-        pgi[i] = get_glyph_index(font, lpstr[i]);
+        pgi[i] = get_glyph_index(physdev->font, lpstr[i]);
         if  (pgi[i] == 0)
         {
             if (!got_default)
             {
-                if (FT_IS_SFNT(font->ft_face))
+                if (FT_IS_SFNT(physdev->font->ft_face))
                 {
-                    TT_OS2 *pOS2 = pFT_Get_Sfnt_Table(font->ft_face, ft_sfnt_os2);
-                    default_char = (pOS2->usDefaultChar ? get_glyph_index(font, pOS2->usDefaultChar) : 0);
+                    TT_OS2 *pOS2 = pFT_Get_Sfnt_Table(physdev->font->ft_face, ft_sfnt_os2);
+                    default_char = (pOS2->usDefaultChar ? get_glyph_index(physdev->font, pOS2->usDefaultChar) : 0);
                 }
                 else
                 {
                     TEXTMETRICW textm;
-                    get_text_metrics(font, &textm);
+                    get_text_metrics(physdev->font, &textm);
                     default_char = textm.tmDefaultChar;
                 }
                 got_default = TRUE;
@@ -7083,7 +7088,7 @@ static const struct gdi_dc_funcs freetype_funcs =
     NULL,                               /* pGetDeviceGammaRamp */
     NULL,                               /* pGetFontData */
     freetype_GetFontUnicodeRanges,      /* pGetFontUnicodeRanges */
-    NULL,                               /* pGetGlyphIndices */
+    freetype_GetGlyphIndices,           /* pGetGlyphIndices */
     NULL,                               /* pGetGlyphOutline */
     NULL,                               /* pGetICMProfile */
     NULL,                               /* pGetImage */
@@ -7185,12 +7190,6 @@ BOOL WineEngDestroyFontInstance(HFONT hfont)
     return FALSE;
 }
 
-DWORD WineEngGetGlyphIndices(GdiFont *font, LPCWSTR lpstr, INT count,
-				LPWORD pgi, DWORD flags)
-{
-    return GDI_ERROR;
-}
-
 DWORD WineEngGetGlyphOutline(GdiFont *font, UINT glyph, UINT format,
 			     LPGLYPHMETRICS lpgm, DWORD buflen, LPVOID buf,
 			     const MAT2* lpmat)
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index 316e6a9..c09ecf1 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -293,8 +293,6 @@ extern INT WineEngAddFontResourceEx(LPCWSTR, DWORD, PVOID) DECLSPEC_HIDDEN;
 extern HANDLE WineEngAddFontMemResourceEx(PVOID, DWORD, PVOID, LPDWORD) DECLSPEC_HIDDEN;
 extern BOOL WineEngDestroyFontInstance(HFONT handle) DECLSPEC_HIDDEN;
 extern DWORD WineEngGetFontData(GdiFont*, DWORD, DWORD, LPVOID, DWORD) DECLSPEC_HIDDEN;
-extern DWORD WineEngGetGlyphIndices(GdiFont *font, LPCWSTR lpstr, INT count,
-                                    LPWORD pgi, DWORD flags) DECLSPEC_HIDDEN;
 extern DWORD WineEngGetGlyphOutline(GdiFont*, UINT glyph, UINT format,
                                     LPGLYPHMETRICS, DWORD buflen, LPVOID buf,
                                     const MAT2*) DECLSPEC_HIDDEN;




More information about the wine-cvs mailing list