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

Intermediate layers, sparse composite glyphs, cryptic error messages #954

Open
simoncozens opened this issue Sep 9, 2024 · 7 comments
Open

Comments

@simoncozens
Copy link
Contributor

Most of the big Noto fonts (particularly Noto Sans and Serif LGC for this example) have dropped Monotype's Semibold masters and replaced them, where needed, with alternate layers. This creates a sparse designspace where some glyphs have layers at the semibold position and others don't.

fontc seems to assume a non-sparse design space - at least that's what I'm interpreting from this (cryptic) error message:

$ ~/others-repos/fontc/target/release/fontc sources/NotoSerif.glyphspackage
Invalid source glyph 'softsign-cy': 'undefined at required location Normalized {wdth: -1.00, wght: 0.58}'

The error message is cryptic for three reasons:

  • Why that glyph? I can imagine a designer looking for a problem in that particular glyph, when if the error is actually about the shape of the designspace, there's nothing wrong with that glyph and it affects all of them.
  • "undefined" what?
  • Please denormalise locations; they're not user friendly. I have some code in diffenator3 to do this but it just needs to run the avar backwards.

But I think the bigger issue here is that fontc is assuming a full designspace when it should be happy with a sparse one.

@anthrotype
Copy link
Member

alternate layers

you mean, "intermediate" (aka brace) layers. "alternate" layers is what bracket layers are now called in Glyphs 3. The former are supposedly supported, the latter not yet (#533).

I'll take a look at this, thanks for reporting.

@anthrotype
Copy link
Member

(I also agree the error message is cryptic and not very helpful)

@anthrotype
Copy link
Member

the issue is about decomposing composite glyphs when the composite defines more locations than the glyph it references as component. There is a "yeru-cy" glyph which is mixed, contains both simple contours and components and as such needs to be decomposed to simple glyph. It uses "softsign-cy" as component, but it contains an additional intermediate layer which "softsign-cy" doesn't have ({152, 70}).
fontc doesn't support this yet, see #552
Even fontmake added support for this relatively recently: see googlefonts/glyphsLib#954 and googlefonts/ufo2ft#826

The right thing to do in this cases is to interpolate the missing layer while decomposing.

in the meantime, we should at least make the error message clearer.

@anthrotype
Copy link
Member

the crypting error is raised in a method called convert_components_to_contours

fontc/fontir/src/glyph.rs

Lines 189 to 197 in 266624a

// Any contours of the referenced glyph at this location should be kept
// For now just fail if the component source locations don't match ours, don't try to interpolate
trace!("'{0}' retains {component:?} at {loc:?}", original.name);
let Some(inst) = simple.sources.get_mut(&loc) else {
return Err(BadGlyph::new(
simple.name.clone(),
BadGlyphKind::UndefinedAtNormalizedLocation(loc.clone()),
));
};

@anthrotype anthrotype changed the title Alternate layers, sparse design spaces, cryptic error messages Intermediate layers, sparse composite glyphs, cryptic error messages Oct 3, 2024
@simoncozens
Copy link
Contributor Author

The former are supposedly supported, the latter not yet (#533).

Can I gently point out that an issue tracker with over a hundred open issues is not the easiest way for people to understand what is expected to work yet and what isn't? Maybe, a checklist or something?

@anthrotype
Copy link
Member

noted 😅

@rsheeter
Copy link
Contributor

rsheeter commented Oct 4, 2024 via email

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

3 participants