Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird anchor propagation / compatibility thing #794

Closed
simoncozens opened this issue Jul 7, 2022 · 4 comments
Closed

Weird anchor propagation / compatibility thing #794

simoncozens opened this issue Jul 7, 2022 · 4 comments

Comments

@simoncozens
Copy link
Collaborator

Noto Serif Devanagari doesn't build as a variable font any more (see run) due to apparent incompatibilities. They're not showing as incompatible in the Glyphs file, but when I try to build I get lots of these:

ERROR:fontmake.compatibility:Fonts had differing anchors in glyph nukta_halant-deva:
ERROR:fontmake.compatibility: * 7 fonts had "_bottom, nukta"
ERROR:fontmake.compatibility: * Noto Serif Devanagari Condensed Light had "_bottom, _nukta, nukta"

ERROR:fontmake.compatibility:Fonts had differing anchors in glyph nukta_llVocalicMatra-deva:
ERROR:fontmake.compatibility: * Noto Serif Devanagari Light, Noto Serif Devanagari Condensed Light, Noto Serif Devanagari Condensed, Noto Serif Devanagari Bold Condensed had "_bottom, _nukta, nukta"
ERROR:fontmake.compatibility: * Noto Serif Devanagari Regular, Noto Serif Devanagari SemiBold, Noto Serif Devanagari Bold, Noto Serif Devanagari Condensed SemiBold had "_bottom, nukta"

They're all from component glyphs, and I think there's something to do with anchor propagation. nukta_halant-deva is the easiest one to understand: all the masters of nukta_halant-deva have two components, nukta_deva and halant_deva, and two anchors,nukta and _bottom. The nukta_deva glyph has nukta and _nukta anchors, and the halant_deva has _bottom.

But after conversion to UFO, Condensed Light propagates the nukta anchor from nukta_deva, whereas the other masters do not. And in nukta_llVocalicMatra-deva, three more masters are propagating the nukta anchor when the others are not. No weird custom parameters as far as I can see. I can't work it out.

@simoncozens
Copy link
Collaborator Author

Oh, urgh, it's to do with which component has its xMin/yMin closest to the origin...

Propagating anchors for nukta_halant-deva in Bold
          halant-deva Bounds: (-157, -299), distance: 114050
           nukta-deva Bounds: (-331, -214), distance: 155357
**WINNER**  halant-deva
Propagating anchors for nukta_halant-deva in Condensed Light
          halant-deva Bounds: (-112, -225), distance: 63169
           nukta-deva Bounds: (-200, -134), distance: 57956
**WINNER**  nukta-deva
Propagating anchors for nukta_halant-deva in Condensed
          halant-deva Bounds: (-104, -259), distance: 77897
           nukta-deva Bounds: (-221, -172), distance: 78425
**WINNER**  halant-deva

This is too brittle for variable fonts. :-/

@simoncozens
Copy link
Collaborator Author

Hello to any future search engine users. If your font is suddenly reporting incompatible anchors and everything looks fine in the source, it might be because anchor propagation is choosing the wrong base component. In that case:

  1. Check if you really need anchor propagation. Try adding the "Propagate Anchors" custom component to the Glyphs file and setting it to off, then running your tests. If they pass, maybe you don't need it?
  2. If you now realise that anchor propagation is brittle and buggy but your tests didn't pass, first use the Glyphs script in here to manually propagate the anchors once in the source, then turn it off as above.
  3. If you persist in having your anchors derived from components and you're getting incompatibilities, try selecting everything in the layer (all components and anchors) and moving them all around so that the same component is clearly nearest to the origin in each layer.

@schriftgestalt
Copy link
Collaborator

Why would the position of a component make a difference with anchor propagation? Only the order should matter.

@simoncozens
Copy link
Collaborator Author

According to c55e6cc, this is what ufo2ft did/does; see googlefonts/ufo2ft#316

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants