import os
import sys
import linecache
PATH = sys.argv[1]
# GASP data:
section_2 = "\topenTypeGaspRangeRecords\n\t\n\t\n\trangeGaspBehavior\n\t\n\t0\n\t1\n\t2\n\t3\n\t\n\trangeMaxPPEM\n\t65535\n\t\n\t\n"
os.chdir(PATH)
# Before input GASP data:
section_1 = ""
l = 0
while l < 35:
section_1 = section_1 + linecache.getline('fontinfo.plist', l)
l += 1
# after input GASP data:
section_3 = ""
l = 35
while True:
section_3 = section_3 + linecache.getline('fontinfo.plist', l)
l += 1
if (linecache.getline('fontinfo.plist', l) == ""):
break
# new fontinfo:
data = section_1 + section_2 + section_3
fontinfo = open("fontinfo.plist" , "w")
fontinfo.write(data)
fontinfo.close()