From b55be6832406ccbccbc31fee5c4aea8a5dbf2501 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Fri, 10 Mar 2023 18:19:13 +0000 Subject: [PATCH] colrv1_postproc.py: set OS/2.fsType=0 to remove font embedding restrictions The old CBDT/CBLC font similarly has no font embedding restrictions (OS/2.fsType=0), so the COLRv1 font needs to match that. Fixes https://github.com/google/fonts/issues/5729 --- colrv1_postproc.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/colrv1_postproc.py b/colrv1_postproc.py index a6b4d158d..f40aedcbd 100644 --- a/colrv1_postproc.py +++ b/colrv1_postproc.py @@ -283,6 +283,14 @@ def _add_fallback_subs_for_unknown_flags(colr_font): font_data.delete_from_cmap(colr_font, [UNKNOWN_FLAG_PUA]) +def _set_no_font_embedding_restrictions(colr_font): + # The CBDT/CBLC NotoColorEmoji has OS/2.fsType = 0 (i.e. no embedding restrictions) + # so the COLRv1 variant must also have no such restrictions. + # https://github.com/notofonts/noto-fonts/issues/2408 + # https://github.com/google/fonts/issues/5729 + colr_font["OS/2"].fsType = 0 + + def _font(path, check_fn, check_fail_str): assert path.is_file(), path font = ttLib.TTFont(path) @@ -314,6 +322,8 @@ def main(_): _add_fallback_subs_for_unknown_flags(colr_font) + _set_no_font_embedding_restrictions(colr_font) + print("Writing", colr_file) colr_font.save(colr_file)