googlefonts / fontc

Where in we pursue oxidizing (context: https://github.com/googlefonts/oxidize) fontmake.
Apache License 2.0
62 stars 10 forks source link

.designspace axis with discrete values panics #836

Open jenskutilek opened 1 month ago

jenskutilek commented 1 month ago

I have a designspace that contains an Italic axis with discrete values, as should be pretty common:

<axis tag="ital" name="Italic" default="0" values="0 1">
  <labels ordering="2">
    <label uservalue="0" name="Upright" elidable="true" linkeduservalue="1"/>
    <label uservalue="1" name="Italic"/>
  </labels>
</axis>

Result:

fontc --keep-direction MyVar.designspace
thread 'main' panicked at ufo2fontir/src/toir.rs:117:43:
called `Option::unwrap()` on a `None` value

It seems that the code doesn't work when an axis doesn't have the minimum and maximum attributes, even though they are not required for a discrete axis.

anthrotype commented 1 month ago

fontc currently does not support discrete axes or any of the features introduced with designspace version 5, it expects that there is a 1:1 correspondence between a single input .designspace file and one output VF. With discrete axes there can be 1:N. We are prioritizing stuff that is actually being used in the GF collection and didn't find much evidence of discrete axes and other DSv5 features. However we do plan to add support for them, it's being tracked here https://github.com/googlefonts/fontc/issues/837

anthrotype commented 1 month ago

I think fonttools designspaceLib can split that DSv5 into individual DSv4-compatible designspaces, I suggest you try doing that for the time being, until we implement full support for this in fontc.

https://github.com/fonttools/fonttools/blob/4193aeaa266c2675f1c3c0dda477e0697c990ec9/Lib/fontTools/designspaceLib/split.py#L158-L172

jenskutilek commented 1 month ago

Thanks for your explanation. I couldn't find any specific info about which DS version is supported, so I assumed v5 would be fine. But it's true that you won't get to see any v5 designspace in a workflow starting from Glyphs files.

anthrotype commented 1 month ago

it's true that you won't get to see any v5 designspace in a workflow starting from Glyphs files.

actually if you use multiple Variable Font export settings (in the old instances tab of font info), then glyphsLib will add multiple <variable-font> elements to the exported DS which is also a v5 only feature, the ability to produce multiple VFs from a single DS source file

jenskutilek commented 1 month ago

Interesting, didn't know that