Skip to content

Commit

Permalink
more demo scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
LettError committed Dec 13, 2023
1 parent a35e285 commit 062dc2b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
for ds in AllDesignspaces():
loc = ds.randomLocation()
print(loc)
ds.setPreviewLocation(loc)
12 changes: 12 additions & 0 deletions Scripting examples/rf_close_all_sources_from_designspace.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

# save and close all open fonts that belong
# to the current designspace.

ds = CurrentDesignspace()

dsFontPaths = [f.path for f, l in ds.getFonts()]

for f in AllFonts():
if f.path in dsFontPaths:
f.save()
f.close()
7 changes: 7 additions & 0 deletions Scripting examples/rf_open_all_sources_from_designspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
# and that edits in the fonts are reflected in the previews.
ds = CurrentDesignspace()
done = []

discreteLocation = {'slab': 0}
discreteLocation = None

for font, loc in ds.getFonts():
if discreteLocation is not None:
if loc | discreteLocation != loc:
continue
if font.path not in done:
font.asFontParts().openInterface()
# a ufo can appear multiple times in the designspace
Expand Down

0 comments on commit 062dc2b

Please sign in to comment.