]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/lilypond-book.py
Fix 893.
[lilypond.git] / scripts / lilypond-book.py
index 4aa5cb91339457c787d99883b68f8dbbbd8a3cbc..9fad727f596c31c193a847c5ce0366b6ef028090 100644 (file)
@@ -272,7 +272,6 @@ TEXIDOC = 'texidoc'
 TEXINFO = 'texinfo'
 VERBATIM = 'verbatim'
 VERSION = 'lilypondversion'
-FONTLOAD = 'fontload'
 FILENAME = 'filename'
 ALT = 'alt'
 
@@ -600,7 +599,6 @@ simple_options = [
     TEXIDOC,
     LANG,
     VERBATIM,
-    FONTLOAD,
     FILENAME,
     ALT,
     ADDVERSION
@@ -830,7 +828,6 @@ PREAMBLE_LY = '''%%%% Generated by %(program_name)s
 %(preamble_string)s
 
 \paper {
-  %(font_dump_setting)s
   %(paper_string)s
   force-assignment = #""
   line-width = #(- line-width (* mm  %(padding_mm)f))
@@ -1119,13 +1116,16 @@ class LilypondSnippet (Snippet):
         if not INDENT in self.option_dict:
             self.option_dict[INDENT] = '0\\mm'
 
-        # The QUOTE pattern from ly_options only emits the `line-width'
-        # keyword.
-        if has_line_width and QUOTE in self.option_dict:
-            if no_line_width_value:
-                del self.option_dict[LINE_WIDTH]
-            else:
-                del self.option_dict[QUOTE]
+        # Set a default line-width if there is none. We need this, because
+        # lilypond-book has set left-padding by default and therefore does
+        # #(define line-width (- line-width (* 3 mm)))
+        # TODO: Junk this ugly hack if the code gets rewritten to concatenate
+        # all settings before writing them in the \paper block.
+        if not LINE_WIDTH in self.option_dict:
+            if not QUOTE in self.option_dict:
+                if not LILYQUOTE in self.option_dict:
+                    self.option_dict[LINE_WIDTH] = "#(- paper-width \
+left-margin-default right-margin-default)"
 
     def compose_ly (self, code):
         if FRAGMENT in self.option_dict:
@@ -1225,9 +1225,6 @@ class LilypondSnippet (Snippet):
         notes_string = '\n  '.join (compose_dict[NOTES]) % vars ()
         preamble_string = '\n  '.join (compose_dict[PREAMBLE]) % override
         padding_mm = global_options.padding_mm
-        font_dump_setting = ''
-        if FONTLOAD in self.option_dict:
-            font_dump_setting = '#(define-public force-eps-font-include #t)\n'
 
         d = globals().copy()
         d.update (locals())
@@ -1241,7 +1238,9 @@ class LilypondSnippet (Snippet):
             except ImportError:
                 from md5 import md5
 
-            hash = md5 (self.relevant_contents (self.full_ly ()))
+            # We only want to calculate the hash based
+            # on the snippet code, not the snippet + preamble
+            hash = md5 (self.relevant_contents (self.ly ()))
 
             ## let's not create too long names.
             self.checksum = hash.hexdigest ()[:10]
@@ -1757,17 +1756,17 @@ def get_latex_textwidth (source):
     os.unlink (logfile)
 
     columns = 0
-    m = re.search ('columns=([0-9.]*)', parameter_string)
+    m = re.search ('columns=([0-9.]+)', parameter_string)
     if m:
         columns = int (m.group (1))
 
     columnsep = 0
-    m = re.search ('columnsep=([0-9.]*)pt', parameter_string)
+    m = re.search ('columnsep=([0-9.]+)pt', parameter_string)
     if m:
         columnsep = float (m.group (1))
 
     textwidth = 0
-    m = re.search ('textwidth=([0-9.]*)pt', parameter_string)
+    m = re.search ('textwidth=([0-9.]+)pt', parameter_string)
     if m:
         textwidth = float (m.group (1))
         if columns: