batchRoboFontExtension
batchRoboFontExtension copied to clipboard
Axis maps break variable font generation
When attempting to generate a variable font from a designSpace file that has axis maps, like so:
<axis tag="wght" name="Weight" minimum="300" maximum="700" default="400">
<labelname xml:lang="en">Weight</labelname>
<map input="300" output="340" />
<map input="500" output="485" />
<map input="600" output="575" />
</axis>
… the process fails without providing the usual Batch Generated Variable Fonts Report.txt or any readout in the Output window. In the log, I get the following traceback:
>> Traceback (most recent call last):
>> File "/Users/Nick/Library/Application Support/RoboFont/plugins/Batch.roboFontExt/lib/batchTools.py", line 115, in runTask_
>> File "/Users/Nick/Library/Application Support/RoboFont/plugins/Batch.roboFontExt/lib/variableFontGenerator/__init__.py", line 84, in run
>> File "/Users/Nick/Library/Application Support/RoboFont/plugins/Batch.roboFontExt/lib/variableFontGenerator/__init__.py", line 286, in generateVariationFont
>> File "/Users/Nick/Library/Application Support/RoboFont/plugins/Batch.roboFontExt/lib/variableFontGenerator/__init__.py", line 380, in makeMasterGlyphsCompatible
>> AttributeError: 'NoneType' object has no attribute 'name'
The same designSpace file with the axis maps removed generates a working variable font as expected.
I'm using Batch 1.9.8, run from RoboFont 3.3b (build 1905221146).
Here are some files to test the issue: Test.zip
Related to https://github.com/fonttools/fonttools/issues/1655
Keep in mind that the default value you set for an axis is in userspace coordinates. If you don't have a map, userspace == designspace value. Otherwise you need to make sure the default UFO is on the mapped value for the default. In your example. you have Test-Regular on weight=400, because that's what the axis default value is. But, the map for the weight axis says userspace 300 -> designspace 340 and userspace 500 -> designspace 485. That would put the 400 default around (340+485)*.5 = 412.
I would not trust a the floatinging point numbers to match necessarily, so add that to the map: 300, 340, 400, 412, 500, 485, 600, 575
The resulting space opens and previews in Skateboard. There may be further issues in generating a VF, but at least that issue is solved.
This now works with masters on 340, 412 and 750. Default master on 412.
<axis tag="wght" name="Weight" minimum="300" <beethe maximum="700" default="400">
<labelname xml:lang="en">Weight</labelname>
<map input="300" output="340"/>
<map input="400" output="412"/>
<map input="500" output="485"/>
<map input="600" output="575"/>
<map input="700" output="750"/>
</axis>
</axes>