]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scm/page.scm (make-page-stencil): read X-offset from paper-system.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 26 Jan 2006 12:55:33 +0000 (12:55 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 26 Jan 2006 12:55:33 +0000 (12:55 +0000)
(page-translate-systems): new function: take into account Y-offset.

* Documentation/topdocs/NEWS.tely (Top): document new features.

* input/regression/page-layout-manual-position.ly (Module): new
file.

ChangeLog
Documentation/topdocs/NEWS.tely
input/regression/page-layout-manual-position.ly [new file with mode: 0644]
scm/layout-page-layout.scm
scm/page.scm

index c6ad9ec27f3e3046b20b157a621829f0f0b42153..be5bc062e5fbe3e16700c49674edf10cd3e05b11 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2006-01-26  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * scm/page.scm (make-page-stencil): read X-offset from paper-system.
+       (page-translate-systems): new function: take into account Y-offset.
+
+       * Documentation/topdocs/NEWS.tely (Top): document new features.
+
+       * input/regression/page-layout-manual-position.ly (Module): new
+       file.
+
 2006-01-26  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * flower/file-path.cc (path::parse_path): Oops.
index ddd04efc7455485957118bfada1ea5f32ff0ef20..5f89cdddf1ae5d02d4d33c68da24e10ef78729b3 100644 (file)
@@ -47,6 +47,44 @@ the @uref{../,LilyPond Documentation}
 
 @itemize @bullet
 
+@item Systems individual systems may be positioned manually.
+
+@lilypond[]
+\header{
+  tagline = "lily was here"
+}
+
+#(set-default-paper-size "a7" 'landscape)
+\paper {
+  headsep = 0.0
+  footsep = 0.0
+  }
+\book {
+ \score {
+   \relative c'' {
+     c1\break
+      \overrideProperty 
+      #"Score.NonMusicalPaperColumn"
+      #'line-break-system-details
+      #'((Y-offset . 24.5)
+         (X-offset . -7.5))
+      c1 
+   }
+   }
+ \paper {
+   annotatepage = ##t
+   annotateheaders = ##t
+ }
+}
+@end lilypond
+
+This feature was sponsored by Trevor Bača and Nicolas Sceaux.
+
+@item A linebreaking configuration can now be saved as a @file{.ly}
+file automatically. This allows vertical alignments to be stretched to
+fit pages in a second formatting run. This feature was sponsored by  
+Trevor Bača and Nicolas Sceaux.
+
 @item The tie formatting for chords has been further polished. More
 cases are handled gracefully, and all scoring parameters may now be
 changed through the @code{details} property of the @code{Tie} grob.
diff --git a/input/regression/page-layout-manual-position.ly b/input/regression/page-layout-manual-position.ly
new file mode 100644 (file)
index 0000000..b593774
--- /dev/null
@@ -0,0 +1,42 @@
+\header {
+
+  texidoc = "By setting @code{Y-offset} and @code{X-offset} for the
+@code{line-break-system-details} of @code{NonMusicalPaperColumn},
+systems may be placed absolutely on the printable area of the page."
+
+  tagline = "this is the tagline"
+
+}
+
+
+#(set-default-paper-size "a6" 'portrait)
+
+\paper {
+  linewidth = 5.0\cm
+  headerMarkup = "header"
+  indent =0.0
+  annotatespacing = ##f
+  annotatepage = ##t
+  annotateheaders = ##t
+}
+
+\book {
+  \score {
+    {
+      \overrideProperty 
+      #"Score.NonMusicalPaperColumn"
+      #'line-break-system-details
+      #'((Y-offset . 0.0))
+      c1 c1 \break
+      
+    
+      \overrideProperty 
+      #"Score.NonMusicalPaperColumn"
+      #'line-break-system-details
+      #'((Y-offset . 62.0)
+         (X-offset . 8.0)
+      )
+      c1 c1
+    }
+  }
+}
index 52544ec2fafd5c105a3feaf28eb0ca461c0cfcbd..69e7c747d959b8ab30af2dae1eae4226be0bd8c0 100644 (file)
   (if (ly:output-def-lookup layout 'write-page-layout #f)
       (write-page-breaks pages)))
 
