varLib_test: test building (pseudo) VF with only a single master

The SingleMaster.designspace contains only one source master, so there is no real
variation data.
Still, and empty HVAR table is added (with RegionAxisCount == fvar.AxisCount).
The gvar and cvar table are not added in this case, since they are empty and
not required.
This commit is contained in:
Cosimo Lupo 2019-10-24 14:10:08 +01:00
parent 4eee7c071d
commit 141ff20b37
No known key found for this signature in database
GPG Key ID: 20D4A261E4A0E642
3 changed files with 120 additions and 0 deletions

View File

@ -0,0 +1,13 @@
<?xml version='1.0' encoding='utf-8'?>
<designspace format="3">
<axes>
<axis default="400" maximum="400" minimum="400" name="weight" tag="wght" />
</axes>
<sources>
<source familyname="Test Family" filename="master_ufo/TestFamily-Master0.ufo" name="master_0">
<location>
<dimension name="weight" xvalue="400" />
</location>
</source>
</sources>
</designspace>

View File

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<ttFont sfntVersion="\x00\x01\x00\x00" ttLibVersion="4.0">
<GDEF>
<Version value="0x00010003"/>
<GlyphClassDef Format="2">
<ClassDef glyph="uni0024" class="1"/>
<ClassDef glyph="uni0024.nostroke" class="1"/>
<ClassDef glyph="uni0041" class="1"/>
<ClassDef glyph="uni0061" class="1"/>
</GlyphClassDef>
</GDEF>
<HVAR>
<Version value="0x00010000"/>
<VarStore Format="1">
<Format value="1"/>
<VarRegionList>
<!-- RegionAxisCount=1 -->
<!-- RegionCount=0 -->
</VarRegionList>
<!-- VarDataCount=1 -->
<VarData index="0">
<!-- ItemCount=6 -->
<NumShorts value="0"/>
<!-- VarRegionCount=0 -->
<Item index="0" value="[]"/>
<Item index="1" value="[]"/>
<Item index="2" value="[]"/>
<Item index="3" value="[]"/>
<Item index="4" value="[]"/>
<Item index="5" value="[]"/>
</VarData>
</VarStore>
</HVAR>
<STAT>
<Version value="0x00010001"/>
<DesignAxisRecordSize value="8"/>
<!-- DesignAxisCount=1 -->
<DesignAxisRecord>
<Axis index="0">
<AxisTag value="wght"/>
<AxisNameID value="256"/> <!-- Weight -->
<AxisOrdering value="0"/>
</Axis>
</DesignAxisRecord>
<!-- AxisValueCount=0 -->
<ElidedFallbackNameID value="2"/> <!-- Regular -->
</STAT>
<fvar>
<!-- Weight -->
<Axis>
<AxisTag>wght</AxisTag>
<Flags>0x0</Flags>
<MinValue>400.0</MinValue>
<DefaultValue>400.0</DefaultValue>
<MaxValue>400.0</MaxValue>
<AxisNameID>256</AxisNameID>
</Axis>
</fvar>
<name>
<namerecord nameID="256" platformID="1" platEncID="0" langID="0x0" unicode="True">
Weight
</namerecord>
<namerecord nameID="1" platformID="3" platEncID="1" langID="0x409">
Test Family
</namerecord>
<namerecord nameID="2" platformID="3" platEncID="1" langID="0x409">
Regular
</namerecord>
<namerecord nameID="3" platformID="3" platEncID="1" langID="0x409">
Version 1.001;ADBO;Test Family Regular
</namerecord>
<namerecord nameID="4" platformID="3" platEncID="1" langID="0x409">
Test Family
</namerecord>
<namerecord nameID="5" platformID="3" platEncID="1" langID="0x409">
Version 1.001
</namerecord>
<namerecord nameID="6" platformID="3" platEncID="1" langID="0x409">
TestFamily-Master0
</namerecord>
<namerecord nameID="9" platformID="3" platEncID="1" langID="0x409">
Frank Grießhammer
</namerecord>
<namerecord nameID="17" platformID="3" platEncID="1" langID="0x409">
Master 0
</namerecord>
<namerecord nameID="256" platformID="3" platEncID="1" langID="0x409">
Weight
</namerecord>
</name>
</ttFont>

View File

@ -584,6 +584,15 @@ class BuildTest(unittest.TestCase):
self.expect_ttx(varfont, expected_ttx_path, tables)
self.check_ttx_dump(varfont, expected_ttx_path, tables, suffix)
def test_varlib_build_single_master(self):
self._run_varlib_build_test(
designspace_name='SingleMaster',
font_name='TestFamily',
tables=['GDEF', 'HVAR', 'MVAR', 'STAT', 'fvar', 'cvar', 'gvar', 'name'],
expected_ttx_name='SingleMaster',
save_before_dump=True,
)
def test_kerning_merging(self):
"""Test the correct merging of class-based pair kerning.