Hi, I’m trying to find out if there is a way for a mask within a component to affect any other shapes or components below it (based on shape order).
My use case pertains to simplifying the construction of a number of similar glyphs. I would like to create a “stem” component (possibly a smart component to control the height of the stem) and a “bowl” component. For the sake of simplicity, let’s say that the stem is simply a rectangle. The bowl component consists of two circles: one to form the shape of the bowl, and another one with the “Mask” flag enabled that cuts out the shape of the counter. The reason it is set as a mask is so that it cuts out not just the counter of the bowl, but also the stem underneath it where the counter recedes into the stem by a small amount.
When inserting these components into a glyph, the mask’s scope is limited to the shapes in its component — it does not mask out other shapes or components beneath it, regardless of the order displayed in “Shape Order”.
When components are not used, and all three shapes are in the same glyph (stem, bowl, and counter mask), it works. But when isolated inside components, the effect does not propagate down.
Is there a way to achieve this, or is this not possible? I understand that in many cases, this behaviour may be desirable, so I’m wondering if perhaps there’s a component property I’m not seeing somewhere.
A mask can only cut inside that glyph, not other shapes below if used as a component. You need to use a third component between the stem and the bowl that cuts out the counter (make it cut out a bit more to avoid collinear segments).
Yeah, and I don’t actually need a third component, the mask can live in the stem component (since in the end that’s what needs to be masked) and the counter in the bowl can just be a usual reversed path. So I can still keep it to two components, which is what I wanted in the end. Thank you again for your help and advice!
In the stem component, I have the #exit anchor, and in the bowl I have the #entry anchor. I have made a test glyph, where I first add the stem, and then the bowl. They attach as expected. But the width of the glyph is only the width of the stem, the second component does not appear to contribute to the width. I am also not sure how the sidebearings are controlled in such a scheme.
Are you able to provide any insight? Any help would be greatly appreciated.
Sure, here are both components, and them together in a glyph. Notice the glyph is very narrow, the width does not include the bowl. Also, not sure how to set the sidebearings.
Since you are using automatic alignment, the side bearings are based on your components. The side bearings in your first component are set to 0, so the side bearings in the glyph you are using it in are 0 (in relation to the first component). You can either disable automatic alignment for the first component of the glyph, then you can change the side bearings manually, or use entry/exit anchors that “stack” side bearings from each new component.
I would recommend using #entry and #exit anchors.
As Georg pointed out, you need to add the components in the visual order (for Latin, that means left to right, LTR).
In your case, do the following: name the anchor in your bowl glyph #exit (since this anchor defines the exit point of the component). In your stem glyph, name the anchor #entry, since it defined the connecting entry point of the component. Then add the bowl component first and the stem component second.
To adjust the side bearings, adjust the side bearings in the components. The LSB is defined via the LSB of the first component (your bowl component). The RSB is defined by the RSB of the last component (your stem).
Okay, and to handle the case where a horizontal symmetry is needed, for instance “p” and “q”, both components would need two anchors each, an #entry and #exit.
In one case the stem would be added first (the “p” case), and in the other the bowl would be added first. In the case where the flip is needed, I do it before adding the second component, is that right?
Another question while I have you here: is there something explicitly wrong or incorrect about having two (or more) nodes at the same coordinates? In working on the smart component and setting up the various cases, in certain states nodes overlap (for instance if an ink trap goes from being X units wide to zero).
When the points overlap they are displayed with a red circle, and I think I’m interpreting that as “danger”, but maybe that’s just the UI innocently telling me that there’s more than one node here…
Great, I really appreciate all your help, I’m new to Glyphs. It says you’re a developer, so let me take the opportunity to say that it’s a great app, I’m finding it powerful and robust, and very easy to use. Thank you!