Commit 8ea8e3aa authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Freetype renderer: cosmetics

parent d610defd
...@@ -283,7 +283,6 @@ struct filter_sys_t ...@@ -283,7 +283,6 @@ struct filter_sys_t
input_attachment_t **pp_font_attachments; input_attachment_t **pp_font_attachments;
int i_font_attachments; int i_font_attachments;
}; };
#define UCHAR uint32_t #define UCHAR uint32_t
...@@ -301,14 +300,15 @@ static int Create( vlc_object_t *p_this ) ...@@ -301,14 +300,15 @@ static int Create( vlc_object_t *p_this )
{ {
filter_t *p_filter = (filter_t *)p_this; filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys; filter_sys_t *p_sys;
char *psz_fontfile=NULL; char *psz_fontfile = NULL;
char *psz_fontfamily=NULL; char *psz_fontfamily = NULL;
int i_error,fontindex; int i_error, fontindex;
/* Allocate structure */ /* Allocate structure */
p_filter->p_sys = p_sys = malloc( sizeof( filter_sys_t ) ); p_filter->p_sys = p_sys = malloc( sizeof( filter_sys_t ) );
if( !p_sys ) if( !p_sys )
return VLC_ENOMEM; return VLC_ENOMEM;
#ifdef HAVE_STYLES #ifdef HAVE_STYLES
p_sys->psz_fontfamily = NULL; p_sys->psz_fontfamily = NULL;
p_sys->p_xml = NULL; p_sys->p_xml = NULL;
...@@ -329,7 +329,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -329,7 +329,7 @@ static int Create( vlc_object_t *p_this )
p_sys->i_font_color = var_InheritInteger( p_filter, "freetype-color" ); p_sys->i_font_color = var_InheritInteger( p_filter, "freetype-color" );
p_sys->i_font_color = __MAX( __MIN( p_sys->i_font_color , 0xFFFFFF ), 0 ); p_sys->i_font_color = __MAX( __MIN( p_sys->i_font_color , 0xFFFFFF ), 0 );
fontindex=0; /* Set default psz_fontfamily */
if( !psz_fontfamily || !*psz_fontfamily ) if( !psz_fontfamily || !*psz_fontfamily )
{ {
free( psz_fontfamily ); free( psz_fontfamily );
...@@ -340,7 +340,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -340,7 +340,7 @@ static int Create( vlc_object_t *p_this )
if( !psz_fontfamily ) if( !psz_fontfamily )
goto error; goto error;
# ifdef WIN32 # ifdef WIN32
GetWindowsDirectory( psz_fontfamily , PATH_MAX + 1 ); GetWindowsDirectory( psz_fontfamily, PATH_MAX + 1 );
strcat( psz_fontfamily, "\\fonts\\arial.ttf" ); strcat( psz_fontfamily, "\\fonts\\arial.ttf" );
# else # else
strcpy( psz_fontfamily, DEFAULT_FONT ); strcpy( psz_fontfamily, DEFAULT_FONT );
...@@ -349,6 +349,8 @@ static int Create( vlc_object_t *p_this ) ...@@ -349,6 +349,8 @@ static int Create( vlc_object_t *p_this )
#endif #endif
} }
/* Set the font file */
fontindex = 0;
#ifdef HAVE_FONTCONFIG #ifdef HAVE_FONTCONFIG
if( FontConfig_FindFont( p_filter, psz_fontfamily, &psz_fontfile, &fontindex ) if( FontConfig_FindFont( p_filter, psz_fontfamily, &psz_fontfile, &fontindex )
!= VLC_SUCCESS ) != VLC_SUCCESS )
...@@ -357,6 +359,7 @@ static int Create( vlc_object_t *p_this ) ...@@ -357,6 +359,7 @@ static int Create( vlc_object_t *p_this )
psz_fontfile = psz_fontfamily; psz_fontfile = psz_fontfamily;
#endif #endif
/* */
i_error = FT_Init_FreeType( &p_sys->p_library ); i_error = FT_Init_FreeType( &p_sys->p_library );
if( i_error ) if( i_error )
{ {
...@@ -2138,7 +2141,7 @@ static int RenderHtml( filter_t *p_filter, subpicture_region_t *p_region_out, ...@@ -2138,7 +2141,7 @@ static int RenderHtml( filter_t *p_filter, subpicture_region_t *p_region_out,
uint32_t *pi_k_run_lengths = NULL; uint32_t *pi_k_run_lengths = NULL;
uint32_t *pi_k_durations = NULL; uint32_t *pi_k_durations = NULL;
ft_style_t **pp_styles = NULL; ft_style_t **pp_styles = NULL;
FT_Vector result; FT_Vector result = {0, 0};
line_desc_t *p_lines = NULL; line_desc_t *p_lines = NULL;
psz_text = (uint32_t *)malloc( strlen( p_region_in->psz_html ) * psz_text = (uint32_t *)malloc( strlen( p_region_in->psz_html ) *
......
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