Commit 72272d00 authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent 37494499
...@@ -1053,13 +1053,19 @@ static BOOL CDECL font_GetCharWidth( PHYSDEV dev, UINT first, UINT last, INT *bu ...@@ -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 ) static BOOL CDECL font_GetCharWidthInfo( PHYSDEV dev, void *ptr )
{ {
struct font_physdev *physdev = get_font_dev( dev ); struct font_physdev *physdev = get_font_dev( dev );
struct char_width_info *info = ptr;
if (!physdev->font) if (!physdev->font)
{ {
dev = GET_NEXT_PHYSDEV( dev, pGetCharWidthInfo ); dev = GET_NEXT_PHYSDEV( dev, pGetCharWidthInfo );
return dev->funcs->pGetCharWidthInfo( dev, ptr ); 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;
} }
......
...@@ -6654,29 +6654,23 @@ done: ...@@ -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; TT_HoriHeader *pHori;
TRACE("%p, %p\n", font, info); TRACE("%p, %p\n", font, info);
if (gdi_font->scalable && if ((pHori = pFT_Get_Sfnt_Table(face, ft_sfnt_hhea)))
(pHori = pFT_Get_Sfnt_Table(font->ft_face, ft_sfnt_hhea)))
{ {
FT_Fixed em_scale; FT_Fixed em_scale = MulDiv(font->ppem, 1 << 16, face->units_per_EM);
em_scale = MulDiv(gdi_font->ppem, 1 << 16, font->ft_face->units_per_EM);
info->lsb = (SHORT)pFT_MulFix(pHori->min_Left_Side_Bearing, em_scale); info->lsb = (SHORT)pFT_MulFix(pHori->min_Left_Side_Bearing, em_scale);
info->rsb = (SHORT)pFT_MulFix(pHori->min_Right_Side_Bearing, em_scale); info->rsb = (SHORT)pFT_MulFix(pHori->min_Right_Side_Bearing, em_scale);
return TRUE;
} }
else return FALSE;
info->lsb = info->rsb = 0;
info->unk = 0;
return TRUE;
} }
...@@ -6973,7 +6967,6 @@ static const struct font_backend_funcs font_funcs = ...@@ -6973,7 +6967,6 @@ static const struct font_backend_funcs font_funcs =
{ {
freetype_EnumFonts, freetype_EnumFonts,
freetype_FontIsLinked, freetype_FontIsLinked,
freetype_GetCharWidthInfo,
freetype_SelectFont, freetype_SelectFont,
freetype_add_font, freetype_add_font,
freetype_add_mem_font, freetype_add_mem_font,
...@@ -6984,6 +6977,7 @@ static const struct font_backend_funcs font_funcs = ...@@ -6984,6 +6977,7 @@ static const struct font_backend_funcs font_funcs =
freetype_get_default_glyph, freetype_get_default_glyph,
freetype_get_glyph_outline, freetype_get_glyph_outline,
freetype_get_unicode_ranges, freetype_get_unicode_ranges,
freetype_get_char_width_info,
freetype_set_outline_text_metrics, freetype_set_outline_text_metrics,
freetype_set_bitmap_text_metrics, freetype_set_bitmap_text_metrics,
freetype_get_kerning_pairs, freetype_get_kerning_pairs,
......
...@@ -366,7 +366,6 @@ struct font_backend_funcs ...@@ -366,7 +366,6 @@ struct font_backend_funcs
{ {
BOOL (CDECL *pEnumFonts)( LOGFONTW *lf, FONTENUMPROCW proc, LPARAM lparam ); BOOL (CDECL *pEnumFonts)( LOGFONTW *lf, FONTENUMPROCW proc, LPARAM lparam );
BOOL (CDECL *pFontIsLinked)( struct gdi_font *font ); 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 ); 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 ); INT (CDECL *add_font)( const WCHAR *file, DWORD flags );
...@@ -381,6 +380,7 @@ struct font_backend_funcs ...@@ -381,6 +380,7 @@ struct font_backend_funcs
DWORD (CDECL *get_glyph_outline)( struct gdi_font *font, UINT glyph, UINT format, DWORD (CDECL *get_glyph_outline)( struct gdi_font *font, UINT glyph, UINT format,
GLYPHMETRICS *gm, ABC *abc, DWORD buflen, void *buf, const MAT2 *mat ); GLYPHMETRICS *gm, ABC *abc, DWORD buflen, void *buf, const MAT2 *mat );
DWORD (CDECL *get_unicode_ranges)( struct gdi_font *font, GLYPHSET *gs ); 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_outline_text_metrics)( struct gdi_font *font );
BOOL (CDECL *set_bitmap_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 ); 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