empty subdivision flag (1F3F4+E007F) should be mapped to uknown flag, not the black flag

The substitution BLACK_FLAG + CANCEL_TAG => UNKNOWN_FLAG is alrady handled by the _add_fallback_subs_for_unknown_flags method, added in the previous commit.
There's no BLACK_FLAG + CANCEL_TAG => BLACK_FLAG substituion in the current NotoColorEmoji.ttf CBDT font.
In fact, it makes much more sense that all unsupported subdivision flag sequences, i.e. BLACK_FLAG + (zero or more non-cancel tags) + CANCEL_TAG, are all displayed with the unknown flag. No reason to special case BLACK_FLAG + CANCEL_TAG.
I'm not sure where the conclusion about the BLACK_FLAG + CANCEL_TAG => BLACK_FLAG came from (got to ask Rod).
pull/378/head
Cosimo Lupo 2022-02-03 12:28:16 +00:00
parent f8ec04e4a3
commit 631766222f
1 changed files with 1 additions and 27 deletions

View File

@ -147,31 +147,6 @@ def _Cmap(ttfont):
return functools.reduce(_Reducer, unicode_cmaps, {})
BLACK_FLAG = 0x1F3F4
def _map_empty_flag_tag_to_black_flag(colr_font):
# fontchain_lint wants direct support for empty flag tags
# so map them to the default flag to match cbdt behavior
# if the emoji font starts using extensions this code will require revision
cmap = _Cmap(colr_font)
black_flag_glyph = cmap[BLACK_FLAG]
cancel_tag_glyph = cmap[CANCEL_TAG]
lookup_list = colr_font["GSUB"].table.LookupList
liga_set = _ligaset_for_glyph(lookup_list, black_flag_glyph)
assert liga_set is not None, "There should be existing ligatures using black flag"
# Map black flag + cancel tag to just black flag
# Since this is the ligature set for black flag, component is just cancel tag
# Since we only have one component its safe to put our rule at the front
liga = ot.Ligature()
liga.Component = [cancel_tag_glyph]
liga.LigGlyph = black_flag_glyph
liga_set.insert(0, liga)
def _add_vertical_layout_tables(cbdt_font, colr_font):
upem_scale = colr_font["head"].unitsPerEm / cbdt_font["head"].unitsPerEm
@ -209,6 +184,7 @@ def _add_vertical_layout_tables(cbdt_font, colr_font):
UNKNOWN_FLAG_PUA = 0xFE82B
BLACK_FLAG = 0x1F3F4
REGIONAL_INDICATORS = set(range(0x1F1E6, 0x1F1FF + 1))
@ -342,8 +318,6 @@ def main(argv):
_map_missing_flag_tag_chars_to_empty_glyphs(colr_font)
_map_empty_flag_tag_to_black_flag(colr_font)
add_soft_light_to_flags(colr_font)
_add_vertical_layout_tables(cbdt_font, colr_font)