Skip to content

Instantly share code, notes, and snippets.

@anthrotype
Created April 28, 2023 18:21
Show Gist options
  • Save anthrotype/743e35caa217cb6fb555666c9f52f768 to your computer and use it in GitHub Desktop.
Save anthrotype/743e35caa217cb6fb555666c9f52f768 to your computer and use it in GitHub Desktop.
"""
The contours from https://gist.github.com/rsheeter/cef6cf71fa9e519c94f9f0d23906e5de are in fact not compatible
and this even before we attempt to reverse them.
See https://github.com/fonttools/fonttools/issues/3093
"""
from ufoLib2 import Font
from ufo2ft import compileInterpolatableTTFs
# same routine as Rod's original gist:
# https://gist.github.com/rsheeter/cef6cf71fa9e519c94f9f0d23906e5de
def draw(pen, endp):
pen.moveTo((0, 0))
pen.curveTo((1,1), (2,2), (3,3))
pen.curveTo((4,4), (5,5), endp)
pen.closePath()
font1 = Font()
g = font1.newGlyph("A")
draw(g.getPen(), endp=(0, 0))
font2 = Font()
g = font2.newGlyph("A")
draw(g.getPen(), endp=(6, 6))
# reverseDirection=False so ReverseContourPen can't be blamed for this
for ttf in compileInterpolatableTTFs([font1, font2], reverseDirection=False):
# we never get here because cu2qu throws
# IncompatibleFontsError: fonts contains incompatible glyphs: 'A'
# That is not a bug, it's a feature.
print(ttf)
@rsheeter
Copy link

I guess I don't agree that isn't a bug :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment