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

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-12-02 15:37:16 +03:00 committed by Alexandre Julliard
parent 7639820cfb
commit 822a49d524
3 changed files with 8 additions and 13 deletions

View File

@ -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);

View File

@ -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,

View File

@ -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;
}