Generate unknown flag for unrecognized subregion emoji sequences.

Instead of writing code to build the additional lookups needed for
subregion missing flag handling, this adds a GSUB table to the
template and lets add_glyphs do its normal thing to the first
GSUB lookup.
pull/92/head
Doug Felt 2017-02-03 13:12:08 -08:00
parent b5c7e8035c
commit d270ecad99
3 changed files with 327 additions and 2 deletions

View File

@ -213,7 +213,7 @@ clean:
rm -rf $(BUILD_DIR)
.SECONDARY: $(EMOJI_FILES) $(FLAG_FILES) $(RESIZED_FLAG_FILES) $(RENAMED_FLAG_FILES) \
$(ALL_QUANTIZED_FILES) $(ALL_COMPRESSED_FILES)
$(ALL_QUANTIZED_FILES) $(ALL_COMPRESSED_FILES) NotoColorEmoji.tmpl.ttx
.PHONY: clean flags emoji renamed_flags quantized compressed check_compress_tool

View File

@ -8,6 +8,45 @@
<GlyphID id="2" name="nonmarkingreturn"/>
<GlyphID id="3" name="space"/>
<GlyphID id="4" name="u200D"/>
<GlyphID id="5" name="uE0030"/>
<GlyphID id="6" name="uE0031"/>
<GlyphID id="7" name="uE0032"/>
<GlyphID id="8" name="uE0033"/>
<GlyphID id="9" name="uE0034"/>
<GlyphID id="10" name="uE0035"/>
<GlyphID id="11" name="uE0036"/>
<GlyphID id="12" name="uE0037"/>
<GlyphID id="13" name="uE0038"/>
<GlyphID id="14" name="uE0039"/>
<GlyphID id="15" name="uE0061"/>
<GlyphID id="16" name="uE0062"/>
<GlyphID id="17" name="uE0063"/>
<GlyphID id="18" name="uE0064"/>
<GlyphID id="19" name="uE0065"/>
<GlyphID id="20" name="uE0066"/>
<GlyphID id="21" name="uE0067"/>
<GlyphID id="22" name="uE0068"/>
<GlyphID id="23" name="uE0069"/>
<GlyphID id="24" name="uE006A"/>
<GlyphID id="25" name="uE006B"/>
<GlyphID id="26" name="uE006C"/>
<GlyphID id="27" name="uE006D"/>
<GlyphID id="28" name="uE006E"/>
<GlyphID id="29" name="uE006F"/>
<GlyphID id="30" name="uE0070"/>
<GlyphID id="31" name="uE0071"/>
<GlyphID id="32" name="uE0072"/>
<GlyphID id="33" name="uE0073"/>
<GlyphID id="34" name="uE0074"/>
<GlyphID id="35" name="uE0075"/>
<GlyphID id="36" name="uE0076"/>
<GlyphID id="37" name="uE0077"/>
<GlyphID id="38" name="uE0078"/>
<GlyphID id="39" name="uE0079"/>
<GlyphID id="40" name="uE007A"/>
<GlyphID id="41" name="uE007F"/>
<GlyphID id="42" name="u1F3F4"/>
<GlyphID id="43" name="uFE82B"/>
</GlyphOrder>
<head>
@ -127,6 +166,45 @@
<mtx name="nonmarkingreturn" width="2550" lsb="0"/>
<mtx name="space" width="2550" lsb="0"/>
<mtx name="u200D" width="0" lsb="0"/>
<mtx name="uE0030" width="0" lsb="0"/>
<mtx name="uE0031" width="0" lsb="0"/>
<mtx name="uE0032" width="0" lsb="0"/>
<mtx name="uE0033" width="0" lsb="0"/>
<mtx name="uE0034" width="0" lsb="0"/>
<mtx name="uE0035" width="0" lsb="0"/>
<mtx name="uE0036" width="0" lsb="0"/>
<mtx name="uE0037" width="0" lsb="0"/>
<mtx name="uE0038" width="0" lsb="0"/>
<mtx name="uE0039" width="0" lsb="0"/>
<mtx name="uE0061" width="0" lsb="0"/>
<mtx name="uE0062" width="0" lsb="0"/>
<mtx name="uE0063" width="0" lsb="0"/>
<mtx name="uE0064" width="0" lsb="0"/>
<mtx name="uE0065" width="0" lsb="0"/>
<mtx name="uE0066" width="0" lsb="0"/>
<mtx name="uE0067" width="0" lsb="0"/>
<mtx name="uE0068" width="0" lsb="0"/>
<mtx name="uE0069" width="0" lsb="0"/>
<mtx name="uE006A" width="0" lsb="0"/>
<mtx name="uE006B" width="0" lsb="0"/>
<mtx name="uE006C" width="0" lsb="0"/>
<mtx name="uE006D" width="0" lsb="0"/>
<mtx name="uE006E" width="0" lsb="0"/>
<mtx name="uE006F" width="0" lsb="0"/>
<mtx name="uE0070" width="0" lsb="0"/>
<mtx name="uE0071" width="0" lsb="0"/>
<mtx name="uE0072" width="0" lsb="0"/>
<mtx name="uE0073" width="0" lsb="0"/>
<mtx name="uE0074" width="0" lsb="0"/>
<mtx name="uE0075" width="0" lsb="0"/>
<mtx name="uE0076" width="0" lsb="0"/>
<mtx name="uE0077" width="0" lsb="0"/>
<mtx name="uE0078" width="0" lsb="0"/>
<mtx name="uE0079" width="0" lsb="0"/>
<mtx name="uE007A" width="0" lsb="0"/>
<mtx name="uE007F" width="0" lsb="0"/>
<mtx name="u1F3F4" width="0" lsb="0"/>
<mtx name="uFE82B" width="0" lsb="0"/>
</hmtx>
<cmap>
@ -136,6 +214,45 @@
<map code="0xd" name="nonmarkingreturn"/>
<map code="0x20" name="space"/>
<map code="0x200d" name="u200D"/>
<map code="0xE0030" name="uE0030"/>
<map code="0xE0031" name="uE0031"/>
<map code="0xE0032" name="uE0032"/>
<map code="0xE0033" name="uE0033"/>
<map code="0xE0034" name="uE0034"/>
<map code="0xE0035" name="uE0035"/>
<map code="0xE0036" name="uE0036"/>
<map code="0xE0037" name="uE0037"/>
<map code="0xE0038" name="uE0038"/>
<map code="0xE0039" name="uE0039"/>
<map code="0xE0061" name="uE0061"/>
<map code="0xE0062" name="uE0062"/>
<map code="0xE0063" name="uE0063"/>
<map code="0xE0064" name="uE0064"/>
<map code="0xE0065" name="uE0065"/>
<map code="0xE0066" name="uE0066"/>
<map code="0xE0067" name="uE0067"/>
<map code="0xE0068" name="uE0068"/>
<map code="0xE0069" name="uE0069"/>
<map code="0xE006A" name="uE006A"/>
<map code="0xE006B" name="uE006B"/>
<map code="0xE006C" name="uE006C"/>
<map code="0xE006D" name="uE006D"/>
<map code="0xE006E" name="uE006E"/>
<map code="0xE006F" name="uE006F"/>
<map code="0xE0070" name="uE0070"/>
<map code="0xE0071" name="uE0071"/>
<map code="0xE0072" name="uE0072"/>
<map code="0xE0073" name="uE0073"/>
<map code="0xE0074" name="uE0074"/>
<map code="0xE0075" name="uE0075"/>
<map code="0xE0076" name="uE0076"/>
<map code="0xE0077" name="uE0077"/>
<map code="0xE0078" name="uE0078"/>
<map code="0xE0079" name="uE0079"/>
<map code="0xE007A" name="uE007A"/>
<map code="0xE007F" name="uE007F"/>
<map code="0x1F3F4" name="u1F3F4"/>
<map code="0xFE82B" name="uFE82B"/>
</cmap_format_12>
</cmap>
@ -199,4 +316,203 @@
<maxMemType1 value="0"/>
</post>
<GSUB>
<Version value="0x00010000"/>
<ScriptList>
<!-- ScriptCount=1 -->
<ScriptRecord index="0">
<ScriptTag value="DFLT"/>
<Script>
<DefaultLangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=1 -->
<FeatureIndex index="0" value="0"/>
</DefaultLangSys>
<!-- LangSysCount=0 -->
</Script>
</ScriptRecord>
</ScriptList>
<FeatureList>
<!-- FeatureCount=1 -->
<FeatureRecord index="0">
<FeatureTag value="ccmp"/>
<Feature>
<!-- LookupCount=1 -->
<LookupListIndex index="0" value="0"/>
<LookupListIndex index="1" value="2"/>
<LookupListIndex index="2" value="3"/>
</Feature>
</FeatureRecord>
</FeatureList>
<LookupList>
<!-- LookupCount=1 -->
<Lookup index="0">
<LookupType value="4"/>
<!-- LookupType=4 -->
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<LigatureSubst index="0" Format="1">
</LigatureSubst>
</Lookup>
<Lookup index="1">
<LookupType value="2"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<MultipleSubst index="0" Format="1">
<Substitution in="uE0030" out=""/>
<Substitution in="uE0031" out=""/>
<Substitution in="uE0032" out=""/>
<Substitution in="uE0033" out=""/>
<Substitution in="uE0034" out=""/>
<Substitution in="uE0035" out=""/>
<Substitution in="uE0036" out=""/>
<Substitution in="uE0037" out=""/>
<Substitution in="uE0038" out=""/>
<Substitution in="uE0039" out=""/>
<Substitution in="uE0061" out=""/>
<Substitution in="uE0062" out=""/>
<Substitution in="uE0063" out=""/>
<Substitution in="uE0064" out=""/>
<Substitution in="uE0065" out=""/>
<Substitution in="uE0066" out=""/>
<Substitution in="uE0067" out=""/>
<Substitution in="uE0068" out=""/>
<Substitution in="uE0069" out=""/>
<Substitution in="uE006A" out=""/>
<Substitution in="uE006B" out=""/>
<Substitution in="uE006C" out=""/>
<Substitution in="uE006D" out=""/>
<Substitution in="uE006E" out=""/>
<Substitution in="uE006F" out=""/>
<Substitution in="uE0070" out=""/>
<Substitution in="uE0071" out=""/>
<Substitution in="uE0072" out=""/>
<Substitution in="uE0073" out=""/>
<Substitution in="uE0074" out=""/>
<Substitution in="uE0075" out=""/>
<Substitution in="uE0076" out=""/>
<Substitution in="uE0077" out=""/>
<Substitution in="uE0078" out=""/>
<Substitution in="uE0079" out=""/>
<Substitution in="uE007A" out=""/>
</MultipleSubst>
</Lookup>
<Lookup index="2">
<LookupType value="6"/>
<!-- LookupType=6 -->
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<ChainContextSubst index="0" Format="2">
<Coverage Format="2">
<Glyph value="uE0030"/>
<Glyph value="uE0031"/>
<Glyph value="uE0032"/>
<Glyph value="uE0033"/>
<Glyph value="uE0034"/>
<Glyph value="uE0035"/>
<Glyph value="uE0036"/>
<Glyph value="uE0037"/>
<Glyph value="uE0038"/>
<Glyph value="uE0039"/>
<Glyph value="uE0061"/>
<Glyph value="uE0062"/>
<Glyph value="uE0063"/>
<Glyph value="uE0064"/>
<Glyph value="uE0065"/>
<Glyph value="uE0066"/>
<Glyph value="uE0067"/>
<Glyph value="uE0068"/>
<Glyph value="uE0069"/>
<Glyph value="uE006A"/>
<Glyph value="uE006B"/>
<Glyph value="uE006C"/>
<Glyph value="uE006D"/>
<Glyph value="uE006E"/>
<Glyph value="uE006F"/>
<Glyph value="uE0070"/>
<Glyph value="uE0071"/>
<Glyph value="uE0072"/>
<Glyph value="uE0073"/>
<Glyph value="uE0074"/>
<Glyph value="uE0075"/>
<Glyph value="uE0076"/>
<Glyph value="uE0077"/>
<Glyph value="uE0078"/>
<Glyph value="uE0079"/>
<Glyph value="uE007A"/>
</Coverage>
<BacktrackClassDef Format="1">
<ClassDef glyph="u1F3F4" class="1"/>
</BacktrackClassDef>
<InputClassDef Format="2">
<ClassDef glyph="uE0030" class="2"/>
<ClassDef glyph="uE0031" class="2"/>
<ClassDef glyph="uE0032" class="2"/>
<ClassDef glyph="uE0033" class="2"/>
<ClassDef glyph="uE0034" class="2"/>
<ClassDef glyph="uE0035" class="2"/>
<ClassDef glyph="uE0036" class="2"/>
<ClassDef glyph="uE0037" class="2"/>
<ClassDef glyph="uE0038" class="2"/>
<ClassDef glyph="uE0039" class="2"/>
<ClassDef glyph="uE0061" class="2"/>
<ClassDef glyph="uE0062" class="2"/>
<ClassDef glyph="uE0063" class="2"/>
<ClassDef glyph="uE0064" class="2"/>
<ClassDef glyph="uE0065" class="2"/>
<ClassDef glyph="uE0066" class="2"/>
<ClassDef glyph="uE0067" class="2"/>
<ClassDef glyph="uE0068" class="2"/>
<ClassDef glyph="uE0069" class="2"/>
<ClassDef glyph="uE006A" class="2"/>
<ClassDef glyph="uE006B" class="2"/>
<ClassDef glyph="uE006C" class="2"/>
<ClassDef glyph="uE006D" class="2"/>
<ClassDef glyph="uE006E" class="2"/>
<ClassDef glyph="uE006F" class="2"/>
<ClassDef glyph="uE0070" class="2"/>
<ClassDef glyph="uE0071" class="2"/>
<ClassDef glyph="uE0072" class="2"/>
<ClassDef glyph="uE0073" class="2"/>
<ClassDef glyph="uE0074" class="2"/>
<ClassDef glyph="uE0075" class="2"/>
<ClassDef glyph="uE0076" class="2"/>
<ClassDef glyph="uE0077" class="2"/>
<ClassDef glyph="uE0078" class="2"/>
<ClassDef glyph="uE0079" class="2"/>
<ClassDef glyph="uE007A" class="2"/>
</InputClassDef>
<LookAheadClassDef Format="2">
</LookAheadClassDef>
<!-- ChainSubClassSetCount=3 -->
<ChainSubClassSet index="0" empty="1"/>
<ChainSubClassSet index="1" empty="1"/>
<ChainSubClassSet index="2">
<!-- ChainSubClassRuleCount=1 -->
<ChainSubClassRule index="0">
<!-- BacktrackGlyphCount=1 -->
<Backtrack index="0" value="1"/>
<!-- InputGlyphCount=1 -->
<!-- LookAheadGlyphCount=0 -->
<!-- SubstCount=2 -->
<SubstLookupRecord index="0">
<SequenceIndex value="0"/>
<LookupListIndex value="1"/>
</SubstLookupRecord>
</ChainSubClassRule>
</ChainSubClassSet>
</ChainContextSubst>
</Lookup>
<Lookup index="3">
<LookupType value="4"/>
<LookupFlag value="0"/>
<LigatureSubst index="0" Format="1">
<LigatureSet glyph="u1F3F4">
<Ligature components="uE007F" glyph="uFE82B"/>
</LigatureSet>
</LigatureSubst>
</Lookup>
</LookupList>
</GSUB>
</ttFont>

View File

@ -59,9 +59,18 @@ def add_ligature (font, seq, name):
font['GSUB'] = add_emoji_gsub.create_simple_gsub([lookup])
else:
lookup = font['GSUB'].table.LookupList.Lookup[0]
assert lookup.LookupType == 4
# assert lookup.LookupType == 4
assert lookup.LookupFlag == 0
# importXML doesn't fully init GSUB structures, so help it out
if not hasattr(lookup, 'LookupType'):
st = lookup.SubTable[0]
assert st.LookupType == 4
setattr(lookup, 'LookupType', 4)
if not hasattr(st, 'ligatures'):
setattr(st, 'ligatures', {})
ligatures = lookup.SubTable[0].ligatures
lig = otTables.Ligature()