[feaLib] Ignore superfluous script statements
Setting script that is the same as current language system should make no effect. This is not documented in the spec, but it is what makeotf does. This as the effect of preserving lookupflag when set before such a script statement. Fixes https://github.com/fonttools/fonttools/issues/1824
This commit is contained in:
parent
6a24c8fed1
commit
259e586f5d
@ -780,6 +780,9 @@ class Builder(object):
|
|||||||
raise FeatureLibError(
|
raise FeatureLibError(
|
||||||
"Script statements are not allowed "
|
"Script statements are not allowed "
|
||||||
"within standalone lookup blocks", location)
|
"within standalone lookup blocks", location)
|
||||||
|
if self.language_systems == {(script, 'dflt')}:
|
||||||
|
# Nothing to do.
|
||||||
|
return
|
||||||
self.cur_lookup_ = None
|
self.cur_lookup_ = None
|
||||||
self.script_ = script
|
self.script_ = script
|
||||||
self.lookupflag_ = 0
|
self.lookupflag_ = 0
|
||||||
|
@ -134,3 +134,16 @@ feature test {
|
|||||||
pos one 1;
|
pos one 1;
|
||||||
} V;
|
} V;
|
||||||
} test;
|
} test;
|
||||||
|
|
||||||
|
feature test {
|
||||||
|
lookup W {
|
||||||
|
lookupflag IgnoreMarks;
|
||||||
|
script latn;
|
||||||
|
pos one 1;
|
||||||
|
} W;
|
||||||
|
lookup X {
|
||||||
|
lookupflag IgnoreMarks;
|
||||||
|
script latn;
|
||||||
|
pos two 2;
|
||||||
|
} X;
|
||||||
|
} test;
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
<GPOS>
|
<GPOS>
|
||||||
<Version value="0x00010000"/>
|
<Version value="0x00010000"/>
|
||||||
<ScriptList>
|
<ScriptList>
|
||||||
<!-- ScriptCount=1 -->
|
<!-- ScriptCount=2 -->
|
||||||
<ScriptRecord index="0">
|
<ScriptRecord index="0">
|
||||||
<ScriptTag value="DFLT"/>
|
<ScriptTag value="DFLT"/>
|
||||||
<Script>
|
<Script>
|
||||||
@ -55,9 +55,20 @@
|
|||||||
<!-- LangSysCount=0 -->
|
<!-- LangSysCount=0 -->
|
||||||
</Script>
|
</Script>
|
||||||
</ScriptRecord>
|
</ScriptRecord>
|
||||||
|
<ScriptRecord index="1">
|
||||||
|
<ScriptTag value="latn"/>
|
||||||
|
<Script>
|
||||||
|
<DefaultLangSys>
|
||||||
|
<ReqFeatureIndex value="65535"/>
|
||||||
|
<!-- FeatureCount=1 -->
|
||||||
|
<FeatureIndex index="0" value="1"/>
|
||||||
|
</DefaultLangSys>
|
||||||
|
<!-- LangSysCount=0 -->
|
||||||
|
</Script>
|
||||||
|
</ScriptRecord>
|
||||||
</ScriptList>
|
</ScriptList>
|
||||||
<FeatureList>
|
<FeatureList>
|
||||||
<!-- FeatureCount=1 -->
|
<!-- FeatureCount=2 -->
|
||||||
<FeatureRecord index="0">
|
<FeatureRecord index="0">
|
||||||
<FeatureTag value="test"/>
|
<FeatureTag value="test"/>
|
||||||
<Feature>
|
<Feature>
|
||||||
@ -86,9 +97,17 @@
|
|||||||
<LookupListIndex index="21" value="21"/>
|
<LookupListIndex index="21" value="21"/>
|
||||||
</Feature>
|
</Feature>
|
||||||
</FeatureRecord>
|
</FeatureRecord>
|
||||||
|
<FeatureRecord index="1">
|
||||||
|
<FeatureTag value="test"/>
|
||||||
|
<Feature>
|
||||||
|
<!-- LookupCount=2 -->
|
||||||
|
<LookupListIndex index="0" value="22"/>
|
||||||
|
<LookupListIndex index="1" value="23"/>
|
||||||
|
</Feature>
|
||||||
|
</FeatureRecord>
|
||||||
</FeatureList>
|
</FeatureList>
|
||||||
<LookupList>
|
<LookupList>
|
||||||
<!-- LookupCount=22 -->
|
<!-- LookupCount=24 -->
|
||||||
<Lookup index="0">
|
<Lookup index="0">
|
||||||
<LookupType value="1"/>
|
<LookupType value="1"/>
|
||||||
<LookupFlag value="1"/><!-- rightToLeft -->
|
<LookupFlag value="1"/><!-- rightToLeft -->
|
||||||
@ -357,6 +376,30 @@
|
|||||||
<Value XAdvance="1"/>
|
<Value XAdvance="1"/>
|
||||||
</SinglePos>
|
</SinglePos>
|
||||||
</Lookup>
|
</Lookup>
|
||||||
|
<Lookup index="22">
|
||||||
|
<LookupType value="1"/>
|
||||||
|
<LookupFlag value="0"/>
|
||||||
|
<!-- SubTableCount=1 -->
|
||||||
|
<SinglePos index="0" Format="1">
|
||||||
|
<Coverage>
|
||||||
|
<Glyph value="one"/>
|
||||||
|
</Coverage>
|
||||||
|
<ValueFormat value="4"/>
|
||||||
|
<Value XAdvance="1"/>
|
||||||
|
</SinglePos>
|
||||||
|
</Lookup>
|
||||||
|
<Lookup index="23">
|
||||||
|
<LookupType value="1"/>
|
||||||
|
<LookupFlag value="8"/><!-- ignoreMarks -->
|
||||||
|
<!-- SubTableCount=1 -->
|
||||||
|
<SinglePos index="0" Format="1">
|
||||||
|
<Coverage>
|
||||||
|
<Glyph value="two"/>
|
||||||
|
</Coverage>
|
||||||
|
<ValueFormat value="4"/>
|
||||||
|
<Value XAdvance="2"/>
|
||||||
|
</SinglePos>
|
||||||
|
</Lookup>
|
||||||
</LookupList>
|
</LookupList>
|
||||||
</GPOS>
|
</GPOS>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user