]> git.donarmstrong.com Git - lilypond.git/blobdiff - python/book_snippets.py
Fix 1816: Lilypond-book: Give images 1mm less linewidth
[lilypond.git] / python / book_snippets.py
index 47b683471657e39c1fcf3ef764bf2e8bbaf22075..a67b8b129e59f08599c243269bb8d25b659ffbe3 100644 (file)
@@ -162,6 +162,8 @@ def classic_lilypond_book_compatibility (key, value):
     return (None, None)
 
 
+# TODO: Remove the 1mm additional padding in the line-width, once lilypond
+#       creates tighter cropped images!
 PREAMBLE_LY = '''%%%% Generated by %(program_name)s
 %%%% Options: [%(option_string)s]
 \\include "lilypond-book-preamble.ly"
@@ -175,7 +177,9 @@ PREAMBLE_LY = '''%%%% Generated by %(program_name)s
 
 \paper {
   %(paper_string)s
-  line-width = #(- line-width (* mm  %(padding_mm)f))
+  %% offset the left padding, also add 1mm as lilypond creates cropped
+  %% images with a little space on the right
+  line-width = #(- line-width (* mm  %(padding_mm)f) (* mm 1))
 }
 
 \layout {
@@ -408,22 +412,6 @@ class LilypondSnippet (Snippet):
         if has_relative and not self.option_dict.has_key (FRAGMENT):
             self.option_dict[FRAGMENT] = None
 
-        if not has_line_width:
-            if type == 'lilypond' or FRAGMENT in self.option_dict:
-                self.option_dict[RAGGED_RIGHT] = None
-
-            if type == 'lilypond':
-                if LINE_WIDTH in self.option_dict:
-                    del self.option_dict[LINE_WIDTH]
-            else:
-                if RAGGED_RIGHT in self.option_dict:
-                    if LINE_WIDTH in self.option_dict:
-                        del self.option_dict[LINE_WIDTH]
-
-            if QUOTE in self.option_dict or type == 'lilypond':
-                if LINE_WIDTH in self.option_dict:
-                    del self.option_dict[LINE_WIDTH]
-
         if not INDENT in self.option_dict:
             self.option_dict[INDENT] = '0\\mm'