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

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-10-28 10:14:01 +01:00
parent 3749449943
commit 72272d0088
3 changed files with 16 additions and 16 deletions

View File

@ -1053,13 +1053,19 @@ static BOOL CDECL font_GetCharWidth( PHYSDEV dev, UINT first, UINT last, INT *bu
static BOOL CDECL font_GetCharWidthInfo( PHYSDEV dev, void *ptr )
{
struct font_physdev *physdev = get_font_dev( dev );
struct char_width_info *info = ptr;
if (!physdev->font)
{
dev = GET_NEXT_PHYSDEV( dev, pGetCharWidthInfo );
return dev->funcs->pGetCharWidthInfo( dev, ptr );
}
return font_funcs->pGetCharWidthInfo( physdev->font, ptr );
info->unk = 0;
if (!physdev->font->scalable || !font_funcs->get_char_width_info( physdev->font, info ))
info->lsb = info->rsb = 0;
return TRUE;
}

View File

@ -6654,29 +6654,23 @@ done:
}
/*************************************************************
* freetype_GetCharWidthInfo
* freetype_get_char_width_info
*/
static BOOL CDECL freetype_GetCharWidthInfo( struct gdi_font *gdi_font, struct char_width_info *info )
static BOOL CDECL freetype_get_char_width_info( struct gdi_font *font, struct char_width_info *info )
{
GdiFont *font = get_font_ptr(gdi_font);
FT_Face face = get_font_ptr(font)->ft_face;
TT_HoriHeader *pHori;
TRACE("%p, %p\n", font, info);
if (gdi_font->scalable &&
(pHori = pFT_Get_Sfnt_Table(font->ft_face, ft_sfnt_hhea)))
if ((pHori = pFT_Get_Sfnt_Table(face, ft_sfnt_hhea)))
{
FT_Fixed em_scale;
em_scale = MulDiv(gdi_font->ppem, 1 << 16, font->ft_face->units_per_EM);
FT_Fixed em_scale = MulDiv(font->ppem, 1 << 16, face->units_per_EM);
info->lsb = (SHORT)pFT_MulFix(pHori->min_Left_Side_Bearing, em_scale);
info->rsb = (SHORT)pFT_MulFix(pHori->min_Right_Side_Bearing, em_scale);
}
else
info->lsb = info->rsb = 0;
info->unk = 0;
return TRUE;
}
return FALSE;
}
@ -6973,7 +6967,6 @@ static const struct font_backend_funcs font_funcs =
{
freetype_EnumFonts,
freetype_FontIsLinked,
freetype_GetCharWidthInfo,
freetype_SelectFont,
freetype_add_font,
freetype_add_mem_font,
@ -6984,6 +6977,7 @@ static const struct font_backend_funcs font_funcs =
freetype_get_default_glyph,
freetype_get_glyph_outline,
freetype_get_unicode_ranges,
freetype_get_char_width_info,
freetype_set_outline_text_metrics,
freetype_set_bitmap_text_metrics,
freetype_get_kerning_pairs,

View File

@ -366,7 +366,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 );
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
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 *get_char_width_info)( struct gdi_font *font, struct char_width_info *info );
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 );