Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

[[ 14436 ]] Ensure valid custom fonts can be loaded on Android #7415

Open
wants to merge 1 commit into
base: develop-9.6
Choose a base branch
Loading
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1 docs/notes/bugfix-14436.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Ensure valid custom fonts can be loaded on Android
3 changes: 1 addition & 2 deletions 3 engine/src/mblandroidfont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the bug report I'm not sure this is correct.

There are two issues here from what I can see...

Several of the fonts listed in the bug report have their names encoded as UTF-16BE and not native - that is probably why some of those (which do have matching criteria!) do not work correctly (I also suspect they are incorrectly built fonts!).

The second is that we are not searching will less strict criteria if stricter criteria fail.

The first of these is more serious than the second as I suspect it is why several of the fonts in that bug report which do have 4100 entries are not working - and means that even if other (less strict) searches are done, it still won't work.

{
t_success = MCStringCreateWithNativeChars((char_t *)t_sft_name.string, t_sft_name.string_len, t_font->name);
break;
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.