Created
July 27, 2023 15:07
-
-
Save connordavenport/5e5b1a30ca416b2438958a38fa02d560 to your computer and use it in GitHub Desktop.
Copies and slant anchors from roman
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| g = CurrentGlyph() | |
| f = g.font | |
| of = AllFonts().getFontsByStyleName(f.info.styleName.replace(" Italic", ""))[0] | |
| og = of[g.name] | |
| try: | |
| fr = g.width/og.width | |
| except ZeroDivisionError: | |
| fr = 1 | |
| with g.undo(): | |
| g.clearAnchors() | |
| x1 = g.bounds[2] - g.bounds[0] | |
| x2 = x1/2 + g.leftMargin | |
| y2 = f.info.xHeight / 2 | |
| for a in og.anchors: | |
| g.appendAnchor(a.name, ((a.x)*fr,a.y)) | |
| for ar in g.anchors: | |
| ar.skewBy((-f.info.italicAngle), origin=(x2,y2)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment