-
-
Save davelab6/6362877 to your computer and use it in GitHub Desktop.
Moved to https://github.com/davelab6/fontforge-ufo-depot |
Fixed:
- ufo = font.fontname + ".ufo"
+ ufo = font.path[:-len(f.path.split('.')[-1])] + 'ufo'
font.path
is a string of the font's full path name
[
is a standard python way to refer to a slice of a string
:
is a standard python way to say "from the start until the following number of characters"
-
is a standard python way to say "count the following number of characters back from the end of the string"
len()
is the standard python method to calculate the length of something as an integer
f.path.split()
is the font path string again, with the standard python split(character)
method that splits the string into a list, on every given character
'.'
means split it on periods
[-1]
is a standard python way to say "from the start until the penultimate one (leave out the last one)"
+ 'ufo'
means add to the end the string ufo
Instead of being clever, I changed the code to do everything step by step so its clearer :) https://gist.github.com/davelab6/6362877/revisions
I confirm this works on gnuLinux.
At moment though the UFO is saved to the directory from where fontforge was started (if started from terminal) or to the
/ if fontforge is run from /usr/local/bin. For this to work well in a robofont etc system, the UFO should be saved to the directory where the active font file was opened. E.g. if fontforge opens '/gitFonts/in-progress/font1.ufo', then the script should save to '~/gitFonts/in-progress/font1.ufo'