Commit a1a02efe authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Freetype: regroup functions

parent e09289ed
......@@ -861,42 +861,6 @@ static inline int RenderAXYZ( filter_t *p_filter,
return VLC_SUCCESS;
}
static FT_Face LoadEmbeddedFace( filter_sys_t *p_sys, const char *psz_fontname,
const text_style_t *p_style )
{
for( int k = 0; k < p_sys->i_font_attachments; k++ )
{
input_attachment_t *p_attach = p_sys->pp_font_attachments[k];
int i_font_idx = 0;
FT_Face p_face = NULL;
while( 0 == FT_New_Memory_Face( p_sys->p_library,
p_attach->p_data,
p_attach->i_data,
i_font_idx,
&p_face ))
{
if( p_face )
{
int i_style_received = ((p_face->style_flags & FT_STYLE_FLAG_BOLD) ? STYLE_BOLD : 0) |
((p_face->style_flags & FT_STYLE_FLAG_ITALIC ) ? STYLE_ITALIC : 0);
if( p_face->family_name != NULL
&& !strcasecmp( p_face->family_name, psz_fontname )
&& (p_style->i_style_flags & (STYLE_BOLD | STYLE_ITALIC))
== i_style_received )
return p_face;
FT_Done_Face( p_face );
}
i_font_idx++;
}
}
return NULL;
}
static void FillDefaultStyles( filter_t *p_filter )
{
filter_sys_t *p_sys = p_filter->p_sys;
......@@ -931,6 +895,7 @@ static void FillDefaultStyles( filter_t *p_filter )
/* Apply forced styles to defaults, if any */
text_style_Merge( p_sys->p_default_style, p_sys->p_forced_style, true );
}
static uni_char_t* SegmentsToTextAndStyles( filter_t *p_filter, const text_segment_t *p_segment, size_t *pi_string_length, const text_style_t ***ppp_styles)
{
const text_style_t **pp_styles = NULL;
......@@ -1367,6 +1332,39 @@ bool FaceStyleEquals( const text_style_t *p_style1,
!strcmp( p_style1->psz_fontname, p_style2->psz_fontname );
}
static FT_Face LoadEmbeddedFace( filter_sys_t *p_sys, const char *psz_fontname,
const text_style_t *p_style )
{
for( int k = 0; k < p_sys->i_font_attachments; k++ )
{
input_attachment_t *p_attach = p_sys->pp_font_attachments[k];
int i_font_idx = 0;
FT_Face p_face = NULL;
while( 0 == FT_New_Memory_Face( p_sys->p_library,
p_attach->p_data,
p_attach->i_data,
i_font_idx,
&p_face ))
{
if( p_face )
{
int i_style_received = ((p_face->style_flags & FT_STYLE_FLAG_BOLD) ? STYLE_BOLD : 0) |
((p_face->style_flags & FT_STYLE_FLAG_ITALIC ) ? STYLE_ITALIC : 0);
if( p_face->family_name != NULL
&& !strcasecmp( p_face->family_name, psz_fontname )
&& (p_style->i_style_flags & (STYLE_BOLD | STYLE_ITALIC))
== i_style_received )
return p_face;
FT_Done_Face( p_face );
}
i_font_idx++;
}
}
return NULL;
}
FT_Face LoadFace( filter_t *p_filter,
const text_style_t *p_style )
{
......
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