Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Axis maps break variable font generation #42

Open
nicksherman opened this issue Jun 23, 2019 · 3 comments
Open

Axis maps break variable font generation #42

nicksherman opened this issue Jun 23, 2019 · 3 comments

Comments

@nicksherman
Copy link
Sponsor

nicksherman commented Jun 23, 2019

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

@LettError
Copy link
Collaborator

Related to fonttools/fonttools#1655

@LettError
Copy link
Collaborator

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.

@LettError
Copy link
Collaborator

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants