-
Notifications
You must be signed in to change notification settings - Fork 51
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
Recursive glyph references choke glyphsLib #375
Comments
It's a fringe use-case but from what I understand the problem is this: in Glyphs, when you put a component in the background, the component points to the foreground of the other glyph; while in UFOs, if you have a component in a layer (including the background layer), it points to the contents of the other glyph from the same layer. That's why it makes a reference loop in UFOs but works fine in Glyphs. |
Aargh.. yes, that’s how UFO3 layers are designed to work. could we detect this cases and decompose to avoid the recursion? |
Or we push for an update of the UFO spec: Components could have a baseLayer attribute to allow components from other layers #49. |
Yes we could, but it loses the point of having those in Glyphs, which is to always have a synced visual of the parenleft in the background of the bracketleft for comparison purposes. We would have to "compose back" when going back to Glyphs to achieve something useful. |
One way to avoid the problem a bit is to not export the background when called by fontmake. The ufos are only used to produce binary fonts and those do not use the background. So an option for the builder might help? |
I suppose that could in some instances also save time 🤔 I imagine that this might interfere with e.g. color fonts that need the layers, but I don't know if they are handled at all. |
Color fonts have multiple layers, that has nothing to do with the background. |
Just hit the case where a glyph had a component referencing the glyph. glyphsLib should detect this and error out early. |
This was a (temporary) blocker on Merriweather, this week. Glyphs like /p, /d, /q, & /b were referencing one another in background layers. I had to dive into defcon code and put in some print() statements to figure out what kept crashing the build. I see three options for how this might be handled:
I'm just trying to contribute my thoughts here, but to me, option 3 seems best. |
In Glyphs, components in the background reference the foreground in the other glyph. So those components are perfectly fine in Glyphs. |
Right, the issue only comes from moving things over to UFO. So, that's a good point...
|
I can't reproduce this anymore now with modern glyphsLib and fontmake, which uses ufoLib2 instead of defcon: Recursion.zip Maybe I can still insert a check somewhere for loops. |
@schriftgestalt do component references always point to the foreground, regardless of which layer they are in? Or is the background layer treated specially? |
They always point to the foreground. Master layers pointing to the corresponding master layer in the other glyphs. None master layer try to find a layer with the same name in the other glyph. If that fails, they fall back to the associated master layer. |
@schriftgestalt ok thanks. what do master and non-master background layers point at? |
Also, do you mean names as in "layer.name" or layer IDs or something else? Also also, does Glyphs do anything useful with brace/bracket layers containing components? Are there use cases for that? |
Master layer alway point to the other master layer. Other layers point to layers with the same name (say bracket rules or color layers). It falls back to the master. |
This includes the date-stamped layer copies you can make with the "+", right? |
Yes. |
@schriftgestalt So, my idea of bridging the UFO and Glyphs data model would be to unconditionally decompose all components in non-master layers. Do you know of a use case that would be prevented by this? Component spacing changes in bracket layers maybe? |
Components in brace layers should not be decomposed because is messes with the interpolation. |
Hm. Well, this sucks a bit. There is a fundamental difference in UFO and Glyphs data models in that UFO components always point to the same layer and Glyphs components mostly point to the default layer. It's hard to reconcile this. Maybe I'll limit myself to background layers for now, as those are where most of the problems turned out to be... @anthrotype ? |
What happens in ufo, when there is no glyph in that layer the component points at? |
You get a dangling reference and possibly a compiler crash. Also, what happens if some master layers are named the same, e.g. you duplicate the Regular twice but don't change the name yet? |
Then it picks the first it finds. That is not really a problem as those layers are not relevant when producing fonts. |
Ok. What if two brace layers are called "{100,200}" and "{100, 200}" (note the space)? |
This is a simple text comparison. So it will not pick the component form the other brace layer. But that is not a problem as the outlines are generated from an interpolation of that glyph and this will produce the shapes from the brace layer. |
Ok. Thanks for clearing that up :) |
Blargh. glyphsLib collates layers with the same name into one layer, Glyphs treats them as separate. |
(Filing this here to take it out of my inbox)
Jany found a file with the following properties:
The text was updated successfully, but these errors were encountered: