Clone variable mark anchor before building (#3330)
* Copy mark anchor before OTifying * Add test for variable mark anchor
This commit is contained in:
parent
3b90398696
commit
4c60c5f3ba
@ -36,6 +36,7 @@ from fontTools.varLib.builder import buildVarDevTable
|
|||||||
from fontTools.varLib.featureVars import addFeatureVariationsRaw
|
from fontTools.varLib.featureVars import addFeatureVariationsRaw
|
||||||
from fontTools.varLib.models import normalizeValue, piecewiseLinearMap
|
from fontTools.varLib.models import normalizeValue, piecewiseLinearMap
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
import copy
|
||||||
import itertools
|
import itertools
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
import logging
|
import logging
|
||||||
@ -1516,7 +1517,7 @@ class Builder(object):
|
|||||||
for mark in markClassDef.glyphs.glyphSet():
|
for mark in markClassDef.glyphs.glyphSet():
|
||||||
if mark not in lookupBuilder.marks:
|
if mark not in lookupBuilder.marks:
|
||||||
otMarkAnchor = self.makeOpenTypeAnchor(
|
otMarkAnchor = self.makeOpenTypeAnchor(
|
||||||
location, markClassDef.anchor
|
location, copy.deepcopy(markClassDef.anchor)
|
||||||
)
|
)
|
||||||
lookupBuilder.marks[mark] = (markClass.name, otMarkAnchor)
|
lookupBuilder.marks[mark] = (markClass.name, otMarkAnchor)
|
||||||
else:
|
else:
|
||||||
|
@ -81,6 +81,7 @@ class BuilderTest(unittest.TestCase):
|
|||||||
MultipleLookupsPerGlyph MultipleLookupsPerGlyph2 GSUB_6_formats
|
MultipleLookupsPerGlyph MultipleLookupsPerGlyph2 GSUB_6_formats
|
||||||
GSUB_5_formats delete_glyph STAT_test STAT_test_elidedFallbackNameID
|
GSUB_5_formats delete_glyph STAT_test STAT_test_elidedFallbackNameID
|
||||||
variable_scalar_valuerecord variable_scalar_anchor variable_conditionset
|
variable_scalar_valuerecord variable_scalar_anchor variable_conditionset
|
||||||
|
variable_mark_anchor
|
||||||
""".split()
|
""".split()
|
||||||
|
|
||||||
VARFONT_AXES = [
|
VARFONT_AXES = [
|
||||||
|
10
Tests/feaLib/data/variable_mark_anchor.fea
Normal file
10
Tests/feaLib/data/variable_mark_anchor.fea
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
markClass macron <anchor 0 (wght=200:150 wght=900:152)> @MC_top;
|
||||||
|
|
||||||
|
lookup one {
|
||||||
|
pos base a
|
||||||
|
<anchor 0 0> mark @MC_top;
|
||||||
|
} one;
|
||||||
|
lookup two {
|
||||||
|
pos base a
|
||||||
|
<anchor 0 0> mark @MC_top;
|
||||||
|
} two;
|
128
Tests/feaLib/data/variable_mark_anchor.ttx
Normal file
128
Tests/feaLib/data/variable_mark_anchor.ttx
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ttFont>
|
||||||
|
|
||||||
|
<GDEF>
|
||||||
|
<Version value="0x00010003"/>
|
||||||
|
<GlyphClassDef>
|
||||||
|
<ClassDef glyph="a" class="1"/>
|
||||||
|
<ClassDef glyph="macron" class="3"/>
|
||||||
|
</GlyphClassDef>
|
||||||
|
<VarStore Format="1">
|
||||||
|
<Format value="1"/>
|
||||||
|
<VarRegionList>
|
||||||
|
<!-- RegionAxisCount=2 -->
|
||||||
|
<!-- RegionCount=1 -->
|
||||||
|
<Region index="0">
|
||||||
|
<VarRegionAxis index="0">
|
||||||
|
<StartCoord value="0.0"/>
|
||||||
|
<PeakCoord value="0.875"/>
|
||||||
|
<EndCoord value="0.875"/>
|
||||||
|
</VarRegionAxis>
|
||||||
|
<VarRegionAxis index="1">
|
||||||
|
<StartCoord value="0.0"/>
|
||||||
|
<PeakCoord value="0.0"/>
|
||||||
|
<EndCoord value="0.0"/>
|
||||||
|
</VarRegionAxis>
|
||||||
|
</Region>
|
||||||
|
</VarRegionList>
|
||||||
|
<!-- VarDataCount=1 -->
|
||||||
|
<VarData index="0">
|
||||||
|
<!-- ItemCount=1 -->
|
||||||
|
<NumShorts value="0"/>
|
||||||
|
<!-- VarRegionCount=1 -->
|
||||||
|
<VarRegionIndex index="0" value="0"/>
|
||||||
|
<Item index="0" value="[2]"/>
|
||||||
|
</VarData>
|
||||||
|
</VarStore>
|
||||||
|
</GDEF>
|
||||||
|
|
||||||
|
<GPOS>
|
||||||
|
<Version value="0x00010000"/>
|
||||||
|
<ScriptList>
|
||||||
|
<!-- ScriptCount=0 -->
|
||||||
|
</ScriptList>
|
||||||
|
<FeatureList>
|
||||||
|
<!-- FeatureCount=0 -->
|
||||||
|
</FeatureList>
|
||||||
|
<LookupList>
|
||||||
|
<!-- LookupCount=2 -->
|
||||||
|
<Lookup index="0">
|
||||||
|
<LookupType value="4"/>
|
||||||
|
<LookupFlag value="0"/>
|
||||||
|
<!-- SubTableCount=1 -->
|
||||||
|
<MarkBasePos index="0" Format="1">
|
||||||
|
<MarkCoverage>
|
||||||
|
<Glyph value="macron"/>
|
||||||
|
</MarkCoverage>
|
||||||
|
<BaseCoverage>
|
||||||
|
<Glyph value="a"/>
|
||||||
|
</BaseCoverage>
|
||||||
|
<!-- ClassCount=1 -->
|
||||||
|
<MarkArray>
|
||||||
|
<!-- MarkCount=1 -->
|
||||||
|
<MarkRecord index="0">
|
||||||
|
<Class value="0"/>
|
||||||
|
<MarkAnchor Format="3">
|
||||||
|
<XCoordinate value="0"/>
|
||||||
|
<YCoordinate value="150"/>
|
||||||
|
<YDeviceTable>
|
||||||
|
<StartSize value="0"/>
|
||||||
|
<EndSize value="0"/>
|
||||||
|
<DeltaFormat value="32768"/>
|
||||||
|
</YDeviceTable>
|
||||||
|
</MarkAnchor>
|
||||||
|
</MarkRecord>
|
||||||
|
</MarkArray>
|
||||||
|
<BaseArray>
|
||||||
|
<!-- BaseCount=1 -->
|
||||||
|
<BaseRecord index="0">
|
||||||
|
<BaseAnchor index="0" Format="1">
|
||||||
|
<XCoordinate value="0"/>
|
||||||
|
<YCoordinate value="0"/>
|
||||||
|
</BaseAnchor>
|
||||||
|
</BaseRecord>
|
||||||
|
</BaseArray>
|
||||||
|
</MarkBasePos>
|
||||||
|
</Lookup>
|
||||||
|
<Lookup index="1">
|
||||||
|
<LookupType value="4"/>
|
||||||
|
<LookupFlag value="0"/>
|
||||||
|
<!-- SubTableCount=1 -->
|
||||||
|
<MarkBasePos index="0" Format="1">
|
||||||
|
<MarkCoverage>
|
||||||
|
<Glyph value="macron"/>
|
||||||
|
</MarkCoverage>
|
||||||
|
<BaseCoverage>
|
||||||
|
<Glyph value="a"/>
|
||||||
|
</BaseCoverage>
|
||||||
|
<!-- ClassCount=1 -->
|
||||||
|
<MarkArray>
|
||||||
|
<!-- MarkCount=1 -->
|
||||||
|
<MarkRecord index="0">
|
||||||
|
<Class value="0"/>
|
||||||
|
<MarkAnchor Format="3">
|
||||||
|
<XCoordinate value="0"/>
|
||||||
|
<YCoordinate value="150"/>
|
||||||
|
<YDeviceTable>
|
||||||
|
<StartSize value="0"/>
|
||||||
|
<EndSize value="0"/>
|
||||||
|
<DeltaFormat value="32768"/>
|
||||||
|
</YDeviceTable>
|
||||||
|
</MarkAnchor>
|
||||||
|
</MarkRecord>
|
||||||
|
</MarkArray>
|
||||||
|
<BaseArray>
|
||||||
|
<!-- BaseCount=1 -->
|
||||||
|
<BaseRecord index="0">
|
||||||
|
<BaseAnchor index="0" Format="1">
|
||||||
|
<XCoordinate value="0"/>
|
||||||
|
<YCoordinate value="0"/>
|
||||||
|
</BaseAnchor>
|
||||||
|
</BaseRecord>
|
||||||
|
</BaseArray>
|
||||||
|
</MarkBasePos>
|
||||||
|
</Lookup>
|
||||||
|
</LookupList>
|
||||||
|
</GPOS>
|
||||||
|
|
||||||
|
</ttFont>
|
Loading…
x
Reference in New Issue
Block a user