3 # mess up the coding table of PFAemmentaler to work around
6 # http://bugs.ghostscript.com/show_bug.cgi?id=688017
15 (options, files) = getopt.getopt (sys.argv[1:], 'o', ['outdir='])
19 if o == '--outdir' or o == '-o':
23 def get_glyph_names (enc_name):
24 enc_str = open (enc_name).read ()
26 def note_glyph (match):
31 m = re.sub ("(/[a-z-.A-Z0-9]+) %", note_glyph, enc_str )
33 glyphs = filter (lambda x: None == re.match (r'/\.notdef', x),
37 if re.search ('mmental', filename):
38 glyph_names = (get_glyph_names ('%(outdir)s/feta20.enc' % vars ())
39 + get_glyph_names ('%(outdir)s/feta-alphabet20.enc' % vars ())
40 + get_glyph_names ('%(outdir)s/parmesan20.enc' % vars ()))
42 str = open (filename).read ()
43 os.rename (filename, filename + "~")
45 glyph_names = glyph_names[:256]
50 put_glyphs += 'dup %d %s put \n' % (i,g)
53 str = re.sub ('( 0 1 255 { 1 index exch /.notdef put} for)',
54 '\\1 \n %s' % put_glyphs,
56 str = re.sub ('StandardEncoding def',
57 '256 array\n0 1 255 { 1 index exch /.notdef put} for\n%sreadonly def' % put_glyphs,
60 open (filename, 'w').write (str)