googlefonts / glyphsLib

A bridge from Glyphs source files (.glyphs) to UFOs
Apache License 2.0
178 stars 51 forks source link

Support *origin special anchor #997

Open anthrotype opened 2 months ago

anthrotype commented 2 months ago

While working on https://github.com/googlefonts/fontc/issues/769, we realised that glyphsLib (and hence fontmake) currently don't handle the *origin anchors.

These are sometimes used for glyphs that are used as components in other composite glyphs. The positon of this specially named *origin anchor becomes the new glyph origin, meaning that the entire glyph gets shifted (all its point coordinates and components and anchors are subtracted by the *origin offset). Composite glyphs using these as components and which do NOT use the component automatic alignement feature will also be influenced by the presence of this special anchor, ie. the component whose base glyph contains the *origin anchor gets shifted accordingly (not because the component transform changed, but because the base glyph itself moves to the new origin). This special anchor also influences the anchor propagation algorithm, because composites would inherit the anchors from the components with the *origin anchor offset already applied.