A simple script to batch process fonts with AFDK autohint

Ramiro EspinozaRamiro Espinoza Posts: 506
edited September 2014 in Technique and Theory
A colleague asked me today for a script to run AFDK autohint on a set of fonts. Here is my perfectible but usable script if someone want to run it. It can be easily adapted to run others AFDK programs like TTX.
import os<br /><br />root = '/Users/You/Desktop/Fonts2Hint' #Copy your input directory here<br /><br />new_root = "mkdir " + root +"/Hinted-Fonts"<br />os.system(new_root)<br /><br />allfiles = os.listdir(root)<br /><br />for n in allfiles:<br />	if not n.startswith('.'):<br />		duplicate_file = "cp "+root+"/"+n +" "+root+"/"+"HINTED-"+ n  <br />		os.system(duplicate_file)<br />		move_files = "mv " + root + "/HINTED-*" +" "+ root+"/Hinted-Fonts/"<br />		os.system(move_files)<br />		run_AFDK_PS1Hinter = "autohint -a " + root+"/Hinted-Fonts/"+"HINTED-"+ n<br />		os.system(run_AFDK_PS1Hinter)<br /><br />print "READY!"<br />

Comments

  • Adobe’s auto hinter runs fine in a command-line loop:
    for i in ./*.otf ; do autohint -a $i ; done<br />
Sign In or Register to comment.