]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/lilypond-book.py
* lily/book.cc:
[lilypond.git] / scripts / lilypond-book.py
index 99ddb8f5c31f964d1dd9bc9d896d7ac91c1648f1..559a08012e031fba7121b10bc30e3eeccd018425 100644 (file)
@@ -145,6 +145,8 @@ STAFFSIZE = 'staffsize'
 TEXIDOC = 'texidoc'
 TEXINFO = 'texinfo'
 VERBATIM = 'verbatim'
+FONTLOAD = 'fontload'
+
 
 # NOTIME has no opposite so it isn't part of this dictionary.
 # NOQUOTE is used internally only.
@@ -380,7 +382,8 @@ simple_options = [
        NOINDENT,
        PRINTFILENAME,
        TEXIDOC,
-       VERBATIM
+       VERBATIM,
+       FONTLOAD
 ]
 
 ly_options = {
@@ -490,12 +493,21 @@ output = {
                OUTPUT: r'''
 @iftex
 @include %(base)s-systems.texi
-@end iftex''',
+@end iftex
+''',
 
                OUTPUTIMAGE: r'''@noindent
-@ifnottex
+@ifinfo
 @image{%(base)s,,,[image of music],%(ext)s}
-@end ifnottex
+@end ifinfo
+@html
+<p>
+  <a href="%(base)s.ly">
+    <img align="center" valign="center"
+        border="0" src="%(image)s" alt="[image of music]">
+  </a>
+</p>
+@end html
 ''',
 
                PRINTFILENAME: '''@file{%(filename)s}
@@ -529,6 +541,7 @@ PREAMBLE_LY = r'''%%%% Generated by %(program_name)s
 
 \paper {
   #(define dump-extents #t)
+  %(font_dump_setting)s
   %(paper_string)s
 }
 
@@ -741,6 +754,10 @@ def compose_ly (code, options, type):
        preamble_string = \
          string.join (compose_dict[PREAMBLE], '\n  ') % override
 
+        font_dump_setting = ''
+       if FONTLOAD in options:
+               font_dump_setting = '#(define-public force-eps-font-include #t)\n'
+                                 
        return (PREAMBLE_LY + body) % vars ()
 
 
@@ -877,7 +894,7 @@ class Lilypond_snippet (Snippet):
        def texstr_is_outdated (self):
                if backend == 'ps':
                        return 0
-               
+
                base = self.basename ()
                ok = self.ly_is_outdated ()
                ok = ok and (os.path.exists (base + '.texstr'))
@@ -938,8 +955,8 @@ class Lilypond_snippet (Snippet):
                        ext = ''
                        str += output[TEXINFO][OUTPUTIMAGE] % vars ()
 
-               base = self.basename()
-               str += output[format][OUTPUT] % vars()
+               base = self.basename ()
+               str += output[format][OUTPUT] % vars ()
                return str
 
        def output_latex (self):
@@ -984,10 +1001,10 @@ class Lilypond_snippet (Snippet):
                        verb = verbatim_texinfo (self.substring ('code'))
                        str += (output[TEXINFO][VERBATIM] % vars ())
                        if not QUOTE in self.options:
-                               str = output[TEXINFO][NOQUOTE] % vars()
+                               str = output[TEXINFO][NOQUOTE] % vars ()
 
                str += self.output_info ()
-               
+
 #              str += ('@ifinfo\n' + self.output_info () + '\n@end ifinfo\n')
 #              str += ('@tex\n' + self.output_latex () + '\n@end tex\n')
 #              str += ('@html\n' + self.output_html () + '\n@end html\n')
@@ -1229,7 +1246,8 @@ def do_process_cmd (chunks):
        ly.progress ('\n')
 
        if ly_outdated:
-               ly.progress (_ ("Processing...\n"))
+               ly.progress (_ ("Processing..."))
+               ly.progress ('\n')
                process_snippets (process_cmd, ly_outdated, texstr_outdated, png_outdated)
        else:
                ly.progress (_ ("All snippets are up to date..."))
@@ -1246,7 +1264,7 @@ def guess_format (input_filename):
                             % input_filename))
                ly.exit (1)
        return format
-       
+
 def do_file (input_filename):
        # Ugh.
        if not input_filename or input_filename == '-':
@@ -1428,7 +1446,7 @@ def main ():
        global process_cmd, format
        format = guess_format (files[0])
 
-       formats = "ps"
+       formats = 'ps'
        if format == TEXINFO:
                formats += ',png' 
        if process_cmd == '':