From 9e78b82d1b8eaa02309d220d995db199e9e040fe Mon Sep 17 00:00:00 2001 From: Po Lu Date: Mon, 9 Oct 2023 09:30:56 +0800 Subject: [PATCH] Update default font substitution list * src/sfntfont-android.c (init_sfntfont_android): Account for Android 4.x not distributing Noto Serif. --- src/sfntfont-android.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/sfntfont-android.c b/src/sfntfont-android.c index be75c2d9e22..e49615210eb 100644 --- a/src/sfntfont-android.c +++ b/src/sfntfont-android.c @@ -746,13 +746,19 @@ syms_of_sfntfont_android_for_pdumper (void) void init_sfntfont_android (void) { + int api_level; + if (!android_init_gui) return; + api_level = android_get_current_api_level (); + /* Make sure to pick the proper Sans Serif and Serif fonts for the version of Android the device is running. */ - if (android_get_current_api_level () >= 15) + if (api_level >= 21) + /* Android 5.0 and later distribute Noto Serif in lieu of Droid + Serif. */ Vsfnt_default_family_alist = list4 (Fcons (build_string ("Monospace"), build_string ("Droid Sans Mono")), @@ -764,6 +770,20 @@ init_sfntfont_android (void) build_string ("Roboto")), Fcons (build_string ("DejaVu Serif"), build_string ("Noto Serif"))); + else if (api_level >= 15) + /* Android 4.0 and later distribute Roboto in lieu of Droid + Sans. */ + Vsfnt_default_family_alist + = list4 (Fcons (build_string ("Monospace"), + build_string ("Droid Sans Mono")), + /* Android doesn't come with a Monospace Serif font, so + this will have to do. */ + Fcons (build_string ("Monospace Serif"), + build_string ("Droid Sans Mono")), + Fcons (build_string ("Sans Serif"), + build_string ("Roboto")), + Fcons (build_string ("DejaVu Serif"), + build_string ("Droid Serif"))); else Vsfnt_default_family_alist = list4 (Fcons (build_string ("Monospace"), -- 2.39.2