X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scripts%2Fbuild%2Fmf-to-table.py;h=7c193987ec51788b47fd22be28d101a57ccfe984;hb=063a1b9e21d8309c4940696e1a341592be40f74a;hp=2c1df75f7fa6d55c7150f455cba950b44b7cbf03;hpb=97047e999fd00f4981bad49eb4a45f6952bfd1e3;p=lilypond.git diff --git a/scripts/build/mf-to-table.py b/scripts/build/mf-to-table.py index 2c1df75f7f..7c193987ec 100644 --- a/scripts/build/mf-to-table.py +++ b/scripts/build/mf-to-table.py @@ -1,10 +1,23 @@ #!@PYTHON@ -# mf-to-table.py -- convert spacing info in MF logs . +# mf-to-table.py -- convert spacing info in MF logs . + +# This file is part of LilyPond, the GNU music typesetter. +# +# Copyright (C) 1997--2012 Han-Wen Nienhuys +# +# LilyPond is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. # -# source file of the GNU LilyPond music typesetter +# LilyPond is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # -# (c) 1997--2008 Han-Wen Nienhuys +# You should have received a copy of the GNU General Public License +# along with LilyPond. If not, see . import os import sys @@ -14,7 +27,7 @@ import time def read_log_file (fn): str = open (fn).read () - str = re.sub ('\n', '', str) + str = re.sub ('[\n\r]', '', str) str = re.sub ('[\t ]+', ' ', str) deps = [] @@ -42,20 +55,26 @@ font_family = 'feta' def parse_logfile (fn): autolines, deps = read_log_file (fn) charmetrics = [] - + global_info = { 'filename' : os.path.splitext (os.path.basename (fn))[0] } group = '' - for l in autolines: + for i, l in enumerate(autolines): tags = l.split ('@:') if tags[0] == 'group': group = tags[1] elif tags[0] == 'puorg': group = '' elif tags[0] == 'char': - name = tags[9] + try: + name = tags[9] + except IndexError: + print 'Error in mf-to-table while processing file', fn + print 'Index 9 >', len(tags)-1, 'on line', i + print l + raise if group: name = group + '.' + name @@ -99,7 +118,7 @@ def parse_logfile (fn): elif tags[0] == 'parameter': global_info[tags[1]] = tags[2]; - + return (global_info, charmetrics, deps) @@ -137,7 +156,7 @@ def global_lisp_table (global_info): keys = ['staffsize', 'stafflinethickness', 'staff_space', 'linethickness', 'black_notehead_width', 'ledgerlinethickness', - 'design_size', + 'design_size', 'blot_diameter' ] for k in keys: @@ -146,7 +165,7 @@ def global_lisp_table (global_info): return str - + def ps_encoding (name, global_info, charmetrics): encs = ['.notdef'] * 256 for m in charmetrics: @@ -207,9 +226,9 @@ for opt in options: depfile_nm = a elif o == '--outdir' or o == '-o': outdir_prefix = a - elif o == '--lisp': + elif o == '--lisp': char_lisp_nm = a - elif o == '--global-lisp': + elif o == '--global-lisp': global_lisp_nm = a elif o == '--enc': enc_nm = a @@ -229,6 +248,12 @@ for filenm in files: enc_name = 'FetaEncoding' if re.search ('parmesan', filenm): enc_name = 'ParmesanEncoding' + elif re.search ('parmesan-noteheads', filenm): + enc_name = 'ParmesanNoteheadsEncoding' + elif re.search ('feta-noteheads', filenm): + enc_name = 'FetaNoteheadsEncoding' + elif re.search ('feta-flags', filenm): + enc_name = 'FetaFlagsEncoding' elif re.search ('feta-brace', filenm): enc_name = 'FetaBraceEncoding' elif re.search ('feta-alphabet', filenm): @@ -239,6 +264,6 @@ for filenm in files: open (global_lisp_nm, 'w').write (global_lisp_table (g)) if depfile_nm: open (depfile_nm, 'wb').write (get_deps (deps, - [base + '.log', base + '.dvi', base + '.pfa', + [base + '.log', base + '.dvi', depfile_nm, base + '.pfb']))