googlefonts / gftools

Misc tools for working with the Google Fonts library
Apache License 2.0
242 stars 71 forks source link

Split Italic and Roman VFs in builder #964

Closed simoncozens closed 3 months ago

simoncozens commented 3 months ago

Fixes #957.

We sometimes have source files containing an ital or slnt axis, but we require the onboarding of two separate fonts with Roman and Italic joined by style linking and STAT axis. This PR uses varLib.instancer to partially instance them along the relevant italic axis and then fixes them up accordingly.

Requires #963.

simoncozens commented 3 months ago

Got a couple of babelfont-related issues here which mean I can't use it; will rethink.

arrowtype commented 3 months ago

Would this accurately handle discrete (non-continuous) Italic axes, or is that a separate issue?

For example, I’d like to do the following:

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

This currently requires two designspace files, which pre-splits the axis between Roman and Italic sub-families. Luckily, this approach does seem to work well and create the STAT tables I want. Still, it requires some repeated information, which FontMake alone doesn’t require. I’m not sure how challenging this would be to map to the recipe logic of the Builder, though. If it’s not feasible, the builder still offers enough advantages that I would stick with it over directly using FontMake, but it would be handy to understand if the above axis setup is planned to be supported, or not.

Thanks for any insights!

simoncozens commented 3 months ago

It probably would handle that if you have a single VF which is subspacable. I'm not sure what fontmake would do with that kind of designspace right now. Another option is DS5 designspaces which allow you to generate multiple VFs from the same designspace, but we absolutely don't support those quite yet and I'm not sure what tooling generates them anyway.

anthrotype commented 3 months ago

fontmake supports building multiple VFS (sharing sources or axis subsets) from the same DSv5, it's handled in ufo2ft and fontTools.designspaceLib/varLib

DS5 designspaces which allow you to generate multiple VFs from the same designspace, but we absolutely don't support those quite yet and I'm not sure what tooling generates them anyway.

with since https://github.com/googlefonts/glyphsLib/pull/977 @khaledhosny added support for converting Glyphs.app's Variable Font Export Settings to DSv5 <variable-fonts>, which means technically a .glyphs project that has more than one such VF Export Setting, when compiled by fontmake will export more than one VF at a time. I think this is mostly to be able to set different custom parameters on a VF export, but I'm not sure if these Glyphs.app VF Export settings would allow one to define a particular axis range. Maybe @khaledhosny knows?

arrowtype commented 3 months ago

Glyphs.app's Variable Font Export Settings ... I think this is mostly to be able to set different custom parameters on a VF export, but I'm not sure if these Glyphs.app VF Export settings would allow one to define a particular axis range.

@anthrotype having used this feature quite a bit recently, it is basically there to define the naming info, for example, if the family name is different or suffixed from the general family name given to static exports (e.g. "Familyname Variable"). From what I can see, the VF export settings and custom parameters don’t yet give any options around defining subsetting axis ranges, unlike the <variable-fonts> elements of a DSv5.

emmamarichal commented 2 months ago

@simoncozens

I have a font with a backslant, where I need the backslant, and I have to get something like this: Myfont[slnt,wght].ttf. Now the builder split the file in two, and I would like to know how to change the stat table or anything in the build process to avoid this?

simoncozens commented 2 months ago

To keep a single file (turn off the splitting), set splitItalic: false in the config.yaml.

emmamarichal commented 2 months ago

Cool, thank you!