New to Typophile? Accounts are free, and easy to set up.
I'm looking for a way to calculate "sidebearings" in a Python script by using (or approximating) FontLab's measurement line. I put "sidebearings" in quotes because I actually want the distance between the edge of the glyph and where the measurement line first crosses a contour. I know that I'm able to run a macro like
fl.font.measurement = 0 to set the height of the measurement line, but what I don't know is how to get the values of the modified sidebearings that are shown in the Metrics window when the measurement line is on.
Is there a similar attribute in FontLab's glyph object that isn't documented? Or is there another easy way to calculate this using the contour?
As a temporary solution, I have been able to use RoboFab's
contour.pointInside() to get these values by periodically testing points within the bounding box. However, I want to be able to easily get these values for hundreds of glyphs at a time, and this method is quite taxing. There must be an easier way!
Thank you in advance for your help, and my apologies if the answer is already out there. I couldn't find anything with a quick search.