FontTools, probably a simple question
-
I'd like to use the FontTools methods for finding arc length and finding points along a curve at https://github.com/fonttools/fonttools/blob/main/Lib/fontTools/misc/bezierTools.py#L98. I can import the fontTools module, but I don't seem to be able to use methods like calcCubicArcLength(). I guess I could just pull code out of the repo, but I'd rather use the functions from the module. What am I missing?
-
this works...
from fontTools.misc.bezierTools import calcCubicArcLength pt1 = 100, 100 pt2 = 200, 100 pt3 = 400, 150 pt4 = 400, 400 l = calcCubicArcLength(pt1, pt2, pt3, pt4) path = BezierPath() path.moveTo(pt1) path.curveTo(pt2, pt3, pt4) text(str(l), pt3) fill(None) stroke(0) drawPath(path)
-
@frederik Oh, I see—I just needed to import (from) the right submodule. Thanks!