Commit fd9e1612 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Use FT_MulDiv() instead of the kernel32 function.

parent 8768f605
...@@ -146,6 +146,7 @@ MAKE_FUNCPTR(FT_Library_Version); ...@@ -146,6 +146,7 @@ MAKE_FUNCPTR(FT_Library_Version);
MAKE_FUNCPTR(FT_Load_Glyph); MAKE_FUNCPTR(FT_Load_Glyph);
MAKE_FUNCPTR(FT_Load_Sfnt_Table); MAKE_FUNCPTR(FT_Load_Sfnt_Table);
MAKE_FUNCPTR(FT_Matrix_Multiply); MAKE_FUNCPTR(FT_Matrix_Multiply);
MAKE_FUNCPTR(FT_MulDiv);
#ifdef FT_MULFIX_INLINED #ifdef FT_MULFIX_INLINED
#define pFT_MulFix FT_MULFIX_INLINED #define pFT_MulFix FT_MULFIX_INLINED
#else #else
...@@ -1509,6 +1510,7 @@ static BOOL init_freetype(void) ...@@ -1509,6 +1510,7 @@ static BOOL init_freetype(void)
LOAD_FUNCPTR(FT_Load_Glyph) LOAD_FUNCPTR(FT_Load_Glyph)
LOAD_FUNCPTR(FT_Load_Sfnt_Table) LOAD_FUNCPTR(FT_Load_Sfnt_Table)
LOAD_FUNCPTR(FT_Matrix_Multiply) LOAD_FUNCPTR(FT_Matrix_Multiply)
LOAD_FUNCPTR(FT_MulDiv)
#ifndef FT_MULFIX_INLINED #ifndef FT_MULFIX_INLINED
LOAD_FUNCPTR(FT_MulFix) LOAD_FUNCPTR(FT_MulFix)
#endif #endif
...@@ -1635,11 +1637,9 @@ static LONG calc_ppem_for_height(FT_Face ft_face, LONG height) ...@@ -1635,11 +1637,9 @@ static LONG calc_ppem_for_height(FT_Face ft_face, LONG height)
if(height > 0) { if(height > 0) {
USHORT windescent = get_fixed_windescent(pOS2->usWinDescent); USHORT windescent = get_fixed_windescent(pOS2->usWinDescent);
if(pOS2->usWinAscent + windescent == 0) if(pOS2->usWinAscent + windescent == 0)
ppem = MulDiv(ft_face->units_per_EM, height, ppem = pFT_MulDiv(ft_face->units_per_EM, height, pHori->Ascender - pHori->Descender);
pHori->Ascender - pHori->Descender);
else else
ppem = MulDiv(ft_face->units_per_EM, height, ppem = pFT_MulDiv(ft_face->units_per_EM, height, pOS2->usWinAscent + windescent);
pOS2->usWinAscent + windescent);
if(ppem > MAX_PPEM) { if(ppem > MAX_PPEM) {
WARN("Ignoring too large height %d, ppem %d\n", height, ppem); WARN("Ignoring too large height %d, ppem %d\n", height, ppem);
ppem = 1; ppem = 1;
...@@ -2340,7 +2340,7 @@ static BOOL get_transform_matrices( struct gdi_font *font, BOOL vertical, const ...@@ -2340,7 +2340,7 @@ static BOOL get_transform_matrices( struct gdi_font *font, BOOL vertical, const
FT_Matrix rotation_mat; FT_Matrix rotation_mat;
FT_Vector angle; FT_Vector angle;
pFT_Vector_Unit( &angle, MulDiv( 1 << 16, font->lf.lfOrientation, 10 ) ); pFT_Vector_Unit( &angle, pFT_MulDiv( 1 << 16, font->lf.lfOrientation, 10 ) );
rotation_mat.xx = angle.x; rotation_mat.xx = angle.x;
rotation_mat.xy = -angle.y; rotation_mat.xy = -angle.y;
rotation_mat.yx = angle.y; rotation_mat.yx = angle.y;
...@@ -2401,7 +2401,7 @@ static BOOL get_bold_glyph_outline(FT_GlyphSlot glyph, LONG ppem, FT_Glyph_Metri ...@@ -2401,7 +2401,7 @@ static BOOL get_bold_glyph_outline(FT_GlyphSlot glyph, LONG ppem, FT_Glyph_Metri
if(!pFT_Outline_Embolden) if(!pFT_Outline_Embolden)
return FALSE; return FALSE;
strength = MulDiv(ppem, 1 << 6, 24); strength = pFT_MulDiv(ppem, 1 << 6, 24);
err = pFT_Outline_Embolden(&glyph->outline, strength); err = pFT_Outline_Embolden(&glyph->outline, strength);
if(err) { if(err) {
TRACE("FT_Ouline_Embolden returns %d\n", err); TRACE("FT_Ouline_Embolden returns %d\n", err);
...@@ -2452,8 +2452,7 @@ static FT_Vector get_advance_metric(struct gdi_font *incoming_font, struct gdi_f ...@@ -2452,8 +2452,7 @@ static FT_Vector get_advance_metric(struct gdi_font *incoming_font, struct gdi_f
if (freetype_set_outline_text_metrics(incoming_font) && if (freetype_set_outline_text_metrics(incoming_font) &&
!(incoming_font->otm.otmTextMetrics.tmPitchAndFamily & TMPF_FIXED_PITCH)) { !(incoming_font->otm.otmTextMetrics.tmPitchAndFamily & TMPF_FIXED_PITCH)) {
UINT avg_advance; UINT avg_advance;
em_scale = MulDiv(incoming_font->ppem, 1 << 16, em_scale = pFT_MulDiv(incoming_font->ppem, 1 << 16, get_ft_face(incoming_font)->units_per_EM);
get_ft_face(incoming_font)->units_per_EM);
avg_advance = pFT_MulFix(incoming_font->ntmAvgWidth, em_scale); avg_advance = pFT_MulFix(incoming_font->ntmAvgWidth, em_scale);
fixed_pitch_full = (avg_advance > 0 && fixed_pitch_full = (avg_advance > 0 &&
(base_advance + 63) >> 6 == (base_advance + 63) >> 6 ==
...@@ -3395,7 +3394,7 @@ static BOOL CDECL freetype_set_outline_text_metrics( struct gdi_font *font ) ...@@ -3395,7 +3394,7 @@ static BOOL CDECL freetype_set_outline_text_metrics( struct gdi_font *font )
strlenW( (WCHAR *)font->otm.otmpFaceName ) + 1 + strlenW( (WCHAR *)font->otm.otmpFaceName ) + 1 +
strlenW( (WCHAR *)font->otm.otmpFullName ) + 1) * sizeof(WCHAR); strlenW( (WCHAR *)font->otm.otmpFullName ) + 1) * sizeof(WCHAR);
em_scale = (FT_Fixed)MulDiv(font->ppem, 1 << 16, ft_face->units_per_EM); em_scale = (FT_Fixed)pFT_MulDiv(font->ppem, 1 << 16, ft_face->units_per_EM);
pOS2 = pFT_Get_Sfnt_Table(ft_face, ft_sfnt_os2); pOS2 = pFT_Get_Sfnt_Table(ft_face, ft_sfnt_os2);
if(!pOS2) { if(!pOS2) {
...@@ -3651,7 +3650,7 @@ static BOOL CDECL freetype_get_char_width_info( struct gdi_font *font, struct ch ...@@ -3651,7 +3650,7 @@ static BOOL CDECL freetype_get_char_width_info( struct gdi_font *font, struct ch
if ((pHori = pFT_Get_Sfnt_Table(ft_face, ft_sfnt_hhea))) if ((pHori = pFT_Get_Sfnt_Table(ft_face, ft_sfnt_hhea)))
{ {
FT_Fixed em_scale = MulDiv(font->ppem, 1 << 16, ft_face->units_per_EM); FT_Fixed em_scale = pFT_MulDiv(font->ppem, 1 << 16, 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; return TRUE;
......
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