[feaLib] Add another test for language systems

This commit is contained in:
James Godfrey-Kittle 2016-06-21 16:40:17 -07:00
parent d1af1cfd4a
commit aaf9294d97
3 changed files with 222 additions and 2 deletions

View File

@ -36,7 +36,7 @@ def makeTTFont():
Q.swash R.swash S.swash T.swash U.swash V.swash W.swash X.swash
Y.swash Z.swash
f_l c_h c_k c_s c_t f_f f_f_i f_f_l f_i o_f_f_i s_t f_i.begin
a_n_d T_h T_h.swash ydieresis yacute breve
a_n_d T_h T_h.swash germandbls ydieresis yacute breve
grave acute dieresis macron circumflex cedilla umlaut ogonek caron
damma hamza sukun kasratan lam_meem_jeem noon.final noon.initial
""".split()
@ -53,7 +53,7 @@ class BuilderTest(unittest.TestCase):
lookup lookupflag feature_aalt ignore_pos
GPOS_1 GPOS_1_zero GPOS_2 GPOS_2b GPOS_3 GPOS_4 GPOS_5 GPOS_6 GPOS_8
GSUB_2 GSUB_3 GSUB_6 GSUB_8
spec4h1 spec5d1 spec5d2 spec5fi1 spec5fi2 spec5fi3 spec5fi4
spec4h1 spec4h2 spec5d1 spec5d2 spec5fi1 spec5fi2 spec5fi3 spec5fi4
spec5f_ii_1 spec5f_ii_2 spec5f_ii_3 spec5f_ii_4
spec5h1 spec6b_ii spec6d2 spec6e spec6f
spec6h_ii spec6h_iii_1 spec6h_iii_3d spec8a spec8b spec8c

View File

@ -0,0 +1,40 @@
# OpenType Feature File specification, section 4.h, example 2.
# http://www.adobe.com/devnet/opentype/afdko/topic_feature_file_syntax.html
languagesystem DFLT dflt;
languagesystem latn dflt;
languagesystem latn DEU;
languagesystem cyrl dflt;
languagesystem cyrl SRB;
languagesystem grek dflt;
feature liga {
# start of default rules that are applied under all language systems.
lookup HAS_I {
sub f f i by f_f_i;
sub f i by f_i;
} HAS_I;
lookup NO_I {
sub f f l by f_f_l;
sub f f by f_f;
} NO_I;
# end of default rules that are applied under all language systems.
script latn;
language dflt;
# default lookup for latn included under all languages for the latn script
sub f l by f_l;
language DEU;
# default lookups included under the DEU language
sub s s by germandbls; # This is also included.
language TRK exclude_dflt; # default lookups are excluded.
lookup NO_I; # Only this lookup is included under the TRK language
script cyrl;
language SRB;
sub c t by c_t; # this rule will apply only under script cyrl language SRB.
} liga;

View File

@ -0,0 +1,180 @@
<?xml version="1.0" encoding="UTF-8"?>
<ttFont sfntVersion="\x00\x01\x00\x00" ttLibVersion="3.0">
<GSUB>
<Version value="1.0"/>
<ScriptList>
<!-- ScriptCount=4 -->
<ScriptRecord index="0">
<ScriptTag value="DFLT"/>
<Script>
<DefaultLangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=1 -->
<FeatureIndex index="0" value="3"/>
</DefaultLangSys>
<!-- LangSysCount=0 -->
</Script>
</ScriptRecord>
<ScriptRecord index="1">
<ScriptTag value="cyrl"/>
<Script>
<DefaultLangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=1 -->
<FeatureIndex index="0" value="3"/>
</DefaultLangSys>
<!-- LangSysCount=1 -->
<LangSysRecord index="0">
<LangSysTag value="SRB "/>
<LangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=1 -->
<FeatureIndex index="0" value="1"/>
</LangSys>
</LangSysRecord>
</Script>
</ScriptRecord>
<ScriptRecord index="2">
<ScriptTag value="grek"/>
<Script>
<DefaultLangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=1 -->
<FeatureIndex index="0" value="3"/>
</DefaultLangSys>
<!-- LangSysCount=0 -->
</Script>
</ScriptRecord>
<ScriptRecord index="3">
<ScriptTag value="latn"/>
<Script>
<DefaultLangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=1 -->
<FeatureIndex index="0" value="4"/>
</DefaultLangSys>
<!-- LangSysCount=2 -->
<LangSysRecord index="0">
<LangSysTag value="DEU "/>
<LangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=1 -->
<FeatureIndex index="0" value="0"/>
</LangSys>
</LangSysRecord>
<LangSysRecord index="1">
<LangSysTag value="TRK "/>
<LangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=1 -->
<FeatureIndex index="0" value="2"/>
</LangSys>
</LangSysRecord>
</Script>
</ScriptRecord>
</ScriptList>
<FeatureList>
<!-- FeatureCount=5 -->
<FeatureRecord index="0">
<FeatureTag value="liga"/>
<Feature>
<!-- LookupCount=4 -->
<LookupListIndex index="0" value="0"/>
<LookupListIndex index="1" value="1"/>
<LookupListIndex index="2" value="2"/>
<LookupListIndex index="3" value="3"/>
</Feature>
</FeatureRecord>
<FeatureRecord index="1">
<FeatureTag value="liga"/>
<Feature>
<!-- LookupCount=3 -->
<LookupListIndex index="0" value="0"/>
<LookupListIndex index="1" value="1"/>
<LookupListIndex index="2" value="4"/>
</Feature>
</FeatureRecord>
<FeatureRecord index="2">
<FeatureTag value="liga"/>
<Feature>
<!-- LookupCount=1 -->
<LookupListIndex index="0" value="1"/>
</Feature>
</FeatureRecord>
<FeatureRecord index="3">
<FeatureTag value="liga"/>
<Feature>
<!-- LookupCount=2 -->
<LookupListIndex index="0" value="0"/>
<LookupListIndex index="1" value="1"/>
</Feature>
</FeatureRecord>
<FeatureRecord index="4">
<FeatureTag value="liga"/>
<Feature>
<!-- LookupCount=3 -->
<LookupListIndex index="0" value="0"/>
<LookupListIndex index="1" value="1"/>
<LookupListIndex index="2" value="2"/>
</Feature>
</FeatureRecord>
</FeatureList>
<LookupList>
<!-- LookupCount=5 -->
<Lookup index="0">
<!-- LookupType=4 -->
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<LigatureSubst index="0">
<LigatureSet glyph="f">
<Ligature components="f,i" glyph="f_f_i"/>
<Ligature components="i" glyph="f_i"/>
</LigatureSet>
</LigatureSubst>
</Lookup>
<Lookup index="1">
<!-- LookupType=4 -->
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<LigatureSubst index="0">
<LigatureSet glyph="f">
<Ligature components="f,l" glyph="f_f_l"/>
<Ligature components="f" glyph="f_f"/>
</LigatureSet>
</LigatureSubst>
</Lookup>
<Lookup index="2">
<!-- LookupType=4 -->
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<LigatureSubst index="0">
<LigatureSet glyph="f">
<Ligature components="l" glyph="f_l"/>
</LigatureSet>
</LigatureSubst>
</Lookup>
<Lookup index="3">
<!-- LookupType=4 -->
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<LigatureSubst index="0">
<LigatureSet glyph="s">
<Ligature components="s" glyph="germandbls"/>
</LigatureSet>
</LigatureSubst>
</Lookup>
<Lookup index="4">
<!-- LookupType=4 -->
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<LigatureSubst index="0">
<LigatureSet glyph="c">
<Ligature components="t" glyph="c_t"/>
</LigatureSet>
</LigatureSubst>
</Lookup>
</LookupList>
</GSUB>
</ttFont>