-;;; optimal page breaking
-
-;;; This is not optimal page breaking, this is optimal distribution of
-;;; lines over pages; line breaks are a given.
+;; Optimal distribution of
+;; lines over pages; line breaks are a given.
 
 ;; TODO:
 ;;
   (define scopes (ly:paper-book-scopes paper-book))
   (define force-equalization-factor #f)
   (define (get-path node done)
+    
     "Follow NODE.PREV, and return as an ascending list of pages. DONE
 is what have collected so far, and has ascending page numbers."
 
@@ -319,7 +318,6 @@ corresponding to DONE-LINES.
 
 CURRENT-BEST is the best result sofar, or #f."
 
-
     (let* ((this-page-num (if (null? best-paths)
                               (ly:output-def-lookup paper 'firstpagenumber)
                               (1+ (page-page-number (car best-paths)))))
@@ -433,8 +431,7 @@ DONE."
        (ly:output-def-lookup paper 'verticalequalizationfactor 0.3))
   
   (let* ((best-break-node (walk-lines '() '() lines))
-        (break-nodes (get-path best-break-node '()))
-        )
+        (break-nodes (get-path best-break-node '())))
 
     (page-set-property! (car (last-pair break-nodes)) 'is-last #t)
     (if #f; (ly:get-option 'verbose)
index 766db7911e3f6ea5f63c1b976323afa37771d7d7..2420857f8292afd6f01f079f08e35b94330dd94f 100644 (file)
     (lambda (pg)
       (page-property pg j))))
  
- '(page-number prev lines force penalty configuration lines))
+ '(page-number prev lines force penalty lines))
 
-(define (page-system-numbers node)
+(define (page-system-numbers page)
   (map (lambda (ps) (ly:prob-property ps 'number))
-       (page-lines node)))
+       (page-lines page)))
+
+(define (page-translate-systems page)
+  (for-each
+
+   (lambda (sys-off)
+     (let*
+        ((sys (car sys-off))
+         (off (cadr sys-off)))
+
+       (if (not (number? (ly:prob-property sys 'Y-offset)))
+          (ly:prob-set-property! sys 'Y-offset off))))
+   
+   (zip (page-property page 'lines)
+       (page-property page 'configuration))))
 
 (define (annotate-page layout stencil)
   (let*
 
          
          ;; add arrow markers 
-         (if (annotate? layout)
+         (if (or (annotate? layout)
+                 (ly:output-def-lookup layout 'annotateheaders #f)) 
              (set! head-stencil
                    (ly:stencil-add
                     (ly:stencil-translate-axis
        (layout (ly:paper-book-paper p-book))
        (scopes (ly:paper-book-scopes p-book))
        (lines (page-lines page))
-       (offsets (page-configuration page))
        (number (page-page-number page))
        (last? (page-property page 'is-last))
        )
@@ -235,13 +249,13 @@ create offsets.
 
   
 
+  (page-translate-systems page)
   (let*
       ((p-book (page-property page 'paper-book))
        (prop (lambda (sym) (page-property page sym)))
        (layout (ly:paper-book-paper p-book))
        (scopes (ly:paper-book-scopes p-book))
        (lines (page-lines page))
-       (offsets (page-configuration page))
        (number (page-page-number page))
 
        ;; TODO: naming vsize/hsize not analogous to TeX.
@@ -266,29 +280,31 @@ create offsets.
 
        (last-system #f)
        (last-y 0.0)
-       (add-to-page (lambda (stencil y)
+       (add-to-page (lambda (stencil y)
                      (set! page-stencil
                            (ly:stencil-add page-stencil
                                            (ly:stencil-translate stencil
                                                                  (cons
-                                                                  system-xoffset
+                                                                  (+ system-xoffset x)
                                                                   (- 0 head-height y (prop 'top-margin)))
 
                                                                  )))))
        (add-system
-       (lambda (stencil-position)
-         (let* ((system (car stencil-position))
-                (stencil (paper-system-stencil system))
-                (y (cadr stencil-position))
+       (lambda (system)
+         (let* ((stencil (paper-system-stencil system))
+                (y (ly:prob-property system 'Y-offset))
                 (is-title (paper-system-title?
-                           (car stencil-position))))
-           (add-to-page stencil y)
+                           system)))
+           (add-to-page stencil
+                        (ly:prob-property system 'X-offset 0.0)
+                        y)
            (if (and (ly:stencil? system-separator-stencil)
                     last-system
                     (not (paper-system-title? system))
                     (not (paper-system-title? last-system)))
                (add-to-page
                 system-separator-stencil
+                0
                 (average (- last-y
                             (car (paper-system-staff-extents last-system)))
                          (- y
@@ -299,7 +315,9 @@ create offsets.
        (foot (prop 'foot-stencil))
        )
 
-    (if (annotate? layout)
+    (if (or (annotate? layout)
+           (ly:output-def-lookup layout 'annotatesystems #f))
+
        (begin
          (for-each (lambda (sys) (paper-system-annotate sys layout))
                    lines)
@@ -314,7 +332,7 @@ create offsets.
                            (ly:make-stencil "" (cons 0 0) (cons 0 0)))
                            0. 0.))
 
-    (map add-system (zip lines offsets))
+    (map add-system lines)
 
     (ly:prob-set-property! page 'bottom-system-edge
                           (car (ly:stencil-extent page-stencil Y)))
@@ -341,7 +359,8 @@ create offsets.
          (ly:stencil-translate page-stencil (cons (prop 'left-margin) 0)))
 
     ;; annotation.
-    (if (annotate? layout)
+    (if (or (annotate? layout)
+           (ly:output-def-lookup layout 'annotatepage #f))
        (set! page-stencil (annotate-page layout page-stencil)))
 
     page-stencil))