Skip to content

Instantly share code, notes, and snippets.

@connordavenport
Created July 27, 2023 15:07
Show Gist options
  • Select an option

  • Save connordavenport/5e5b1a30ca416b2438958a38fa02d560 to your computer and use it in GitHub Desktop.

Select an option

Save connordavenport/5e5b1a30ca416b2438958a38fa02d560 to your computer and use it in GitHub Desktop.
Copies and slant anchors from roman
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