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