googlefonts / ufo2ft

A bridge from UFOs to FontTools objects (and therefore, OTFs and TTFs).
MIT License
151 stars 43 forks source link

Fix variable anchors when DesignSpace source specifies a layer #842

Closed khaledhosny closed 4 months ago

khaledhosny commented 4 months ago

The anchor position was always taken from the default layer, ignoring the specified layerName.

anthrotype commented 4 months ago

good catch! this is basically the continuation of https://github.com/googlefonts/ufo2ft/pull/840 but for the sparse UFO layers

@khaledhosny can you please also test that my assumption in https://github.com/googlefonts/fontmake/pull/1090#issuecomment-2107288620 is true?

anthrotype commented 4 months ago

can you please also test that my assumption in https://github.com/googlefonts/fontmake/pull/1090#issuecomment-2107288620 is true?

I just tried to remove the anchor "top" from the intermediate glyph "e" in the LayerFont.ufo's "Medium" layer used for the VF integration tests and indeed the intermediate glyph is skipped when producing the mark2base lookup.

  feature mark {
      lookup mark2base {
          pos base e
-             <anchor (wght=350:314 wght=450:403 wght=625:315) (wght=350:556 wght=450:567 wght=625:644)> mark @MC_top;
+             <anchor (wght=350:314 wght=625:315) (wght=350:556 wght=625:644)> mark @MC_top;
      } mark2base;

  } mark;