Getting metrics overshoot

Is there a simpler way to get, say, xHeight, overshoot other than iterating over master metrics?

Also, the code snippet in the API documentation does not work:

for metric in Font.masters[0].metrics:
  if metric.metric.type == GSMetricsTypexHeight and metric.metric.filter is None:
    metric.position = 543
    metric.overshoot = 17

This gives:

TypeError: 'objc.native_selector' object is not iterable

I had to use .metrics() instead.

Also, all code snippets in the API documentation seem to have lost their indentation.

I have to upload a new version of the docu. I would suggest this:

master = Font.masters[0]
for metric in Font.metrics:
    if metric.type == GSMetricsTypexHeight and metric.filter is None:
        metricValue = master.metricValues[metric.id]
        metricValue.position = 543
        metricValue.overshoot = 17

That better resembles the internal structure thous hopefully makes it easier to understand.

2 Likes

Perfect, thanks.

And I just uploaded the new docu.

1 Like

Looks good now.