Commit 0891ac62 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Freetype: fallback to arial.ttf on Win32

When we haven't found the right font, use arial.ttf

Close #4946
parent 4e27ee7b
...@@ -592,7 +592,6 @@ static char* Win32_Select( filter_t *p_filter, const char* family, ...@@ -592,7 +592,6 @@ static char* Win32_Select( filter_t *p_filter, const char* family,
bool b_bold, bool b_italic, int i_size, int *i_idx ) bool b_bold, bool b_italic, int i_size, int *i_idx )
{ {
VLC_UNUSED( i_size ); VLC_UNUSED( i_size );
// msg_Dbg( p_filter, "Here in Win32_Select, asking for %s", family );
/* */ /* */
LOGFONT lf; LOGFONT lf;
...@@ -609,13 +608,13 @@ static char* Win32_Select( filter_t *p_filter, const char* family, ...@@ -609,13 +608,13 @@ static char* Win32_Select( filter_t *p_filter, const char* family,
EnumFontFamiliesEx(hDC, &lf, (FONTENUMPROC)&EnumFontCallback, (LPARAM)&psz_filename, 0); EnumFontFamiliesEx(hDC, &lf, (FONTENUMPROC)&EnumFontCallback, (LPARAM)&psz_filename, 0);
ReleaseDC(NULL, hDC); ReleaseDC(NULL, hDC);
if( psz_filename == NULL ) /* */
return NULL; if( psz_filename != NULL )
{
/* FIXME: increase i_idx, when concatenated strings */ /* FIXME: increase i_idx, when concatenated strings */
i_idx = 0; i_idx = 0;
/* */ /* Prepend the Windows Font path, when only a filename was provided */
if( strchr( psz_filename, DIR_SEP_CHAR ) ) if( strchr( psz_filename, DIR_SEP_CHAR ) )
return psz_filename; return psz_filename;
else else
...@@ -629,10 +628,19 @@ static char* Win32_Select( filter_t *p_filter, const char* family, ...@@ -629,10 +628,19 @@ static char* Win32_Select( filter_t *p_filter, const char* family,
free( psz_filename ); free( psz_filename );
return psz_tmp; return psz_tmp;
} }
}
else /* Let's take any font we can */
{
char *psz_tmp;
if( asprintf( &psz_tmp, "%s\\%s", p_filter->p_sys->psz_win_fonts_path, "arial.ttf" ) == -1 )
return NULL;
else
return psz_tmp;
}
} }
#endif #endif /* HAVE_WIN32 */
#endif #endif /* HAVE_STYLES */
/***************************************************************************** /*****************************************************************************
......
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