ufoLib2 icon indicating copy to clipboard operation
ufoLib2 copied to clipboard

Is it possible to get the "angled" margin of a glyph in an italic font?

Open arrowtype opened this issue 2 years ago • 2 comments

RoboFont has the very useful glyph attributes glyph.angledLeftMargin and glyph.angledRightMargin in its API. This is pretty vital when scripting Italic fonts. If I just ask for the basic left/right margin, it is “wrong” in terms of how I need to manipulate a glyph drawing.

Is there an existing function to get glyph.angledLeftMargin and glyph.angledRightMargin, or object with these attributes (in ufoLib2 or elsewhere, but independent of a font editor)?

As a specific example, if I try to position an ogonek anchor on an italic /E, I am unsure of how to determine the bottom right corner... even though it is the further-right point, if the margin is angled. Even if I use the font.lib["com.typemytype.robofont.italicSlantOffset"] of the UFO, it is still way off, because using the glyph bounds or basic rightMargin value is based on the top right corner. (This makes sense, because the font is ultimately just in a rectangle, and the angled margins are just there to help designers draw italic fonts in a way that makes sense... but when I’m coding, I frequently wish I had a way to do this, too!)

image

Thanks for any tips or pointers, if you happen to have them!

arrowtype avatar Jul 04 '23 15:07 arrowtype

Is there an existing function

no, but we could add one I suppose, if needed. Do defcon or fontParts have something like that that we can borrow?

anthrotype avatar Jul 04 '23 15:07 anthrotype

Unfortunately, no, neither defcon nor fontParts have something like that.

arrowtype avatar Jul 04 '23 16:07 arrowtype