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
pull/418/head
Cosimo Lupo 2023-03-10 18:19:13 +00:00
parent 341cf6add6
commit b55be68324
No known key found for this signature in database
GPG Key ID: DF65A8A5A119C9A8
1 changed files with 10 additions and 0 deletions

View File

@ -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)