Merge pull request #418 from googlefonts/colrv1-allow-embedding

colrv1_postproc.py: set OS/2.fsType=0 to remove font embedding restrictions
pull/411/merge
Cosimo Lupo 2023-03-10 18:35:14 +00:00 committed by GitHub
commit 934a5706f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)