def main(argv):
#   Open the font file supplied as the first argument on the command line
    font_in = argv[1]
    font = fontforge.open(font_in)
#   If there is a second font file specified on the command line, output to that
    if argv[2]:
        font_out = argv[2]
#   Else, update the file
    else:
        font_out = font_in

#   Print the existing PREP table
    print "The PREP table is:"
    print getprep(font)

#   Set PREP to magic prep
    prepTextMagic = """PUSHW_1
     511
    SCANCTRL
    PUSHB_1
     4
    SCANTYPE"""
    prepAsmMagic = fontforge.parseTTInstrs(prepTextMagic)
    font.setTableData("prep",prepAsmMagic)

#   Print the existing PREP table
    print "The PREP table is now:"
    print getprep(font)

#   Generate the new font with no hinting instructions
    flags = ('omit-instructions',)
    font.generate(font_out, flags = flags)
    print "in file", font_out, " - done!"
Example #2
0
# fontforge.loadNamelist()
# fontforge.loadNamelistDir()
# fontforge.preloadCidmap()

fontforge.printSetup("lpr")

if (fontforge.unicodeFromName("A")!=65) or (fontforge.unicodeFromName("uni030D")!=0x30D):
  raise ValueError("Wrong return from unicodeFromName")

foo = fontforge.version()

ambrosia = sys.argv[1]

fonts = fontforge.fonts()
if ( len(fonts)!=0 ) :
  raise ValueError("Wrong return from fontforge.fonts")

fontforge.activeFont()
fontforge.activeGlyph()
fontforge.activeLayer()
fontnames= fontforge.fontsInFile(ambrosia)
if len(fontnames)!=1 or fontnames[0]!='Ambrosia':
  raise ValueError("Wrong return from fontforge.fontsInFile")
font = fontforge.open(ambrosia)
morefonts = fontforge.fonts()
if len(morefonts)!=1:
  raise ValueError("Wrong return from fontforge.fonts")

instrs = fontforge.parseTTInstrs("SRP0\nMIRP[min,rnd,black]")
print(fontforge.unParseTTInstrs(instrs))