]> git.donarmstrong.com Git - lilypond.git/blob - buildscripts/ps-embed-cff.py
8eabaede5b72259722de689db4d23888c22ca5ee
[lilypond.git] / buildscripts / ps-embed-cff.py
1 #!@PYTHON@
2 import sys
3
4 file  = sys.argv[1]
5 font_set_name  = sys.argv[2]
6 output = sys.argv[3]
7 body = open (file).read() 
8 body_length  = len (body)
9 version = '0'
10 binary_data = "/%(font_set_name)s %(body_length)d StartData "  % vars() \
11   + body
12 binary_length = len (binary_data)
13
14 header = r"""%%%%BeginResource: font %(font_set_name)s
15 %%!PS-Adobe-3.0 Resource-FontSet
16 %%%%DocumentNeededResources: ProcSet (FontSetInit)
17 %%%%Title: (FontSet/%(font_set_name)s)
18 %%%%Version: %(version)s
19 %%%%EndComments
20 %%%%IncludeResource: ProcSet (FontSetInit)
21 %%%%BeginResource: FontSet (%(font_set_name)s)
22 /FontSetInit /ProcSet findresource begin
23 %%%%BeginData: %(binary_length)d Binary Bytes
24 """ % vars()
25
26
27 footer = """\n%%%%EndData
28 %%%%EndResource
29 %%%%EOF
30 %%%%EndResource\n""" % vars()
31
32 fo = open (output,'w')
33 fo.write (header)
34 fo.write (binary_data)
35 fo.write (footer)