gftools icon indicating copy to clipboard operation
gftools copied to clipboard

[builder] Can the builder accept FontMake args?

Open arrowtype opened this issue 3 years ago • 1 comments

Context

I have a problem with features and building variable plus static fonts:

  1. I want to write fea code in only one place, then reference that from multiple UFOs, using fea code like include(./features/locl.fea); (which would reference a file within a features directory at the same level as the UFO
  2. The relative reference paths are different for variable builds and static builds. For variable builds, the references can be at the same level as the UFO, like ./features/locl.fea. However, for static builds, FontMake starts by interpolating UFOs and puts them into the subdirectory instances, so relative paths then need to be like ../features/locl.fea to go up one level, then into the features directory.

FontMake has a solution for this via the arg --expand-features-to-instances:

expand_features_to_instances: parses the master feature file, expands all
include()s and writes the resulting full feature file to all instance
UFOs. Use this if you share feature files among masters in external
files. Otherwise, the relative include paths can break as instances
may end up elsewhere. Only done on interpolation.

I am specifically trying to use the Ninja Builder to see if it will build a large family more quickly than my current shell script. My script is using FontMake to build 108 static fonts, so things are taking 45 minutes or more. 😬 Making it faster would really help my workflow for debugging technical issues reported by FontBakery, etc.

Questions

  1. Is there a way to feed fontmake args to the gftools builder?

    1. If not, is there another simple way to solve my issue? I guess I could use a script to expand the features into my UFOs in a pre-build step, if nothing else... Is there an existing script for this, or should I look at how FontMake does it and adapt that into my own script? I'm happy to get suggestions here, even if you don't know a full answer!
  2. Can I give the builder args if I am pointing it to a designspace rather than a config.yaml file? For example, can I do something like: gftools builder sources/family.designspace --outputdir fonts-gftools-builder?

    1. If not, is there a semi-automated way to start a config.yaml file from a designspace?

arrowtype avatar Jun 28 '22 21:06 arrowtype

I recommend that gftools builder set that --expand-features-to-instances option by default when making static instances with fontmake. We didn't enable it by default in fontmake to not break people workflows that relied on it being disabled bit honestly I think it should just be always on.

anthrotype avatar Jun 29 '22 06:06 anthrotype