Finding components at specific coordinates

I’m using layer.intersectionsBetweenPoints() to find the intersection point between an horizontal line and the layer’s paths, using components=True to measure components.

How can I know which component is found at a specific intersection coordinate?

Thank you very much,
Marco

There is no easy API to do that currently. What are you trying to do?

Hello Georg,
I’m using the stems coordinates to set the sidebearing ignoring serifs.

For component-based glyphs (such as n/m if there are different components for stem and shoulders, o i/j), i’d like to set the sidebearings directly on the components.

Right now I disable automatic alignment on the first component and set the SB on the composed glyph, but in this way its components get out of sync… I’d like a cleaner approach if possible.

Thank you very much,
Marco

I don’t understand. Can you show how you composed your n, for example?

Use a _stem.x component and a _shoulder component. Connect them with #entry and #exit anchors. That way, you can leave automatic alignment on and set the side bearings in your stem/shoulder components.

Hello Sebastian, I composed the glyphs as you describe (in blue my measurement line):

What I’d like to do is to set the sidebearings in a general way: I could set LSB on the first component and RSB on the last. This would work for n/m, but not for i for example: i don’t want to set sidebearings on dotaccent.

So, to know which components to target, shouldn’t I know which one touches the line
as first and last? Then again, it’s very possible that I’m overthinking and I should simply say “If you’re going to use components, build your glyphs according to this specific way.”

Don’t compose i with entry/exit. Use top/_top on idotless and dotaccentcomb.

Ok, now I feel stupid :roll_eyes: :sweat_smile:
I can set the same LSB and RSB on every component, since (obviously) it’s the anchors that define the components position! Which I guess is what @SCarewe was just saying, it’s just that I’m a bit slow!

Thank you,
Marco

1 Like