]> git.donarmstrong.com Git - lilypond.git/blob - buildscripts/gen-emmentaler-scripts.py
* scm/output-gnome.scm (utf8-string): New function.
[lilypond.git] / buildscripts / gen-emmentaler-scripts.py
1 #!@PYTHON@
2 import sys
3 import getopt
4 import re 
5 import os
6 import string
7
8 (options, files) = \
9   getopt.getopt (sys.argv[1:],
10                  '',
11                  ['dir='])
12
13
14 outdir = ''
15 for opt in options:
16         o = opt[0]
17         a = opt[1]
18         if o == '--dir':
19                 outdir = a
20         else:
21                 print o
22                 raise getopt.error
23
24
25 for design_size in [11,13,14,16,18,20,23,26]:
26         name = 'emmentaler' 
27         script = '''#!@FONTFORGE@
28 New();
29
30 # Separate Feta versioning?
31 #         *  using 20 as Weight works for gnome-font-select widget: gfs
32 SetFontNames("%(name)s", "%(name)s", "%(name)s %(design_size)d", "%(design_size)d", "GNU GPL", "@TOPLEVEL_VERSION@");
33
34 MergeFonts("feta%(design_size)d.pfa");
35 MergeFonts("parmesan%(design_size)d.pfa");
36
37 # load nummer/din after setting PUA.
38 i = 0;
39 while (i < CharCnt())
40   Select(i);
41 # crashes fontforge, use PUA for now -- jcn
42 # SetUnicodeValue(i + 0xF0000, 0);
43 /*
44 PRIVATE AREA
45        In the BMP, the range 0xe000 to 0xf8ff will never be  assigned  to  any
46        characters  by  the standard and is reserved for private usage. For the
47        Linux community, this private area has been subdivided further into the
48        range  0xe000  to 0xefff which can be used individually by any end-user
49        and the Linux zone in the range 0xf000 to 0xf8ff where  extensions  are
50        coordinated  among  all  Linux  users.  The  registry of the characters
51        assigned to the Linux zone is currently maintained by  H.  Peter  Anvin
52        <Peter.Anvin@linux.org>.
53 */
54   SetUnicodeValue(i + 0xE000, 0);
55   ++i;
56 endloop
57
58
59 MergeFonts("feta-alphabet%(design_size)d.pfa");
60 MergeKern("feta-alphabet%(design_size)d.tfm");
61
62 LoadTableFromFile("LILF", "%(name)s%(design_size)d.subfonts")
63 LoadTableFromFile("LILC", "feta%(design_size)d.otf-table")
64 LoadTableFromFile("LILY", "feta%(design_size)d.otf-gtable")
65
66 Generate("%(name)s%(design_size)d.otf");
67 Generate("%(name)s%(design_size)d.cff");
68 Generate("%(name)s%(design_size)d.svg");
69 ''' % vars()
70
71         path = os.path.join (outdir, name + '%d' % design_size +  '.pe')
72         open (path, 'w').write (script)
73
74         subfonts = ['feta%(design_size)d',
75                     'parmesan%(design_size)d',
76                     'feta-alphabet%(design_size)d']
77
78         ns = []
79         for s in subfonts:
80                 ns.append ('%s' % (s % vars()))
81                 
82         subfonts_str = string.join (ns)
83         
84         open (os.path.join (outdir, '%(name)s%(design_size)d.subfonts' % vars()), 'w').write (subfonts_str)
85
86         path = os.path.join (outdir, name + '%d' % design_size +  '.dep')
87
88         deps = r'''%(name)s%(design_size)d.otf: $(outdir)/feta%(design_size)d.pfa \
89   $(outdir)/parmesan%(design_size)d.pfa  \
90   $(outdir)/feta-alphabet%(design_size)d.pfa feta%(design_size)d.otf-table \
91   $(outdir)/feta-alphabet%(design_size)d.pfa feta%(design_size)d.otf-gtable
92 ''' % vars()
93         open (path, 'w').write (deps)