Skip to content

Instantly share code, notes, and snippets.

@davelab6
Last active December 21, 2015 20:39
Show Gist options
  • Save davelab6/6362877 to your computer and use it in GitHub Desktop.
Save davelab6/6362877 to your computer and use it in GitHub Desktop.
Moved to https://github.com/davelab6/fontforge-ufo-depot
@davelab6
Copy link
Author

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

@davelab6
Copy link
Author

Instead of being clever, I changed the code to do everything step by step so its clearer :) https://gist.github.com/davelab6/6362877/revisions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment