Grammar of metrics keys?

I was thinking of doing some custom scripting around metrics keys. I wonder if there is a grammar (+ semantics) defined for it somewhere? Does Spacing | Glyphs list all possibilities?

Have you checked the Handbook, p.149ff? There’s quite a bunch explained.

Ah, ok thanks :slight_smile: If those are the only capabilities, I can write something up myself.

Just out of interest, what do you miss in the possibilities of the existing metrics key functions?

I haven’t looked at them, but may want to do something with metrics keys outside (and FontLab), so I’d have to implement a parser, etc. myself.

There is some API in Glyphs that can parse a metrics key but it can’t be accessed from python. I can fix that if needed. Just to give you an idea what it can do:

result = GSLayer.metricsKey_name_operator_value_oppositSite_atHeight_("=B+10", None, None, None, None, None)

>> (1, 'B', 43, 10.0, 1, 0)

All those arguments are returning the result by out-pointer.
So in ObjectiveC, the code would look like this:

BOOL result = [GSLayer metricsKey:Key name:&glyphName operator:&operator value:&operant oppositSite:&oppositSite atHeight:atHeight];

Ah, thanks. No need to fix anything right now, I just wanted to know my how much work it would be if I wanted to implement a custom parser outside