Nikolay Sivov : dwrite: Use per-instance font object for GetGlyphCount().

Alexandre Julliard julliard at winehq.org
Thu Dec 2 15:30:17 CST 2021


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Dec  2 15:37:16 2021 +0300

dwrite: Use per-instance font object for GetGlyphCount().

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dwrite/dwrite_private.h |  2 +-
 dlls/dwrite/font.c           |  4 +++-
 dlls/dwrite/freetype.c       | 15 ++++-----------
 3 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h
index 9735ffd2605..75bc1be902a 100644
--- a/dlls/dwrite/dwrite_private.h
+++ b/dlls/dwrite/dwrite_private.h
@@ -743,7 +743,7 @@ struct font_backend_funcs
     void (CDECL *notify_release)(void *key);
     int (CDECL *get_glyph_outline)(void *key, float em_size, unsigned int simulations, UINT16 glyph,
             struct dwrite_outline *outline);
-    UINT16 (CDECL *get_glyph_count)(void *key);
+    UINT16 (CDECL *get_glyph_count)(font_object_handle object);
     INT32 (CDECL *get_glyph_advance)(void *key, float em_size, UINT16 index, DWRITE_MEASURING_MODE measuring_mode,
             BOOL *has_contours);
     void (CDECL *get_glyph_bbox)(struct dwrite_glyphbitmap *bitmap_desc);
diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c
index 85868c6bfd8..5f4f5587a62 100644
--- a/dlls/dwrite/font.c
+++ b/dlls/dwrite/font.c
@@ -734,9 +734,11 @@ static void WINAPI dwritefontface_GetMetrics(IDWriteFontFace5 *iface, DWRITE_FON
 
 static UINT16 WINAPI dwritefontface_GetGlyphCount(IDWriteFontFace5 *iface)
 {
+    struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface);
+
     TRACE("%p.\n", iface);
 
-    return font_funcs->get_glyph_count(iface);
+    return font_funcs->get_glyph_count(fontface->get_font_object(fontface));
 }
 
 static HRESULT WINAPI dwritefontface_GetDesignGlyphMetrics(IDWriteFontFace5 *iface,
diff --git a/dlls/dwrite/freetype.c b/dlls/dwrite/freetype.c
index 5c32ec725f6..6b566649edc 100644
--- a/dlls/dwrite/freetype.c
+++ b/dlls/dwrite/freetype.c
@@ -527,17 +527,10 @@ static int CDECL freetype_get_glyph_outline(void *key, float emSize, unsigned in
     return ret;
 }
 
-static UINT16 CDECL freetype_get_glyph_count(void *key)
+static UINT16 CDECL freetype_get_glyph_count(font_object_handle object)
 {
-    UINT16 count = 0;
-    FT_Face face;
-
-    RtlEnterCriticalSection(&freetype_cs);
-    if (pFTC_Manager_LookupFace(cache_manager, key, &face) == 0)
-        count = face->num_glyphs;
-    RtlLeaveCriticalSection(&freetype_cs);
-
-    return count;
+    FT_Face face = object;
+    return face ? face->num_glyphs : 0;
 }
 
 static inline void ft_matrix_from_dwrite_matrix(const DWRITE_MATRIX *m, FT_Matrix *ft_matrix)
@@ -844,7 +837,7 @@ static int CDECL null_get_glyph_outline(void *key, float emSize, unsigned int si
     return 1;
 }
 
-static UINT16 CDECL null_get_glyph_count(void *key)
+static UINT16 CDECL null_get_glyph_count(font_object_handle object)
 {
     return 0;
 }




More information about the wine-cvs mailing list