~ubuntu-branches/ubuntu/precise/lilypond/precise

« back to all changes in this revision

Viewing changes to buildscripts/gen-emmentaler-scripts.py

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Bushnell, BSG
  • Date: 2006-12-19 10:18:12 UTC
  • mfrom: (3.1.4 feisty)
  • Revision ID: james.westby@ubuntu.com-20061219101812-7awtjkp0i393wxty
Tags: 2.8.7-3
scripts/midi2ly.py: When setting DATADIR, find Lilypond python files
in the @TOPLEVEL_VERSION@ directory, not 'current'.  Patch thanks to
Chris Lamb (chris@chris-lamb.co.uk).  (Closes: #400550)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
# Ugh
 
25
for design_size in [11,13,14,16,18,20,23,26]:
 
26
        name = 'Emmentaler' 
 
27
        filename = name.lower ()
 
28
        script = '''#!@FONTFORGE@
 
29
 
 
30
New();
 
31
 
 
32
# Separate Feta versioning?
 
33
#         *  using 20 as Weight works for gnome-font-select widget: gfs
 
34
 
 
35
notice = "";
 
36
notice += "This font is distributed under the GNU General Public License. ";
 
37
notice += "As a special exception, if you create a document which uses ";
 
38
notice += "this font, and embed this font or unaltered portions of this ";
 
39
notice += "font into the document, this font does not by itself cause the ";
 
40
notice += "resulting document to be covered by the GNU General Public License.";;
 
41
 
 
42
SetFontNames("%(name)s-%(design_size)d", "%(name)s", "%(name)s %(design_size)d", "%(design_size)d", notice, "@TOPLEVEL_VERSION@");
 
43
 
 
44
MergeFonts("feta%(design_size)d.pfa");
 
45
MergeFonts("parmesan%(design_size)d.pfa");
 
46
 
 
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);
 
53
/*
 
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>.
 
63
*/
 
64
  SetUnicodeValue(i + 0xE000, 0);
 
65
  ++i;
 
66
endloop
 
67
 
 
68
 
 
69
MergeFonts("feta-alphabet%(design_size)d.pfa");
 
70
MergeKern("feta-alphabet%(design_size)d.tfm");
 
71
 
 
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");
 
75
 
 
76
Generate("%(filename)s-%(design_size)d.otf");
 
77
Generate("%(filename)s-%(design_size)d.svg");
 
78
''' % vars()
 
79
 
 
80
        basename = '%s-%d' % (filename, design_size)
 
81
        path = os.path.join (outdir, basename + '.pe')
 
82
        open (path, 'w').write (script)
 
83
 
 
84
        subfonts = ['feta%(design_size)d',
 
85
                    'parmesan%(design_size)d',
 
86
                    'feta-alphabet%(design_size)d']
 
87
 
 
88
        ns = []
 
89
        for s in subfonts:
 
90
                ns.append ('%s' % (s % vars()))
 
91
                
 
92
        subfonts_str = string.join (ns)
 
93
        
 
94
        open (os.path.join (outdir, '%(filename)s-%(design_size)d.subfonts' % vars()), 'w').write (subfonts_str)
 
95
 
 
96
        path = os.path.join (outdir, '%s-%d.dep' % (filename, design_size))
 
97
 
 
98
        deps = r'''%(filename)s-%(design_size)d.otf: $(outdir)/feta%(design_size)d.pfa \
 
99
  $(outdir)/parmesan%(design_size)d.pfa  \
 
100
  $(outdir)/feta-alphabet%(design_size)d.pfa feta%(design_size)d.otf-table \
 
101
  $(outdir)/feta-alphabet%(design_size)d.pfa feta%(design_size)d.otf-gtable
 
102
''' % vars()
 
103
        open (path, 'w').write (deps)
 
104
 
 
105
        open (os.path.join (outdir, basename + '.fontname'), 'w').write ("%s-%d" % (name, design_size))