Margins at a given y value

Is there a function or way to know the margins (distance from left and right sidebearings to contour) at a given y value?

use the measurement tool in text mode. click somewhere to set the hight of the line.

Sorry, I wasn’t clear.
I want to know how to do that from a script.
Thanks.

You can try this:

currLayer = Font.selectedLayers[0]

MeasurementHeight = 100

Measurement = NSClassFromString(“GlyphsToolMeasurement”).alloc().init()

print Measurement.calculateIntersectionsForLayer_startPoint_endPoint_(currLayer, NSMakePoint(-1000, MeasurementHeight), NSMakePoint(3000, MeasurementHeight