Skip to content

Commit

Permalink
draw the glyph directly no need to roundtrip to a BezierPath
Browse files Browse the repository at this point in the history
  • Loading branch information
typemytype committed Dec 13, 2023
1 parent 48b90ec commit e4cc410
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 1 addition & 3 deletions Scripting examples/db_currentDesignspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@
for i in range(20):
loc = d.randomLocation()
g = d.makeOneGlyph("A", location=loc)
bp = BezierPath()
g.draw(bp)
drawPath(bp)
drawGlyph(g)
8 changes: 3 additions & 5 deletions Scripting examples/db_currentDesignspace_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

def ip(a, b, f):
return a+f*(b-a)

def grid(ds, glyphName, horizontalAxis, verticalAxis, columns, rows):
items = []
for x in range(columns):
Expand All @@ -25,7 +25,7 @@ def grid(ds, glyphName, horizontalAxis, verticalAxis, columns, rows):
items.append(((x, y), loc, glyph))
return items

# parameters
# parameters
glyphName = "S"
horizontalAxis = "width"
verticalAxis = "weight"
Expand All @@ -45,9 +45,7 @@ def grid(ds, glyphName, horizontalAxis, verticalAxis, columns, rows):
with savedState():
translate(x*xunit, y*yunit)
scale(0.09)
bp = BezierPath()
glyph.draw(bp)
drawPath(bp)
drawGlyph(glyph)

# save the image
saveImage(f"grid_{horizontalAxis}_{columns}_{verticalAxis}_{rows}.png")

0 comments on commit e4cc410

Please sign in to comment.