Commit 37494499 authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent 85458d80
......@@ -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;
}
......
......@@ -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)
......@@ -6745,24 +6749,6 @@ static DWORD get_font_unicode_ranges(FT_Face face, GLYPHSET *gs)
}
/*************************************************************
* 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
*/
static BOOL CDECL freetype_FontIsLinked( struct gdi_font *font )
......@@ -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,
......
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment