[vlc-devel] [vlc-commits] libass: use Noto fonts on Android 5+

Zhao Zhili quinkblack at foxmail.com
Fri Oct 20 19:31:50 CEST 2017


> On 20 Oct 2017, at 3:37 PM, Jean-Baptiste Kempf <git at videolan.org> wrote:
> 
> vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Thu Oct 19 18:23:38 2017 +0200| [8a15910d9f8e7d860f29d0e9803c756970d8cf74] | committer: Jean-Baptiste Kempf
> 
> libass: use Noto fonts on Android 5+
> 
>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8a15910d9f8e7d860f29d0e9803c756970d8cf74
> ---
> 
> modules/codec/libass.c | 20 ++++++++++++++++++--
> 1 file changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/modules/codec/libass.c b/modules/codec/libass.c
> index 8a73497422..8004feb138 100644
> --- a/modules/codec/libass.c
> +++ b/modules/codec/libass.c
> @@ -212,8 +212,24 @@ static int Create( vlc_object_t *p_this )
>     ass_set_line_spacing( p_renderer, 0.0 );
> 
> #if defined( __ANDROID__ )
> -    const char *psz_font = "/system/fonts/DroidSans-Bold.ttf";
> -    const char *psz_family = "Droid Sans Bold";
> +    const char *psz_font, *psz_family;
> +    const char *psz_font_droid = "/system/fonts/DroidSans-Bold.ttf";
> +    const char *psz_family_droid = "Droid Sans Bold";
> +    const char *psz_font_noto = "/system/fonts/NotoSansCJK-Regular.ttc";
> +    const char *psz_family_noto = "Noto Sans";
> +
> +    // Workaround for Android 5.0+, since libass doesn't parse the XML yet
> +    if( access( psz_font_noto, R_OK ) != -1 )
> +    {
> +        psz_font = psz_font_noto;
> +        psz_family = psz_family_noto;
> +    }
> +    else
> +    {
> +        psz_font = psz_font_droid;
> +        psz_family = psz_family_droid;
> +    }
> +
> #elif defined( __APPLE__ )
>     const char *psz_font = NULL; /* We don't ship a default font with VLC */
>     const char *psz_family = "Helvetica Neue"; /* Use HN if we can't find anything more suitable - Arial is not on all Apple platforms */
> 
> _______________________________________________
> vlc-commits mailing list
> vlc-commits at videolan.org
> https://mailman.videolan.org/listinfo/vlc-commits

Should we add an option for font configuration? Too many Android devices have
all kinds of font files except a mandatory one (does that exist?), and the
mandatory one doesn't work so there are something like DroidSansChinese.ttf.





More information about the vlc-devel mailing list