RSB LSB anchors

When I name anchors RSB or LSB they change shape to start and end markers.


I could not find any documentation on this special behaviour.

Is there a way to have the side bearings to ignore certain components?
Or to use these anchors to define the bounds of a glyph where the RSB and LSB are calculated from?

This are special anchors to define proportional metrics for CJK full width glyphs.

I’m creating fonts for conlangs. Is there any functionality I could use, or are they just used for exporting?

It would be cool if I could use special anchors as the origins for LSB and RSB values.
E.g. when I set the LSB to 38, it sets the left border to 38pt left of the LSB anchor.

What is wrong with just setting the side bearings directly? Can you explain what you are trying to do?

When I start designing the letters I format all letters with the biggest possible bounding box and create components for all elements. When I have all components done, I create all letters just by adding the needed combination of components. Because all have the same size at this point everything fits perfectly.

Then I set the correct sidebearings. But now when I want to change some letters I have the problem that added components still have the bigger original size and are placed different in the letter. I got this sorted by using origin anchors in the base shape.

I have a base letter shape that defines the width of the letter. The base letters have added components that overlap into other letters in many different ways and combinations. This would create many different negative sidebearing values that all have to be recalculated if the base value changes. The important value is only the distance of the base shape to the borders.

You could build the components using “#exit” “#entry” anchors. That way, the side bearing of the first and last component will be used. But I would need to see more examples to understand if that would be possible.

But wouldn’t these components take the overlapping elements into account, too?

Here is a small test case. The #entry and #exit anchors set the sidebearings correctly. But when a component overlaps these anchors, the side bearing is calculated from the end of the overlap.

Have a look at the letter A. then move the upper component to the right. (3.3 KB)

An alternate solution would be the ability to set specific components to not interact with the side bearings.

I have noticed that LSB and RSB anchors directly set the borders but leave the metrics unchanged and ignored.
Unfortunately when exported only the metrics are used.

Those anchors are not supposed to do anything for non-CJK glyphs.

And I changed your file a bit: (3.5 KB)

I made a script to automate this.

You just need to add “LSB root” and “RSB root” anchors.

Anchor based side (1.6 KB)

Here is an updated version of my script. It now recognizes “LSB root” / “RSB root” anchors in components and takes the leftmost LSB root and the rightmost RSB root anchor as reference. If you put these anchors directly inside the glyph, they override their counterparts in the components.

Anchor based side (1.8 KB)

1 Like

Have you considered starting a GitHub repo with your scripts?

Good Idea! I already have a Github repo for other things. I create one for my Glyph scripts.

1 Like

Here is my little Glyphs-Scripts Github repo:

1 Like

Very nice, thank you.

Do you need help with setting up the readme? A quick overview of what each script does. Take a look at the readmes of the script repos linked on the extend page.

Can I borrow parts of your Readme? It is very good.

Sure, it’s all Apache open source license.