Add minimal avar test

This commit is contained in:
Just van Rossum 2023-06-25 16:09:05 +02:00
parent b4ce8177ec
commit a912f7d16f
2 changed files with 20 additions and 3 deletions

View File

@ -273,6 +273,16 @@
</GlobalSubrs> </GlobalSubrs>
</CFF2> </CFF2>
<avar>
<version major="1" minor="0"/>
<segment axis="TEST">
<mapping from="-1.0" to="-1.0"/>
<mapping from="0.0" to="0.0"/>
<mapping from="0.4" to="0.6"/>
<mapping from="1.0" to="1.0"/>
</segment>
</avar>
<fvar> <fvar>
<!-- Test Axis --> <!-- Test Axis -->

View File

@ -1,5 +1,6 @@
import os import os
import pytest import pytest
from fontTools.designspaceLib import AxisDescriptor
from fontTools.ttLib import TTFont from fontTools.ttLib import TTFont
from fontTools.pens.ttGlyphPen import TTGlyphPen from fontTools.pens.ttGlyphPen import TTGlyphPen
from fontTools.pens.t2CharStringPen import T2CharStringPen from fontTools.pens.t2CharStringPen import T2CharStringPen
@ -44,14 +45,20 @@ def _setupFontBuilder(isTTF, unitsPerEm=1024):
def _setupFontBuilderFvar(fb): def _setupFontBuilderFvar(fb):
assert "name" in fb.font, "Must run setupNameTable() first." assert "name" in fb.font, "Must run setupNameTable() first."
axes = [ testAxis = AxisDescriptor()
("TEST", 0, 0, 100, "Test Axis"), testAxis.name = "Test Axis"
] testAxis.tag = "TEST"
testAxis.minimum = 0
testAxis.default = 0
testAxis.maximum = 100
testAxis.map = [(0, 0), (40, 60), (100, 100)]
axes = [testAxis]
instances = [ instances = [
dict(location=dict(TEST=0), stylename="TotallyNormal"), dict(location=dict(TEST=0), stylename="TotallyNormal"),
dict(location=dict(TEST=100), stylename="TotallyTested"), dict(location=dict(TEST=100), stylename="TotallyTested"),
] ]
fb.setupFvar(axes, instances) fb.setupFvar(axes, instances)
fb.setupAvar(axes)
return fb return fb