From 0f50da67c08312027c52e1ea560de5a99c2e65d5 Mon Sep 17 00:00:00 2001 From: livecodepanos Date: Thu, 13 Aug 2020 16:41:15 +0300 Subject: [PATCH] [[ 14436 ]] Ensure valid custom fonts can be loaded on Android This patch makes the validity check for Android custom fonts less strict. Previously the code was allowing only fonts that had specific values for name_id, platform_id, encoding_id and language_id. This was too strict and resulted in valid fonts being rejected. The patched code only checks for name_id. --- docs/notes/bugfix-14436.md | 1 + engine/src/mblandroidfont.cpp | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 docs/notes/bugfix-14436.md diff --git a/docs/notes/bugfix-14436.md b/docs/notes/bugfix-14436.md new file mode 100644 index 00000000000..1c31eeb98e8 --- /dev/null +++ b/docs/notes/bugfix-14436.md @@ -0,0 +1 @@ +# Ensure valid custom fonts can be loaded on Android diff --git a/engine/src/mblandroidfont.cpp b/engine/src/mblandroidfont.cpp index 1ff48480e82..23a7d096958 100644 --- a/engine/src/mblandroidfont.cpp +++ b/engine/src/mblandroidfont.cpp @@ -457,9 +457,8 @@ static bool create_custom_font_from_path(MCStringRef p_path, FT_Library p_librar for (uint32_t i = 0; i < FT_Get_Sfnt_Name_Count(t_font_face); i++) { // Attempt to fetch the name of the font. The name is name id 4 as defined in https://developer.apple.com/fonts/TTRefMan/RM06/Chap6name.html - // It appears that the platform to use here is 1 (Macintosh according to the spec). FT_Get_Sfnt_Name(t_font_face, i, &t_sft_name); - if (t_sft_name.name_id == 4 && t_sft_name.platform_id == 1 && t_sft_name.encoding_id == 0 && t_sft_name.language_id == 0 && t_sft_name.string_len != 0) + if (t_sft_name.name_id == 4 && t_sft_name.string_len != 0) { t_success = MCStringCreateWithNativeChars((char_t *)t_sft_name.string, t_sft_name.string_len, t_font->name); break;