I am going through some bizarre behavior in the macro panel with regards to path.
f = Glyphs.font
ROOT_PATH = '/Users/yourusername/fonts/export/'
print(ROOT_PATH) # '/Users/yourusername/fonts/export/'
for instance in f.instances:
if instance.active:
instance.generate(
Format=OTF,
FontPath=ROOT_PATH
)
Works great.
Now, if I just make the following change, it doesn’t export to the ‘otf’ folder. After all, ROOT_PATH is a string! Why doesn’t this work!? I think I am going crazy.
import os
f = Glyphs.font
ROOT_PATH = '/Users/yourusername/fonts/export/'
OTF_PATH = os.path.join(ROOT_PATH, 'otf')
print(OTF_PATH) # '/Users/yourusername/fonts/export/otf'
for instance in f.instances:
if instance.active:
instance.generate(
Format=OTF,
FontPath=OTF_PATH
)
The fonts still go to '/Users/yourusername/fonts/export/'
!
Any ideas I think I spent way too much time on this with no luck.
I also tried ROOT_PATH = '/Users/yourusername/fonts/export/' + 'otf'
and surely this is a string object in python. It still goes to the export folder and never makes a new otf folder.
Doesn’t work: ROOT_PATH = '/Users/yourusername/fonts/export/' + 'otf'
Works: ROOT_PATH = '/Users/yourusername/fonts/export/otf'
My goal is to automate exports of various font formats in their own folder.