Skip to content

Commit

Permalink
Merge pull request #418 from googlefonts/colrv1-allow-embedding
Browse files Browse the repository at this point in the history
colrv1_postproc.py: set OS/2.fsType=0 to remove font embedding restrictions
  • Loading branch information
anthrotype authored Mar 10, 2023
2 parents 341cf6a + b55be68 commit 934a570
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions colrv1_postproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 934a570

Please sign in to comment.