def strip_eps_font(filename):
 inf = open(filename)
 filecache = []
 in_ttf = False
 for line in inf:
  if ('Bitstream' in line):
   line = line.replace('BitstreamVeraSans-Roman', 'Arial')
  if line.startswith('%%BeginFont'):
   in_ttf = True
  if line.startswith('%%EndFont'):
   in_ttf = False
   continue
  if in_ttf:
   continue
  else:
   filecache.append(line)
 inf.close()
 ouf = open(filename, 'w+')
 ouf.write(''.join(filecache))
 ouf.close()

def strip_eps_font ( filename ) : inf = open ( filename ) filecache = [ ] in_ttf = False for line in inf : if ( 'Bitstream' in line ) : line = line . replace ( 'BitstreamVeraSans-Roman' , 'Arial' ) if line . startswith ( '%%BeginFont' ) : in_ttf = True if line . startswith ( '%%EndFont' ) : in_ttf = False continue if in_ttf : continue else : filecache . append ( line ) inf . close ( ) ouf = open ( filename , 'w+' ) ouf . write ( '' . join ( filecache ) ) ouf . close ( )
rewrite file by changing font to handle eps bug .