Sidebearing formula: center glyph within given width

I want my ø to have the same advance width as the o, and centered, of course (since I know the o within the ø has the same width as the normal o).

So, I tried this:

This does not work although I think it is clear what the required conditions are, and how they would be met.

Would it be possible to implement this? Or is there another trick I could use?

There are multiple cases in which this would be helpful, like mathematical operators: they would (almost) all be centered within a given width, which could, for example, be adopted from plus.

1 Like

Best is to build it from components, i.e., an (unexporting) o.oslash with LSB and RSB =o. Then enable auto-alignment.

Take a look perhaps at mekkablue > Spacing > Fix Math Operator Spacing. Detailed descriptions in the tooltips.

1 Like

You mean, I need two additional glyphs only to achieve the spacing? Sounds too complicated.

Thanks, this looks very useful. However, I’d prefer a set-up-once-and-forget type of solution.

Why not implement this specific (but frequently useful) case of sidebearing formula set-up in Glyphs? That would be much simpler: no additional glyphs, no script I need to run (and remember to re-run), just logical, as-expected behaviour of the sidebearing formulas.


If I got Rainer right, he’s talking about having a component for the slash, and build oslash from o and this component ?
This is how I do it as well, I have non exportable glyphs for all my slashes, bars etc and build my components glyphs with these and appropriates anchors, then auto align everything.

For maths operators (that we usually want on tabular figures width), I just have a simple script like:

    myLayers = Glyphs.font.selectedLayers
    glyphWidth = your desired width
    for thisLayer in myLayers:
    	thisLayer.LSB = thisLayer.LSB-(int(thisLayer.width-glyphWidth)/2)
    	thisLayer.width = glyphWidth
1 Like

I thought using a glyph named o.oslash implies an additional glyph that contains only the o used in the ø. This is necessary as that o needs to be adjusted (somewhat lighter, especially where the slash crosses it), especially in the bolder or condensed weights. Simply using the normal o with a slash is not good enough for me, I am afraid.

Thank you for sharing this but, as I mentioned, I’d prefer to use the built-in tools (not that I didn’t know how to make Glyphs add-ons ;), and a set up that does not require to re-run a script every now an then as this is easy to forget.

I am not asking for a new Glyphs feature, and I am not trying to use a hack. Simply expected behaviour if it was implemented in Glyphs. The solution from my original post would be the most convenient, simple and logical one, I believe.


Yes, o.oslash and slashlongcomb.

They are easy to set up: Just select the o part, right click and choose Component from Selection, then type the name ‘o.oslash’, click OK. Then the same thing with the slash part. It automatically does this for all masters.

You can try the metrics key like this: =o@300. That works like a measurement line and avoids the slash.


Excellent! This is, of course, the ideal solution for the ø, better than two additional glyphs, and better (somewhat more robust) than my proposal. I have already used it other contexts as well.

However, that still does not solve the case of the math punctuation. Sorry, I really reject the idea of having to run a script, without auto-updating, if an solution using sidebearing formulas is thinkable.

I am really surprised at the resistance against my suggestion to implement that logical, as-expected behaviour of the sidebearing formulas. @mekkablue Why are you so opposed to it? You have not given any reasons why using sidebearing formulas in the way I described is not a good idea, and why your script works better.

Somehow, this does not work in this case:

Any ideas how I can combine the functionality of | and @ (without creating additional glyphs)?

You mean the with a width key and a =| in one of the sides. I totally missed that you tried to center the glyph by that. Sorry.

I implemented it.


Thank you!

Any chance you could have a look at the case of =|b@100 (see above) as well? Am I doing something wrong or is the implementation incomplete?

I fixed this, too.


Hi! These are really super useful.
Is there a reason why =|@450 doesn’t seem to work?

@Malou Which app version?

Version 2.6.2 (1265)

Can you explain again what this does? What is the number (300) referring to?

It’s the height from which you want the measurement to take place on the specified glyph.

1 Like

Ah! Nice!

Just in case someone stumbles across this and wonders why this doesn’t work by pressing the cicular-arrow buttons: If you have a formula for the advance width and =| for a sidebearing then you need to use “Update Metrics” for it to work.

1 Like