Alexandre Julliard : gdi32: Move part of the GetFontUnicodeRanges() implementation out of freetype.c.

Alexandre Julliard julliard at winehq.org
Wed Oct 28 15:58:17 CDT 2020


Module: wine
Branch: master
Commit: 374944994360590cea79ebd5da42bdaf9f092d90
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=374944994360590cea79ebd5da42bdaf9f092d90

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Oct 28 10:13:53 2020 +0100

gdi32: Move part of the GetFontUnicodeRanges() implementation out of freetype.c.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdi32/font.c        | 12 +++++++++++-
 dlls/gdi32/freetype.c    | 28 +++++++---------------------
 dlls/gdi32/gdi_private.h |  2 +-
 3 files changed, 19 insertions(+), 23 deletions(-)

diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index a587715d6c3..b74632c882b 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -1118,13 +1118,23 @@ static BOOL CDECL font_GetFontRealizationInfo( PHYSDEV dev, void *ptr )
 static DWORD CDECL font_GetFontUnicodeRanges( PHYSDEV dev, GLYPHSET *glyphset )
 {
     struct font_physdev *physdev = get_font_dev( dev );
+    DWORD size, num_ranges;
 
     if (!physdev->font)
     {
         dev = GET_NEXT_PHYSDEV( dev, pGetFontUnicodeRanges );
         return dev->funcs->pGetFontUnicodeRanges( dev, glyphset );
     }
-    return font_funcs->pGetFontUnicodeRanges( physdev->font, glyphset );
+
+    num_ranges = font_funcs->get_unicode_ranges( physdev->font, glyphset );
+    size = offsetof( GLYPHSET, ranges[num_ranges] );
+    if (glyphset)
+    {
+        glyphset->cbThis = size;
+        glyphset->cRanges = num_ranges;
+        glyphset->flAccel = 0;
+    }
+    return size;
 }
 
 
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 3959261e609..1d076e77cf8 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -6680,12 +6680,16 @@ static BOOL CDECL freetype_GetCharWidthInfo( struct gdi_font *gdi_font, struct c
 }
 
 
-/* Retrieve a list of supported Unicode ranges for a given font.
+/*************************************************************
+ * freetype_get_unicode_ranges
+ *
+ * Retrieve a list of supported Unicode ranges for a given font.
  * Can be called with NULL gs to calculate the buffer size. Returns
  * the number of ranges found.
  */
-static DWORD get_font_unicode_ranges(FT_Face face, GLYPHSET *gs)
+static DWORD CDECL freetype_get_unicode_ranges( struct gdi_font *font, GLYPHSET *gs )
 {
+    FT_Face face = get_font_ptr(font)->ft_face;
     DWORD num_ranges = 0;
 
     if (face->charmap->encoding == FT_ENCODING_UNICODE)
@@ -6744,24 +6748,6 @@ static DWORD get_font_unicode_ranges(FT_Face face, GLYPHSET *gs)
     return num_ranges;
 }
 
-/*************************************************************
- * freetype_GetFontUnicodeRanges
- */
-static DWORD CDECL freetype_GetFontUnicodeRanges( struct gdi_font *font, GLYPHSET *glyphset )
-{
-    DWORD size, num_ranges;
-
-    num_ranges = get_font_unicode_ranges(get_font_ptr(font)->ft_face, glyphset);
-    size = sizeof(GLYPHSET) + sizeof(WCRANGE) * (num_ranges - 1);
-    if (glyphset)
-    {
-        glyphset->cbThis = size;
-        glyphset->cRanges = num_ranges;
-        glyphset->flAccel = 0;
-    }
-    return size;
-}
-
 /*************************************************************
  * freetype_FontIsLinked
  */
@@ -6988,7 +6974,6 @@ static const struct font_backend_funcs font_funcs =
     freetype_EnumFonts,
     freetype_FontIsLinked,
     freetype_GetCharWidthInfo,
-    freetype_GetFontUnicodeRanges,
     freetype_SelectFont,
     freetype_add_font,
     freetype_add_mem_font,
@@ -6998,6 +6983,7 @@ static const struct font_backend_funcs font_funcs =
     freetype_get_glyph_index,
     freetype_get_default_glyph,
     freetype_get_glyph_outline,
+    freetype_get_unicode_ranges,
     freetype_set_outline_text_metrics,
     freetype_set_bitmap_text_metrics,
     freetype_get_kerning_pairs,
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index 6b37cf598e9..e180121ae40 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -367,7 +367,6 @@ struct font_backend_funcs
     BOOL  (CDECL *pEnumFonts)( LOGFONTW *lf, FONTENUMPROCW proc, LPARAM lparam );
     BOOL  (CDECL *pFontIsLinked)( struct gdi_font *font );
     BOOL  (CDECL *pGetCharWidthInfo)( struct gdi_font *font, struct char_width_info *info );
-    DWORD (CDECL *pGetFontUnicodeRanges)( struct gdi_font *font, GLYPHSET *glyphset );
     struct gdi_font * (CDECL *pSelectFont)( DC *dc, HFONT hfont, UINT *aa_flags, UINT default_aa_flags );
 
     INT   (CDECL *add_font)( const WCHAR *file, DWORD flags );
@@ -381,6 +380,7 @@ struct font_backend_funcs
     UINT  (CDECL *get_default_glyph)( struct gdi_font *gdi_font );
     DWORD (CDECL *get_glyph_outline)( struct gdi_font *font, UINT glyph, UINT format,
                                       GLYPHMETRICS *gm, ABC *abc, DWORD buflen, void *buf, const MAT2 *mat );
+    DWORD (CDECL *get_unicode_ranges)( struct gdi_font *font, GLYPHSET *gs );
     BOOL  (CDECL *set_outline_text_metrics)( struct gdi_font *font );
     BOOL  (CDECL *set_bitmap_text_metrics)( struct gdi_font *font );
     DWORD (CDECL *get_kerning_pairs)( struct gdi_font *gdi_font, KERNINGPAIR **kern_pair );




More information about the wine-cvs mailing list