Skip to content

Instantly share code, notes, and snippets.

@skyisle
Created February 10, 2012 06:18
Show Gist options
  • Save skyisle/1787141 to your computer and use it in GitHub Desktop.
Save skyisle/1787141 to your computer and use it in GitHub Desktop.
Copy font info
#!/usr/bin/python
import sys
import fontforge
if len(sys.argv) < 3:
print("Usage: %s <from> <to>" % sys.argv[0])
sys.exit(1)
fromfile = sys.argv[1]
tofile = sys.argv[2]
fromfont = fontforge.open(fromfile)
tofont = fontforge.open(tofile)
print("fontname: " + fromfont.fontname);
print("familyname: " + fromfont.familyname);
print("fullname: " + fromfont.fullname);
fontname = fromfont.fontname
familyname = fromfont.familyname
fullname = fromfont.fullname
tofont.fontname = fontname
tofont.familyname = familyname
tofont.fullname = fullname
tofont.sfnt_names = fromfont.sfnt_names;
fromfont.close()
tofont.save()
tofont.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment