Created
February 25, 2015 09:24
-
-
Save roberto-arista/a3b3d286ecb2cd308529 to your computer and use it in GitHub Desktop.
Adding smart sets to Robofont
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
##################### | |
# Adding smart sets # | |
##################### | |
### Modules | |
import os | |
from mojo.UI import SmartSet, addSmartSet | |
### Variables | |
input_sources_path = 'Sources' | |
### Functions, procedures, constants | |
def catchFilesAndFolders(path, extension): | |
items = [item for item in os.listdir(path) if item.endswith(extension)] | |
return items | |
### Instructions | |
txt_paths = catchFilesAndFolders(input_sources_path, '.txt') | |
for each_path in txt_paths: | |
setName = each_path.replace('.txt', '')[3:] | |
glyphs = open(input_sources_path + os.sep + each_path, 'r').readlines() | |
glyphs = [item.replace('\n', '') for item in glyphs if item.startswith('#') == False] | |
smartSet = SmartSet() | |
smartSet.name = setName | |
smartSet.glyphNames = glyphs | |
addSmartSet(smartSet) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment