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

"No default source" when I have a discrete axis map AND split variable fonts defined #1011

Open
arrowtype opened this issue Jul 5, 2023 · 2 comments

Comments

@arrowtype
Copy link

I’m currently using FontMake 3.6.0 (the current release).

I have a designspace which is building well with:

  • An ital axis with a mapping to make it a discrete, binary, on/off axis
  • A single variable font, including the full ital range

However, if I also add variable-font elements that use just one side or the other of the ital range (e.g. split roman vs italic VFs), I get an error.

INFO:fontmake.font_project:Building variable fonts variable_ttf/AT-NameSansVariable.ttf, variable_ttf/AT-NameSansVariable-Roman.ttf, variable_ttf/AT-NameSansVariable-Italic.ttf
fontmake: Error: In 'source/ArrowType-NameSans-Prep-v011/name_sans-wght_1_1000-opsz_12_96-ital_0_1--w_sparse_supports--unified.designspace': Generating fonts from Designspace failed: No default source; expected default master at Optical Size=8, Weight=700. Found master locations:

However, I do have a source at Optical Size=8, Weight=700:

    <source filename="Name_Sans-Text_Bold.ufo" familyname="AT Name Sans" stylename="Text Bold">
      <location>
        <dimension name="Optical Size" xvalue="8"/>
        <dimension name="Weight" xvalue="700"/>
        <dimension name="Italic" xvalue="0"/>
      </location>
    </source>

Here’s my ital axis and map:

    <axis tag="ital" name="Italic" minimum="0" maximum="1" default="0">
      <map input="1" output="1"/>
      <map input="0.5" output="1"/>
      <map input="0.49994" output="0"/>
      <map input="0" output="0"/>
      <labels>
        <label uservalue="0" name="Roman" elidable="true"/>
        <label uservalue="1" name="Italic"/>
      </labels>
    </axis>

Here’s my variable-fonts element:

  <variable-fonts>
    <variable-font name="AT-NameSansVariable">
      <axis-subsets>
        <axis-subset name="Optical Size"/>
        <axis-subset name="Weight"/>
        <axis-subset name="Italic"/>
      </axis-subsets>
    </variable-font>
    <variable-font name="AT-NameSansVariable-Roman">
      <axis-subsets>
        <axis-subset name="Optical Size"/>
        <axis-subset name="Weight"/>
        <axis-subset name="Italic" uservalue="0"/>
      </axis-subsets>
    </variable-font>
    <variable-font name="AT-NameSansVariable-Italic">
      <axis-subsets>
        <axis-subset name="Optical Size"/>
        <axis-subset name="Weight"/>
        <axis-subset name="Italic" uservalue="1"/>
      </axis-subsets>
    </variable-font>
  </variable-fonts>

If my variable fonts element is only the first font, things work fine, and that font compiles as expected:

  <variable-fonts>
    <variable-font name="AT-NameSansVariable">
      <axis-subsets>
        <axis-subset name="Optical Size"/>
        <axis-subset name="Weight"/>
        <axis-subset name="Italic"/>
      </axis-subsets>
    </variable-font>
  </variable-fonts>

Or, if I remove the mapping from my ital axis, all three variable fonts build as expected:

    <axis tag="ital" name="Italic" minimum="0" maximum="1" default="0">
      <labels>
        <label uservalue="0" name="Roman" elidable="true"/>
        <label uservalue="1" name="Italic"/>
      </labels>
    </axis>
image

As far as I understand things, this should all be working, with both the ital mapping and all three variable font outputs.

Here’s my full `axes` element, in case that is helpful. (Click to expand)
  <axes elidedfallbackname="Regular">
    <axis tag="opsz" name="Optical Size" minimum="8" maximum="72" default="8">
      <labelname xml:lang="en">Optical Size</labelname>
      <map input="72" output="72"/>
      <map input="20" output="40"/>
      <map input="8" output="8"/>
    </axis>
    <axis tag="wght" name="Weight" minimum="1" maximum="1000" default="700">
      <labelname xml:lang="en">Weight</labelname>
      <map input="1000" output="1000"/>
      <map input="900" output="850"/>
      <map input="800" output="775"/>
      <map input="700" output="700"/>
      <map input="600" output="600"/>
      <map input="500" output="500"/>
      <map input="400" output="400"/>
      <map input="300" output="300"/>
      <map input="200" output="200"/>
      <map input="100" output="100"/>
      <map input="50" output="50"/>
      <map input="1" output="1"/>
      <labels>
        <label uservalue="25" name="Hairline"/>
        <label uservalue="50" name="ExtraThin"/>
        <label uservalue="100" name="Thin"/>
        <label uservalue="200" name="ExtraLight"/>
        <label uservalue="300" name="Light"/>
        <label uservalue="400" name="Regular" elidable="true" linkeduservalue="700"/>
        <label uservalue="500" name="Medium"/>
        <label uservalue="600" name="SemiBold"/>
        <label uservalue="700" name="Bold" linkeduservalue="400"/>
        <label uservalue="800" name="ExtraBold"/>
        <label uservalue="900" name="Black"/>
        <label uservalue="1000" name="Ultra"/>
      </labels>
    </axis>
    <axis tag="ital" name="Italic" minimum="0" maximum="1" default="0">
      <map input="1" output="1"/>
      <map input="0.5" output="1"/>
      <map input="0.49994" output="0"/>
      <map input="0" output="0"/>
      <labels>
        <label uservalue="0" name="Roman" elidable="true"/>
        <label uservalue="1" name="Italic"/>
      </labels>
    </axis>
  </axes>

Am I doing something wrong, or missing something?

Thanks so much for any insights here!

@arrowtype
Copy link
Author

This seems related to #920, but slightly different. There, a variable font output is specified as having a location that doesn’t have a source at all (which should still work, IMO). While here, the location does have a source, but it’s just not the default location for the full designspace.

@belluzj
Copy link
Collaborator

belluzj commented Jul 6, 2023

In the error message from fontmake, after "Found master locations:" there's nothing, so it sounds like a bug in the function splitVariableFonts that may not preserve the correct sources in the italic-only designspace.

Could you either share your designspace file (axes + sources) or check on your side the following:

  • load your designspace in Python doc = DesignSpaceDocument.fromfile("some/path/to/my.designspace")

  • split it by variable font vfs = list(splitVariableFonts(doc))

  • inspect the vfs variable, which should be a list of 3 tuples, each tuple has in its second element a sub-designspace for the variable-font element from your input file. Each of these sub-designspaces should have the correct number of sources, that is:

    • all of them for the big VF
    • half of them for each of the uprights-only, italic-only VFs
    for vf in vfs:
        print("vf name = ", vf[0], "sources = ", vf[1].sources)

    From the error message I suspect you'll find the italic-only VF sub-designspace has no sources at all. Can you confirm?

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