Skip to content

Commit

Permalink
added changefeature.py
Browse files Browse the repository at this point in the history
  • Loading branch information
nagi authored and nagi committed Sep 28, 2010
1 parent 0e2ce7e commit f5b0b9d
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions fontcreator/scripts/changefeature.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python
# changes feature in the otf font!
# arg1 => font
# arg2 => feature_file

import fontforge
import sys

TMP_FONT = "/tmp/temp.sfd"

def main():
if len(sys.argv) != 3:
usage()
sys.exit(1)
featureChange(sys.argv[1], sys.argv[2])

def featureChange(Font, Feature):
font1 = fontforge.open(Font)
font1.save(TMP_FONT)
font = fontforge.open(TMP_FONT)
for l in font.gsub_lookups:
font.removeLookup(l)
font.mergeFeature(Feature)
font.generate('crazy_feature.ttf')

def usage():
print "\nUSAGE: ", sys.argv[0], ' font_file feature_file\n'

if __name__ == '__main__':
main()

0 comments on commit f5b0b9d

Please sign in to comment.