Add scripts/auxiliar/update-patch-version
[lilypond/mpolesky.git] / scripts / build / gen-emmentaler-scripts.py
blob46fb8163dd7e74d0d5e9c785c1999e89da47b726
1 #!@PYTHON@
2 import sys
3 import getopt
4 import re
5 import os
7 (options, files) = \
8 getopt.getopt (sys.argv[1:],
9 '',
10 ['dir='])
13 outdir = ''
14 for opt in options:
15 o = opt[0]
16 a = opt[1]
17 if o == '--dir':
18 outdir = a
19 else:
20 print o
21 raise getopt.error
23 # Ugh
24 for design_size in [11,13,14,16,18,20,23,26]:
25 name = 'Emmentaler'
26 filename = name.lower ()
27 script = '''#!@FONTFORGE@
29 New();
31 # Separate Feta versioning?
32 # * using 20 as Weight works for gnome-font-select widget: gfs
34 notice = "";
35 notice += "This font is distributed under the GNU General Public License. ";
36 notice += "As a special exception, if you create a document which uses ";
37 notice += "this font, and embed this font or unaltered portions of this ";
38 notice += "font into the document, this font does not by itself cause the ";
39 notice += "resulting document to be covered by the GNU General Public License.";;
41 SetFontNames("%(name)s-%(design_size)d", "%(name)s-%(design_size)d", "%(name)s-%(design_size)d", "", notice, "@TOPLEVEL_VERSION@");
43 MergeFonts("feta%(design_size)d.pfb");
44 MergeFonts("feta-noteheads%(design_size)d.pfb");
45 MergeFonts("parmesan%(design_size)d.pfb");
47 # load nummer/din after setting PUA.
48 i = 0;
49 while (i < CharCnt())
50 Select(i);
51 # crashes fontforge, use PUA for now -- jcn
52 # SetUnicodeValue(i + 0xF0000, 0);
54 PRIVATE AREA
55 In the BMP, the range 0xe000 to 0xf8ff will never be assigned to any
56 characters by the standard and is reserved for private usage. For the
57 Linux community, this private area has been subdivided further into the
58 range 0xe000 to 0xefff which can be used individually by any end-user
59 and the Linux zone in the range 0xf000 to 0xf8ff where extensions are
60 coordinated among all Linux users. The registry of the characters
61 assigned to the Linux zone is currently maintained by H. Peter Anvin
62 <Peter.Anvin@linux.org>.
64 SetUnicodeValue(i + 0xE000, 0);
65 ++i;
66 endloop
69 MergeFonts("feta-alphabet%(design_size)d.pfb");
70 MergeKern("feta-alphabet%(design_size)d.tfm");
72 LoadTableFromFile("LILF", "%(filename)s-%(design_size)d.subfonts");
73 LoadTableFromFile("LILC", "feta%(design_size)d.otf-table");
74 LoadTableFromFile("LILY", "feta%(design_size)d.otf-gtable");
76 Generate("%(filename)s-%(design_size)d.otf");
77 Generate("%(filename)s-%(design_size)d.svg");
78 Generate("%(filename)s-%(design_size)d.woff");
79 ''' % vars()
81 basename = '%s-%d' % (filename, design_size)
82 path = os.path.join (outdir, basename + '.pe')
83 open (path, 'w').write (script)
85 subfonts = ['feta%(design_size)d',
86 'parmesan%(design_size)d',
87 'feta-alphabet%(design_size)d']
89 ns = []
90 for s in subfonts:
91 ns.append ('%s' % (s % vars()))
93 subfonts_str = ' '.join (ns)
95 open (os.path.join (outdir, '%(filename)s-%(design_size)d.subfonts' % vars()), 'w').write (subfonts_str)
97 path = os.path.join (outdir, '%s-%d.dep' % (filename, design_size))
99 deps = r'''%(filename)s-%(design_size)d.otf: $(outdir)/feta%(design_size)d.pfa \
100 $(outdir)/parmesan%(design_size)d.pfa \
101 $(outdir)/feta-alphabet%(design_size)d.pfa feta%(design_size)d.otf-table \
102 $(outdir)/feta-alphabet%(design_size)d.pfa feta%(design_size)d.otf-gtable
103 ''' % vars()
104 open (path, 'w').write (deps)
106 open (os.path.join (outdir, basename + '.fontname'), 'w').write ("%s-%d" % (name, design_size))