[instancer/CFF2] Add test

This commit is contained in:
Behdad Esfahbod 2024-05-14 11:57:49 -06:00
parent cbec49c72c
commit 6d915fc816
3 changed files with 775 additions and 4 deletions

View File

@ -588,10 +588,6 @@ def instantiateCFF2(
cff.desubroutinize()
assert (
varStore is topDict.CharStrings.varStore.otVarStore
) # Who knows why it's in two places?!
def getNumRegions(vsindex):
return varStore.VarData[vsindex if vsindex is not None else 0].VarRegionCount
@ -1182,6 +1178,8 @@ def instantiateItemVariationStore(itemVarStore, fvarAxes, axisLimits):
newItemVarStore = tupleVarStore.asItemVarStore()
itemVarStore.VarRegionList = newItemVarStore.VarRegionList
if not hasattr(itemVarStore, "VarDataCount"): # Happens fromXML
itemVarStore.VarDataCount = len(newItemVarStore.VarData)
assert itemVarStore.VarDataCount == newItemVarStore.VarDataCount
itemVarStore.VarData = newItemVarStore.VarData

View File

@ -0,0 +1,729 @@
<?xml version="1.0" encoding="UTF-8"?>
<ttFont sfntVersion="OTTO" ttLibVersion="4.51">
<GlyphOrder>
<!-- The 'id' attribute is only for humans; it is ignored when parsed. -->
<GlyphID id="0" name=".notdef"/>
<GlyphID id="1" name="hyphen"/>
</GlyphOrder>
<head>
<!-- Most of this table will be recalculated by the compiler -->
<tableVersion value="1.0"/>
<fontRevision value="2.004"/>
<checkSumAdjustment value="0x9cb1a5ae"/>
<magicNumber value="0x5f0f3cf5"/>
<flags value="00000000 00000011"/>
<unitsPerEm value="1000"/>
<created value="Thu Apr 29 17:39:47 2021"/>
<modified value="Thu Apr 29 08:51:43 2021"/>
<xMin value="-991"/>
<yMin value="-1050"/>
<xMax value="2930"/>
<yMax value="1810"/>
<macStyle value="00000000 00000000"/>
<lowestRecPPEM value="3"/>
<fontDirectionHint value="2"/>
<indexToLocFormat value="0"/>
<glyphDataFormat value="0"/>
</head>
<hhea>
<tableVersion value="0x00010000"/>
<ascent value="1160"/>
<descent value="-288"/>
<lineGap value="0"/>
<advanceWidthMax value="3000"/>
<minLeftSideBearing value="-991"/>
<minRightSideBearing value="-519"/>
<xMaxExtent value="2930"/>
<caretSlopeRise value="1"/>
<caretSlopeRun value="0"/>
<caretOffset value="0"/>
<reserved0 value="0"/>
<reserved1 value="0"/>
<reserved2 value="0"/>
<reserved3 value="0"/>
<metricDataFormat value="0"/>
<numberOfHMetrics value="2"/>
</hhea>
<maxp>
<tableVersion value="0x5000"/>
<numGlyphs value="2"/>
</maxp>
<OS_2>
<!-- The fields 'usFirstCharIndex' and 'usLastCharIndex'
will be recalculated by the compiler -->
<version value="3"/>
<xAvgCharWidth value="989"/>
<usWeightClass value="100"/>
<usWidthClass value="5"/>
<fsType value="00000000 00000000"/>
<ySubscriptXSize value="650"/>
<ySubscriptYSize value="600"/>
<ySubscriptXOffset value="0"/>
<ySubscriptYOffset value="75"/>
<ySuperscriptXSize value="650"/>
<ySuperscriptYSize value="600"/>
<ySuperscriptXOffset value="0"/>
<ySuperscriptYOffset value="350"/>
<yStrikeoutSize value="50"/>
<yStrikeoutPosition value="325"/>
<sFamilyClass value="0"/>
<panose>
<bFamilyType value="2"/>
<bSerifStyle value="11"/>
<bWeight value="2"/>
<bProportion value="0"/>
<bContrast value="0"/>
<bStrokeVariation value="0"/>
<bArmStyle value="0"/>
<bLetterForm value="0"/>
<bMidline value="0"/>
<bXHeight value="0"/>
</panose>
<ulUnicodeRange1 value="00000000 00000000 00000000 00000001"/>
<ulUnicodeRange2 value="00000000 00000000 00000000 00000000"/>
<ulUnicodeRange3 value="00000000 00000000 00000000 00000000"/>
<ulUnicodeRange4 value="00000000 00000000 00000000 00000000"/>
<achVendID value="ADBO"/>
<fsSelection value="00000000 00000000"/>
<usFirstCharIndex value="45"/>
<usLastCharIndex value="45"/>
<sTypoAscender value="880"/>
<sTypoDescender value="-120"/>
<sTypoLineGap value="0"/>
<usWinAscent value="1160"/>
<usWinDescent value="288"/>
<ulCodePageRange1 value="00000000 00000000 00000000 00000001"/>
<ulCodePageRange2 value="00000000 00000000 00000000 00000000"/>
<sxHeight value="543"/>
<sCapHeight value="733"/>
<usDefaultChar value="0"/>
<usBreakChar value="32"/>
<usMaxContext value="6"/>
</OS_2>
<hmtx>
<mtx name=".notdef" width="1000" lsb="100"/>
<mtx name="hyphen" width="324" lsb="44"/>
</hmtx>
<cmap>
<tableVersion version="0"/>
<cmap_format_4 platformID="0" platEncID="3" language="0">
<map code="0x2d" name="hyphen"/><!-- HYPHEN-MINUS -->
</cmap_format_4>
<cmap_format_4 platformID="3" platEncID="1" language="0">
<map code="0x2d" name="hyphen"/><!-- HYPHEN-MINUS -->
</cmap_format_4>
</cmap>
<name>
<namerecord nameID="0" platformID="3" platEncID="1" langID="0x409">
© 2014-2021 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'.
</namerecord>
<namerecord nameID="1" platformID="3" platEncID="1" langID="0x409">
Noto Sans SC
</namerecord>
<namerecord nameID="2" platformID="3" platEncID="1" langID="0x409">
Regular
</namerecord>
<namerecord nameID="3" platformID="3" platEncID="1" langID="0x409">
2.004;ADBO;NotoSansSC-Thin;ADOBE
</namerecord>
<namerecord nameID="4" platformID="3" platEncID="1" langID="0x409">
Noto Sans SC
</namerecord>
<namerecord nameID="5" platformID="3" platEncID="1" langID="0x409">
Version 2.004;hotconv 1.0.118;makeotfexe 2.5.65603
</namerecord>
<namerecord nameID="6" platformID="3" platEncID="1" langID="0x409">
NotoSansSC-Thin
</namerecord>
<namerecord nameID="256" platformID="3" platEncID="1" langID="0x409">
Regular
</namerecord>
<namerecord nameID="258" platformID="3" platEncID="1" langID="0x409">
Thin
</namerecord>
<namerecord nameID="259" platformID="3" platEncID="1" langID="0x409">
Light
</namerecord>
<namerecord nameID="260" platformID="3" platEncID="1" langID="0x409">
DemiLight
</namerecord>
<namerecord nameID="261" platformID="3" platEncID="1" langID="0x409">
Regular
</namerecord>
<namerecord nameID="262" platformID="3" platEncID="1" langID="0x409">
Medium
</namerecord>
<namerecord nameID="263" platformID="3" platEncID="1" langID="0x409">
Bold
</namerecord>
<namerecord nameID="264" platformID="3" platEncID="1" langID="0x409">
Black
</namerecord>
<namerecord nameID="265" platformID="3" platEncID="1" langID="0x409">
Weight
</namerecord>
<namerecord nameID="266" platformID="3" platEncID="1" langID="0x409">
Thin
</namerecord>
<namerecord nameID="267" platformID="3" platEncID="1" langID="0x409">
NotoSansSC-Thin
</namerecord>
<namerecord nameID="268" platformID="3" platEncID="1" langID="0x409">
Light
</namerecord>
<namerecord nameID="269" platformID="3" platEncID="1" langID="0x409">
NotoSansSC-Light
</namerecord>
<namerecord nameID="270" platformID="3" platEncID="1" langID="0x409">
DemiLight
</namerecord>
<namerecord nameID="271" platformID="3" platEncID="1" langID="0x409">
NotoSansSC-DemiLight
</namerecord>
<namerecord nameID="272" platformID="3" platEncID="1" langID="0x409">
Regular
</namerecord>
<namerecord nameID="273" platformID="3" platEncID="1" langID="0x409">
NotoSansSC-Regular
</namerecord>
<namerecord nameID="274" platformID="3" platEncID="1" langID="0x409">
Medium
</namerecord>
<namerecord nameID="275" platformID="3" platEncID="1" langID="0x409">
NotoSansSC-Medium
</namerecord>
<namerecord nameID="276" platformID="3" platEncID="1" langID="0x409">
Bold
</namerecord>
<namerecord nameID="277" platformID="3" platEncID="1" langID="0x409">
NotoSansSC-Bold
</namerecord>
<namerecord nameID="278" platformID="3" platEncID="1" langID="0x409">
Black
</namerecord>
<namerecord nameID="279" platformID="3" platEncID="1" langID="0x409">
NotoSansSC-Black
</namerecord>
</name>
<post>
<formatType value="3.0"/>
<italicAngle value="0.0"/>
<underlinePosition value="-125"/>
<underlineThickness value="50"/>
<isFixedPitch value="0"/>
<minMemType42 value="0"/>
<maxMemType42 value="0"/>
<minMemType1 value="0"/>
<maxMemType1 value="0"/>
</post>
<CFF2>
<major value="2"/>
<minor value="0"/>
<CFFFont name="CFF2Font">
<FontMatrix value="0.001 0 0 0.001 0 0"/>
<FDSelect format="0"/>
<FDArray>
<FontDict index="0">
<Private>
<BlueValues value="-250 -250 1100 1100"/>
<BlueScale value="0.039625"/>
<BlueShift value="7"/>
<BlueFuzz value="1"/>
<StdHW value="35"/>
<StdVW value="28"/>
<StemSnapV value="28 46"/>
<LanguageGroup value="1"/>
<ExpansionFactor value="0.06"/>
</Private>
</FontDict>
<FontDict index="1">
<Private>
<BlueValues value="-250 -250 1100 1100"/>
<BlueScale value="0.039625"/>
<BlueShift value="7"/>
<BlueFuzz value="1"/>
<StdHW value="35"/>
<StdVW value="28"/>
<StemSnapV value="28 46"/>
<LanguageGroup value="0"/>
<ExpansionFactor value="0.06"/>
</Private>
</FontDict>
</FDArray>
<CharStrings>
<CharString name=".notdef" fdSelectIndex="0">
</CharString>
<CharString name="hyphen" fdSelectIndex="1">
44 256 6 -29 2 blend
rmoveto
239 35 -239 44 90 -44 3 blend
hlineto
</CharString>
</CharStrings>
<VarStore Format="1">
<Format value="1"/>
<VarRegionList>
<!-- RegionAxisCount=1 -->
<!-- RegionCount=1 -->
<Region index="0">
<VarRegionAxis index="0">
<StartCoord value="0.0"/>
<PeakCoord value="1.0"/>
<EndCoord value="1.0"/>
</VarRegionAxis>
</Region>
</VarRegionList>
<!-- VarDataCount=1 -->
<VarData index="0">
<!-- ItemCount=0 -->
<NumShorts value="0"/>
<!-- VarRegionCount=1 -->
<VarRegionIndex index="0" value="0"/>
</VarData>
</VarStore>
</CFFFont>
<GlobalSubrs>
<!-- The 'index' attribute is only for humans; it is ignored when parsed. -->
</GlobalSubrs>
</CFF2>
<GPOS>
<Version value="0x00010000"/>
<ScriptList>
<!-- ScriptCount=6 -->
<ScriptRecord index="0">
<ScriptTag value="DFLT"/>
<Script>
<DefaultLangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=1 -->
<FeatureIndex index="0" value="0"/>
</DefaultLangSys>
<!-- LangSysCount=0 -->
</Script>
</ScriptRecord>
<ScriptRecord index="1">
<ScriptTag value="cyrl"/>
<Script>
<DefaultLangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=1 -->
<FeatureIndex index="0" value="1"/>
</DefaultLangSys>
<!-- LangSysCount=0 -->
</Script>
</ScriptRecord>
<ScriptRecord index="2">
<ScriptTag value="grek"/>
<Script>
<DefaultLangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=1 -->
<FeatureIndex index="0" value="2"/>
</DefaultLangSys>
<!-- LangSysCount=0 -->
</Script>
</ScriptRecord>
<ScriptRecord index="3">
<ScriptTag value="hani"/>
<Script>
<DefaultLangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=1 -->
<FeatureIndex index="0" value="3"/>
</DefaultLangSys>
<!-- LangSysCount=0 -->
</Script>
</ScriptRecord>
<ScriptRecord index="4">
<ScriptTag value="kana"/>
<Script>
<DefaultLangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=1 -->
<FeatureIndex index="0" value="4"/>
</DefaultLangSys>
<!-- LangSysCount=0 -->
</Script>
</ScriptRecord>
<ScriptRecord index="5">
<ScriptTag value="latn"/>
<Script>
<DefaultLangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=1 -->
<FeatureIndex index="0" value="5"/>
</DefaultLangSys>
<!-- LangSysCount=0 -->
</Script>
</ScriptRecord>
</ScriptList>
<FeatureList>
<!-- FeatureCount=6 -->
<FeatureRecord index="0">
<FeatureTag value="kern"/>
<Feature>
<!-- LookupCount=1 -->
<LookupListIndex index="0" value="0"/>
</Feature>
</FeatureRecord>
<FeatureRecord index="1">
<FeatureTag value="kern"/>
<Feature>
<!-- LookupCount=1 -->
<LookupListIndex index="0" value="0"/>
</Feature>
</FeatureRecord>
<FeatureRecord index="2">
<FeatureTag value="kern"/>
<Feature>
<!-- LookupCount=1 -->
<LookupListIndex index="0" value="0"/>
</Feature>
</FeatureRecord>
<FeatureRecord index="3">
<FeatureTag value="kern"/>
<Feature>
<!-- LookupCount=1 -->
<LookupListIndex index="0" value="0"/>
</Feature>
</FeatureRecord>
<FeatureRecord index="4">
<FeatureTag value="kern"/>
<Feature>
<!-- LookupCount=1 -->
<LookupListIndex index="0" value="0"/>
</Feature>
</FeatureRecord>
<FeatureRecord index="5">
<FeatureTag value="kern"/>
<Feature>
<!-- LookupCount=1 -->
<LookupListIndex index="0" value="0"/>
</Feature>
</FeatureRecord>
</FeatureList>
<LookupList>
<!-- LookupCount=1 -->
<Lookup index="0">
<LookupType value="2"/>
<LookupFlag value="0"/>
<!-- SubTableCount=1 -->
<PairPos index="0" Format="2">
<Coverage>
<Glyph value="hyphen"/>
</Coverage>
<ValueFormat1 value="68"/>
<ValueFormat2 value="0"/>
<ClassDef1>
</ClassDef1>
<ClassDef2>
<ClassDef glyph="hyphen" class="1"/>
</ClassDef2>
<!-- Class1Count=1 -->
<!-- Class2Count=2 -->
<Class1Record index="0">
<Class2Record index="0">
<Value1 XAdvance="0"/>
</Class2Record>
<Class2Record index="1">
<Value1 XAdvance="0"/>
</Class2Record>
</Class1Record>
</PairPos>
</Lookup>
</LookupList>
</GPOS>
<GSUB>
<Version value="0x00010000"/>
<ScriptList>
<!-- ScriptCount=6 -->
<ScriptRecord index="0">
<ScriptTag value="DFLT"/>
<Script>
<DefaultLangSys>
<ReqFeatureIndex value="65535"/>
<!-- FeatureCount=0 -->
</DefaultLangSys>
<!-- LangSysCount=0 -->
</Script>
</ScriptRecord>
<ScriptRecord index="1">
<ScriptTag value="cyrl"/>
<Script>
<!-- LangSysCount=0 -->
</Script>
</ScriptRecord>
<ScriptRecord index="2">
<ScriptTag value="grek"/>
<Script>
<!-- LangSysCount=0 -->
</Script>
</ScriptRecord>
<ScriptRecord index="3">
<ScriptTag value="hani"/>
<Script>
<!-- LangSysCount=0 -->
</Script>
</ScriptRecord>
<ScriptRecord index="4">
<ScriptTag value="kana"/>
<Script>
<!-- LangSysCount=0 -->
</Script>
</ScriptRecord>
<ScriptRecord index="5">
<ScriptTag value="latn"/>
<Script>
<!-- LangSysCount=0 -->
</Script>
</ScriptRecord>
</ScriptList>
<FeatureList>
<!-- FeatureCount=0 -->
</FeatureList>
<LookupList>
<!-- LookupCount=0 -->
</LookupList>
</GSUB>
<HVAR>
<Version value="0x00010000"/>
<VarStore Format="1">
<Format value="1"/>
<VarRegionList>
<!-- RegionAxisCount=1 -->
<!-- RegionCount=1 -->
<Region index="0">
<VarRegionAxis index="0">
<StartCoord value="0.0"/>
<PeakCoord value="1.0"/>
<EndCoord value="1.0"/>
</VarRegionAxis>
</Region>
</VarRegionList>
<!-- VarDataCount=1 -->
<VarData index="0">
<!-- ItemCount=2 -->
<NumShorts value="0"/>
<!-- VarRegionCount=1 -->
<VarRegionIndex index="0" value="0"/>
<Item index="0" value="[0]"/>
<Item index="1" value="[59]"/>
</VarData>
</VarStore>
</HVAR>
<STAT>
<Version value="0x00010001"/>
<DesignAxisRecordSize value="8"/>
<!-- DesignAxisCount=1 -->
<DesignAxisRecord>
<Axis index="0">
<AxisTag value="wght"/>
<AxisNameID value="265"/> <!-- Weight -->
<AxisOrdering value="0"/>
</Axis>
</DesignAxisRecord>
<!-- AxisValueCount=7 -->
<AxisValueArray>
<AxisValue index="0" Format="2">
<AxisIndex value="0"/>
<Flags value="0"/>
<ValueNameID value="258"/> <!-- Thin -->
<NominalValue value="100.0"/>
<RangeMinValue value="100.0"/>
<RangeMaxValue value="199.0"/>
</AxisValue>
<AxisValue index="1" Format="2">
<AxisIndex value="0"/>
<Flags value="0"/>
<ValueNameID value="259"/> <!-- Light -->
<NominalValue value="300.0"/>
<RangeMinValue value="200.0"/>
<RangeMaxValue value="349.0"/>
</AxisValue>
<AxisValue index="2" Format="2">
<AxisIndex value="0"/>
<Flags value="0"/>
<ValueNameID value="260"/> <!-- DemiLight -->
<NominalValue value="350.0"/>
<RangeMinValue value="350.0"/>
<RangeMaxValue value="399.0"/>
</AxisValue>
<AxisValue index="3" Format="2">
<AxisIndex value="0"/>
<Flags value="2"/> <!-- ElidableAxisValueName -->
<ValueNameID value="261"/> <!-- Regular -->
<NominalValue value="400.0"/>
<RangeMinValue value="400.0"/>
<RangeMaxValue value="499.0"/>
</AxisValue>
<AxisValue index="4" Format="2">
<AxisIndex value="0"/>
<Flags value="0"/>
<ValueNameID value="262"/> <!-- Medium -->
<NominalValue value="500.0"/>
<RangeMinValue value="500.0"/>
<RangeMaxValue value="650.0"/>
</AxisValue>
<AxisValue index="5" Format="2">
<AxisIndex value="0"/>
<Flags value="0"/>
<ValueNameID value="263"/> <!-- Bold -->
<NominalValue value="700.0"/>
<RangeMinValue value="650.0"/>
<RangeMaxValue value="800.0"/>
</AxisValue>
<AxisValue index="6" Format="2">
<AxisIndex value="0"/>
<Flags value="0"/>
<ValueNameID value="264"/> <!-- Black -->
<NominalValue value="900.0"/>
<RangeMinValue value="800.0"/>
<RangeMaxValue value="900.0"/>
</AxisValue>
</AxisValueArray>
<ElidedFallbackNameID value="256"/> <!-- Regular -->
</STAT>
<VORG>
<majorVersion value="1"/>
<minorVersion value="0"/>
<defaultVertOriginY value="880"/>
<numVertOriginYMetrics value="0"/>
</VORG>
<VVAR>
<Version value="0x00010000"/>
<VarStore Format="1">
<Format value="1"/>
<VarRegionList>
<!-- RegionAxisCount=1 -->
<!-- RegionCount=0 -->
</VarRegionList>
<!-- VarDataCount=1 -->
<VarData index="0">
<!-- ItemCount=1 -->
<NumShorts value="0"/>
<!-- VarRegionCount=0 -->
<Item index="0" value="[]"/>
</VarData>
</VarStore>
<AdvHeightMap>
<Map glyph=".notdef" outer="0" inner="0"/>
<Map glyph="hyphen" outer="0" inner="0"/>
</AdvHeightMap>
<VOrgMap>
<Map glyph=".notdef" outer="0" inner="0"/>
<Map glyph="hyphen" outer="0" inner="0"/>
</VOrgMap>
</VVAR>
<avar>
<version major="1" minor="0"/>
<segment axis="wght">
<mapping from="-1.0" to="-1.0"/>
<mapping from="0.0" to="0.0"/>
<mapping from="0.25" to="0.16"/>
<mapping from="0.3125" to="0.32"/>
<mapping from="0.375" to="0.39"/>
<mapping from="0.5" to="0.56"/>
<mapping from="0.75" to="0.78"/>
<mapping from="1.0" to="1.0"/>
</segment>
</avar>
<fvar>
<!-- Weight -->
<Axis>
<AxisTag>wght</AxisTag>
<Flags>0x0</Flags>
<MinValue>100.0</MinValue>
<DefaultValue>100.0</DefaultValue>
<MaxValue>900.0</MaxValue>
<AxisNameID>265</AxisNameID>
</Axis>
<!-- Thin -->
<!-- PostScript: NotoSansSC-Thin -->
<NamedInstance flags="0x0" postscriptNameID="267" subfamilyNameID="266">
<coord axis="wght" value="100.0"/>
</NamedInstance>
<!-- Light -->
<!-- PostScript: NotoSansSC-Light -->
<NamedInstance flags="0x0" postscriptNameID="269" subfamilyNameID="268">
<coord axis="wght" value="300.0"/>
</NamedInstance>
<!-- DemiLight -->
<!-- PostScript: NotoSansSC-DemiLight -->
<NamedInstance flags="0x0" postscriptNameID="271" subfamilyNameID="270">
<coord axis="wght" value="350.0"/>
</NamedInstance>
<!-- Regular -->
<!-- PostScript: NotoSansSC-Regular -->
<NamedInstance flags="0x0" postscriptNameID="273" subfamilyNameID="272">
<coord axis="wght" value="400.0"/>
</NamedInstance>
<!-- Medium -->
<!-- PostScript: NotoSansSC-Medium -->
<NamedInstance flags="0x0" postscriptNameID="275" subfamilyNameID="274">
<coord axis="wght" value="500.0"/>
</NamedInstance>
<!-- Bold -->
<!-- PostScript: NotoSansSC-Bold -->
<NamedInstance flags="0x0" postscriptNameID="277" subfamilyNameID="276">
<coord axis="wght" value="700.0"/>
</NamedInstance>
<!-- Black -->
<!-- PostScript: NotoSansSC-Black -->
<NamedInstance flags="0x0" postscriptNameID="279" subfamilyNameID="278">
<coord axis="wght" value="900.0"/>
</NamedInstance>
</fvar>
<vhea>
<tableVersion value="0x00011000"/>
<ascent value="500"/>
<descent value="-500"/>
<lineGap value="0"/>
<advanceHeightMax value="3000"/>
<minTopSideBearing value="-172"/>
<minBottomSideBearing value="-648"/>
<yMaxExtent value="2930"/>
<caretSlopeRise value="0"/>
<caretSlopeRun value="1"/>
<caretOffset value="0"/>
<reserved1 value="0"/>
<reserved2 value="0"/>
<reserved3 value="0"/>
<reserved4 value="0"/>
<metricDataFormat value="0"/>
<numberOfVMetrics value="1"/>
</vhea>
<vmtx>
<mtx name=".notdef" height="1000" tsb="0"/>
<mtx name="hyphen" height="1000" tsb="589"/>
</vmtx>
</ttFont>

View File

@ -63,6 +63,50 @@ def _get_coordinates(varfont, glyphname):
)
class InstantiateCFF2Test(object):
@pytest.mark.parametrize(
"location, expected",
[
(
{},
[
44,
256,
6,
-29,
2,
"blend",
"rmoveto",
239,
35,
-239,
44,
90,
-44,
3,
"blend",
"hlineto",
],
),
({"wght": 0}, [44, 256, "rmoveto", 239, 35, -239, "hlineto"]),
({"wght": 0.5}, [47, 242, "rmoveto", 261, 80, -261, "hlineto"]),
({"wght": 1}, [50, 227, "rmoveto", 283, 125, -283, "hlineto"]),
],
)
def test_pin_and_drop_axis(self, varfont, location, expected):
varfont = ttLib.TTFont()
varfont.importXML(os.path.join(TESTDATA, "CFF2Instancer-VF.ttx"))
location = instancer.NormalizedAxisLimits(location)
instancer.instantiateCFF2(varfont, location)
instancer.instantiateHVAR(varfont, location)
program = varfont["CFF2"].cff.topDictIndex[0].CharStrings.values()[1].program
assert program == expected
class InstantiateGvarTest(object):
@pytest.mark.parametrize("glyph_name", ["hyphen"])
@pytest.mark.parametrize(