Commit 2b526db0 authored by Salah-Eddin Shaban's avatar Salah-Eddin Shaban Committed by Jean-Baptiste Kempf

freetype: avoid redundant calls to FT_Set_Pixel_Sizes()

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 537d4556
......@@ -1442,6 +1442,17 @@ FT_Face LoadFace( filter_t *p_filter,
return NULL;
}
int i_font_width = p_style->i_style_flags & STYLE_HALFWIDTH
? p_style->i_font_size / 2 : p_style->i_font_size;
if( FT_Set_Pixel_Sizes( p_face, i_font_width, p_style->i_font_size ) )
{
msg_Err( p_filter,
"Failed to set font size to %d", p_style->i_font_size );
FT_Done_Face( p_face );
return NULL;
}
if( p_cache->i_faces_count == p_cache->i_cache_size )
{
FT_Face *p_new_faces =
......
......@@ -517,19 +517,16 @@ static int ShapeParagraphHarfBuzz( filter_t *p_filter,
{
p_face = LoadFace( p_filter, p_style );
if( !p_face )
{
p_face = p_sys->p_face;
p_style = &p_sys->style;
p_run->p_style = p_style;
}
p_run->p_face = p_face;
}
else
p_face = p_run->p_face;
int i_font_width = p_style->i_style_flags & STYLE_HALFWIDTH
? p_style->i_font_size / 2 : p_style->i_font_size;
if( FT_Set_Pixel_Sizes( p_face, i_font_width, p_style->i_font_size ) )
msg_Err( p_filter,
"Failed to set font size to %d", p_style->i_font_size );
p_run->p_hb_font = hb_ft_font_create( p_face, 0 );
if( !p_run->p_hb_font )
{
......@@ -773,24 +770,21 @@ static int LoadGlyphs( filter_t *p_filter, paragraph_t *p_paragraph,
run_desc_t *p_run = p_paragraph->p_runs + i;
text_style_t *p_style = p_run->p_style;
FT_Face p_face;
FT_Face p_face = 0;
if( !p_run->p_face )
{
p_face = LoadFace( p_filter, p_style );
if( !p_face )
{
p_face = p_sys->p_face;
p_style = &p_sys->style;
p_run->p_style = p_style;
}
p_run->p_face = p_face;
}
else
p_face = p_run->p_face;
int i_font_width = p_style->i_style_flags & STYLE_HALFWIDTH ?
p_style->i_font_size / 2 : p_style->i_font_size;
if( FT_Set_Pixel_Sizes( p_face, i_font_width, p_style->i_font_size ) )
msg_Err( p_filter,
"Failed to set font size to %d", p_style->i_font_size );
if( p_sys->p_stroker )
{
double f_outline_thickness =
......
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