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

Jean-Baptiste Kempf jb at videolan.org
Thu Oct 19 18:34:42 CEST 2017


---
 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..ce9ab767ae 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";
+
+    // Android 5.0+
+    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 */
-- 
2.15.0.rc1.287.g2b38de12cc



More information about the vlc-devel mailing list