Script to turn side bearing values into formulas automatically?

Hi there,

Is there any script to turn side bearing values into formulas ( like =H*0.60) automatically?


would be nice to enter, for instance: n + 5 or H / 2

Feasible. Just:

  1. multiplications/divisions are dangerous in this place, better user addition/subtraction;
  2. it would need a database, because where does it take the reference glyph from (H in your example), or did you have something else in mind as source of that information?
  1. Why is it dangerous? How will I set percentages without multiplications/divisions?
  2. I was thinking of a script that would take a reference glyph as input (we frequently use H) and then convert the values of selected glyphs’ side bearing into fractions of this given glyph’s sidebearings.
1 Like

One issue: what happens with negative sidebearings? If, for example,

  • H sidebearings are set to 50
  • O sidebearings are set to H*.8 = 40
  • V sidebearings are set to H*-.2 = -10

If you change H to 60 to increase spacing,

  • O is now 48, so looser
  • V is now -12, so tighter

I would never set all side bearings to fractions of a given glyph. Diagonals are special situations. I usually never set negative values for them, just zero or a positive value.

But how to tell the script what glyph to link to?

The script could ask to input the reference glyph (like H) on a pop-up window and run only on selected glyphs.

Ok. Then you have a very nice use case for your to write your first script :wink:

It woudn’t be my first script :slight_smile: Problem is I never really have time to learn Glyphs’ objects and methods. So I prefer to ask more skilled programmers. If someone want to send me quotation for it, please do.

If you have some experience with Python, that should take you 30 min at most. The object model is not that difficult.

The negative-value problem is just one issue. It gets worse from there. If you change your reference glyphs, glyphs with different percentages get tighter/wider by different amounts, turning OK spacing into very unrhythmic spacing in a snap.

Yet another problem: rounding errors that can cause metrics keys to always be reported out of sync.

OTOH, subtraction/addition never really caused problems, but I have yet to see the percentage approach work, TBH.

Typically my client uses only one reference glyph (H), so no reason to be changing the reference. Using percentages you can space a whole family by spacing only one member. If understand well subtraction/addition of given units are useful at font level. You can’t use the same values on the rest of the weights.

Here’s a paradox. To retro-actively express sidebearing as multiples of another you have to already have set it. So this script would be handy only for when you have already spaced several glyphs, but then want to lock their relation to a certain key glyph. While this might be possible, wouldn’t you just simply take on expressing your sidebearings as multiples already when you are setting out to space in the first place? Equally, all those cases where a direction relation is obvious (say H RSB for E and F) you can set quite easily, where as cases where a relation might be more tricky to get right (say a fraction of H for T’s RSB and LSB) might not profit that much from being linked in the first place, because scaling the entire font based on the key glyph those more tricky sidebearings are more likely to not scale well when linked; you’re more likely to want to adjust the individual sidebearings in relation to other standard sidebearings rather than scale the fitting of the entire font — which really is the only use I can see of this script.