From e4cc410bd33702d57cabd83e67a73373ff07a2bc Mon Sep 17 00:00:00 2001 From: Frederik Berlaen Date: Wed, 13 Dec 2023 09:29:44 +0100 Subject: [PATCH] draw the glyph directly no need to roundtrip to a BezierPath --- Scripting examples/db_currentDesignspace.py | 4 +--- Scripting examples/db_currentDesignspace_grid.py | 8 +++----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Scripting examples/db_currentDesignspace.py b/Scripting examples/db_currentDesignspace.py index 134a94f..0077005 100644 --- a/Scripting examples/db_currentDesignspace.py +++ b/Scripting examples/db_currentDesignspace.py @@ -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) \ No newline at end of file + drawGlyph(g) \ No newline at end of file diff --git a/Scripting examples/db_currentDesignspace_grid.py b/Scripting examples/db_currentDesignspace_grid.py index 1f7324c..d448a5e 100644 --- a/Scripting examples/db_currentDesignspace_grid.py +++ b/Scripting examples/db_currentDesignspace_grid.py @@ -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): @@ -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" @@ -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")