diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h index 9735ffd260551450fa6aab29f81dbdff472d7b50..75bc1be902aa569d65469662b70c238f3831085f 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 85868c6bfd8da77793658b7d107b99d8bacf4539..5f4f5587a629931d1cf7cf54a8910ab5adc67801 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 5c32ec725f66def8a4e3b838d1c0f1d5e1e2b408..6b566649edc83bf34f39fe34f160c4156dcaef14 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; }