From 3427445a6d0d612d86e0e26e26179cf2033342d1 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Fri, 3 Sep 2004 23:21:18 +0000 Subject: [PATCH] *** empty log message *** --- ChangeLog | 30 +++ Documentation/user/changing-defaults.itely | 5 + lily/align-interface.cc | 3 +- lily/include/paper-system.hh | 3 +- lily/paper-system.cc | 12 +- lily/simple-spacer.cc | 67 +++-- lily/slur-engraver.cc | 7 +- lily/system.cc | 8 +- ly/book-paper-defaults.ly | 27 +- ly/engraver-init.ly | 2 +- scm/define-grobs.scm | 1 + scm/framework-tex.scm | 2 +- scm/page-layout.scm | 271 ++++++++++++++------- scm/paper.scm | 1 + 14 files changed, 309 insertions(+), 130 deletions(-) diff --git a/ChangeLog b/ChangeLog index 007620b4f7..3743579acf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,35 @@ +2004-09-03 Han-Wen Nienhuys + + * lily/simple-spacer.cc (LY_DEFINE): return something sensible for + 0 springs + + * lily/system.cc (post_processing): + + * scm/page-layout.scm (ly:optimal-page-breaks): implement uniform + density for vertical spacing by means of force penalty. + + * scm/paper.scm (paper-set-staff-size): add betweensystemspace as + dimension-variables + + * Documentation/user/changing-defaults.itely (Page layout): add + betweensystemspace variable. + + * ly/book-paper-defaults.ly: set betweensystemspace: 20 mm + + * scm/page-layout.scm (space-systems): new function. Use spring + and rod approach for vertically spacing systems. + + * ly/engraver-init.ly: tune down minimumVerticalExtent. + + * scm/define-grobs.scm (all-grob-descriptions): set threshold for + vertical alignment. + + * lily/slur-engraver.cc (process_music): add warning for slur. + 2004-09-02 Han-Wen Nienhuys + * lily/include/lily-guile.hh (scm_is_number): add scm_is_number + * lily/simple-spacer.cc (LY_DEFINE): ly_solve_spring_rod_problem: export spacing routine to SCM. diff --git a/Documentation/user/changing-defaults.itely b/Documentation/user/changing-defaults.itely index e9a73b8d00..bd25872d9d 100644 --- a/Documentation/user/changing-defaults.itely +++ b/Documentation/user/changing-defaults.itely @@ -2222,6 +2222,11 @@ The default layout responds to the following settings in the If set to true, systems will not be spread across the page. @item raggedlastbottom If set to true, systems will not be spread to fill the last page. + +@item betweensystemspace + This dimensions determines the distance between systems. It is the +ideal distance between the center of the bottom staff of one system, and +the center of the top staff of the next system. @end table @example diff --git a/lily/align-interface.cc b/lily/align-interface.cc index b3bbf6a07c..f510304b66 100644 --- a/lily/align-interface.cc +++ b/lily/align-interface.cc @@ -128,7 +128,8 @@ Align_interface::align_elements_to_extents (Grob * me, Axis a) if (!stacking_dir) stacking_dir = DOWN; - Interval threshold = robust_scm2interval (me->get_property ("threshold"), Interval (0, Interval::infinity ())); + Interval threshold = robust_scm2interval (me->get_property ("threshold"), + Interval (0, Interval::infinity ())); Array dims; diff --git a/lily/include/paper-system.hh b/lily/include/paper-system.hh index 63cffb3fb1..b94a3be35e 100644 --- a/lily/include/paper-system.hh +++ b/lily/include/paper-system.hh @@ -32,8 +32,7 @@ public: int number_; Paper_system (Stencil, bool); - - Offset dim () const; + Stencil to_stencil () const; SCM stencils () const; bool is_title () const; diff --git a/lily/paper-system.cc b/lily/paper-system.cc index 885b865cab..ab2fc13f3d 100644 --- a/lily/paper-system.cc +++ b/lily/paper-system.cc @@ -26,6 +26,7 @@ Paper_system::Paper_system (Stencil s, bool is_title) penalty_ = 0; smobify_self (); stencil_ = s; + staff_refpoints_ = Interval(0,0); } Paper_system::~Paper_system () @@ -67,13 +68,6 @@ Paper_system::penalty () const return penalty_; } -Offset -Paper_system::dim () const -{ - return Offset (stencil_.extent (X_AXIS).length (), - stencil_.extent (Y_AXIS).length ()); -} - Stencil Paper_system::to_stencil () const { @@ -88,9 +82,11 @@ LY_DEFINE (ly_paper_system_height, "ly:paper-system-extent", SCM_ASSERT_TYPE (ps, system, SCM_ARG1, __FUNCTION__, "paper-system"); SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG2, __FUNCTION__, "axis"); Axis ax = (Axis)ly_scm2int (axis); - return scm_make_real (ps->dim ()[ax]); + return ly_interval2scm (ps->to_stencil().extent (ax)); } + + LY_DEFINE (ly_paper_system_title_p, "ly:paper-system-title?", 1, 0, 0, (SCM system), "Is @var{system} a title system?") diff --git a/lily/simple-spacer.cc b/lily/simple-spacer.cc index 08fd455e15..a7fd8a7680 100644 --- a/lily/simple-spacer.cc +++ b/lily/simple-spacer.cc @@ -143,7 +143,28 @@ Simple_spacer::active_blocking_force () const Real Simple_spacer::active_springs_stiffness () const { - return range_stiffness (0, springs_.size ()); + Real stiff = range_stiffness (0, springs_.size ()); + if (isinf (stiff)) + { + /* + all springs are inactive. Take the stiffness of the + latest spring to block. + */ + + Real max_block_force = -infinity_f; + int max_i = -1; + for (int i=0; i < springs_.size (); i++) + { + if (springs_[i].block_force_ > max_block_force) + { + max_i = i; + max_block_force = springs_[i].block_force_; + } + } + + stiff = springs_[max_i].hooke_; + } + return stiff; } void @@ -185,7 +206,7 @@ Simple_spacer::my_solve_linelen () if (conf < line_len_) { - force_ += (line_len_ - conf) * active_springs_stiffness (); + force_ += (line_len_ - conf) * active_springs_stiffness (); break; } else @@ -214,15 +235,20 @@ LY_DEFINE(ly_solve_spring_rod_problem, "ly:solve-spring-rod-problem", "are connected by @var{count-1} springs, and an arbitrary number of rods " "Springs have the format (ideal, hooke) and rods (idx1, idx2, distance) " "@var{length} is a number, @var{ragged} a boolean " - "Return: a list containing the force (#f for non-satisfied constraints)" - "followed by positions of the objects." + "Return: a list containing the force (#f for non-satisfied constraints) " + "followed by the @var{spring-count}+1 positions of the objects. " ) { - SCM_ASSERT_TYPE (scm_ilength (springs) >= 0, springs, SCM_ARG1, __FUNCTION__, "list of springs"); + int len = scm_ilength (springs); + if (len == 0) + return scm_list_2 (scm_from_double (0.0), scm_from_double (0.0)); + + SCM_ASSERT_TYPE (len >= 0, springs, SCM_ARG1, __FUNCTION__, "list of springs"); SCM_ASSERT_TYPE (scm_ilength (rods) >= 0, rods, SCM_ARG2, __FUNCTION__, "list of rods"); SCM_ASSERT_TYPE (scm_is_number (length) || length == SCM_BOOL_F, length, SCM_ARG3, __FUNCTION__, "number or #f"); + bool is_ragged = ragged == SCM_BOOL_T; Simple_spacer spacer; for (SCM s = springs; ly_c_pair_p (s); s = ly_cdr (s)) @@ -236,22 +262,20 @@ LY_DEFINE(ly_solve_spring_rod_problem, "ly:solve-spring-rod-problem", for (SCM s = rods; ly_c_pair_p (s); s = ly_cdr (s)) { SCM entry = ly_car (s); - int l = scm_to_int (ly_car (s)); - int r = scm_to_int (ly_cadr (s)); - entry = ly_cddr (s); + int l = scm_to_int (ly_car (entry)); + int r = scm_to_int (ly_cadr (entry)); + entry = ly_cddr (entry); - Real distance = scm_to_double (ly_car (s)); + Real distance = scm_to_double (ly_car (entry)); spacer.add_rod (l, r, distance); } + spacer.line_len_ = scm_to_double (length); + if (is_ragged) spacer.my_solve_natural_len (); else - { - spacer.line_len_ = scm_to_double (length); - - spacer.my_solve_linelen (); - } + spacer.my_solve_linelen (); Array posns; posns.push (0.0); @@ -261,17 +285,20 @@ LY_DEFINE(ly_solve_spring_rod_problem, "ly:solve-spring-rod-problem", posns.push (posns.top() + l); } - SCM force_return = scm_from_double (spacer.force_); + SCM force_return = SCM_BOOL_F; if (is_ragged) { Real len = posns.top (); if (spacer.line_len_ - len >= 0) force_return = scm_from_double ((spacer.line_len_ - len) * spacer.active_springs_stiffness ()); - else - force_return = SCM_BOOL_F; } - + else if (not isinf (spacer.force_) + && spacer.is_active ()) + { + force_return = scm_from_double (spacer.force_); + } + SCM retval= SCM_EOL; for (int i = posns.size(); i--;) { @@ -297,7 +324,9 @@ Spring_description::Spring_description () bool Spring_description::is_sane () const { - return (hooke_ > 0) && !isinf (ideal_) && !isnan (ideal_); + return (hooke_ > 0) + && ideal_ > 0 + && !isinf (ideal_) && !isnan (ideal_); } Real diff --git a/lily/slur-engraver.cc b/lily/slur-engraver.cc index 96c83dde18..e963ad68b1 100644 --- a/lily/slur-engraver.cc +++ b/lily/slur-engraver.cc @@ -12,7 +12,7 @@ #include "engraver.hh" #include "spanner.hh" #include "tie.hh" - +#include "input.hh" /* It is possible that a slur starts and ends on the same note. At least, it is for phrasing slurs: a note can be both beginning and @@ -119,6 +119,11 @@ Slur_engraver::process_music () { if (events_[STOP]) { + if (slurs_.size() == 0) + { + events_[STOP]->origin()->warning (_ ("No slur to end")); + } + end_slurs_ = slurs_; slurs_.clear (); } diff --git a/lily/system.cc b/lily/system.cc index 6f57b2db61..75c7a95551 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -8,6 +8,7 @@ #include +#include "align-interface.hh" #include "axis-group-interface.hh" #include "warn.hh" #include "system.hh" @@ -308,7 +309,7 @@ System::post_processing () programming_error ("System with zero extent."); else translate_axis (-iv[MAX], Y_AXIS); - + /* Generate all stencils to trigger font loads. This might seem inefficient, but Stencils are cached per grob anyway. */ @@ -336,6 +337,8 @@ System::get_line () Start with layer 3, since scm_cons prepends to list. */ SCM all = get_property ("all-elements"); Interval staff_refpoints; + staff_refpoints.set_empty(); + for (int i = LAYER_COUNT; i--;) for (SCM s = all; ly_c_pair_p (s); s = ly_cdr (s)) { @@ -344,6 +347,7 @@ System::get_line () if (i == 0 && Axis_group_interface::has_interface (g) + && !Align_interface::has_interface (g) && dynamic_cast (g)) { staff_refpoints.add_point (g->relative_coordinate (this, Y_AXIS)); @@ -368,8 +372,6 @@ System::get_line () st.translate (o + extra); *tail = scm_cons (st.expr (), SCM_EOL); tail = SCM_CDRLOC(*tail); - - } if (Stencil *me = get_stencil ()) diff --git a/ly/book-paper-defaults.ly b/ly/book-paper-defaults.ly index a3d1ced8bd..99251ea38c 100644 --- a/ly/book-paper-defaults.ly +++ b/ly/book-paper-defaults.ly @@ -1,6 +1,14 @@ \version "2.3.8" \bookpaper { + + %%%%%%%%%%%%%% + %%%% + %%%% WARNING + + %%% if you add any new dimensions, don't forget to update + %%% the dimension-variables variable. see paper.scm + unit = #(ly:unit) mm = 1.0 in = 25.4 @@ -11,14 +19,13 @@ %% input encoding in EMACS? -- jcn %%%%inputencoding = #"TeX" inputencoding = #"latin1" - printpagenumber = ##t %% %% 20pt staff, 5 pt = 1.75 mm %% - outputscale = #1.7573 + outputscale = #1.7573 #(define-public score-title default-score-title) #(define-public user-title default-user-title) @@ -30,8 +37,22 @@ #(paper-set-staff-size (* 20.0 pt)) + % + % this dimension includes the extent of the + % staves themselves. + % + betweensystemspace = #(* 20 mm) + + % + % fixed space between systems. + % + betweensystempadding = #(* 4 mm) + + + raggedbottom = ##f + raggedlastbottom= ##f - papersize = "a4" + papersize = "a4" #(define font-defaults '((font-encoding . fetaMusic))) diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index c2b3a8c2bc..fac290591a 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -40,7 +40,7 @@ \consists "String_number_engraver" \consists "Axis_group_engraver" - minimumVerticalExtent = #'(-5 . 5) + minimumVerticalExtent = #'(-3 . 3) extraVerticalExtent = ##f verticalExtent = ##f localKeySignature = #'() diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index da6c1b9887..8c6e8d1a12 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -1311,6 +1311,7 @@ (Y-extent-callback . ,Axis_group_interface::group_extent_callback) (X-extent-callback . ,Axis_group_interface::group_extent_callback) (stacking-dir . -1) + (threshold . (12 . 1000)) (meta . ((interfaces . (align-interface axis-group-interface spanner-interface)))) )) diff --git a/scm/framework-tex.scm b/scm/framework-tex.scm index 7c535f49de..eeee26df6d 100644 --- a/scm/framework-tex.scm +++ b/scm/framework-tex.scm @@ -172,7 +172,7 @@ (ly:outputter-dump-string putter (string-append "\\leavevmode\n\\lybox{0}{0}{0}{" - (ly:number->string (ly:paper-system-extent line Y)) + (ly:number->string (interval-length (ly:paper-system-extent line Y))) "}{")) (ly:outputter-dump-stencil putter (ly:paper-system-stencil line)) diff --git a/scm/page-layout.scm b/scm/page-layout.scm index 1b2f7db5f0..65f15c78e4 100644 --- a/scm/page-layout.scm +++ b/scm/page-layout.scm @@ -14,7 +14,9 @@ (define-class () (prev #:init-value '() #:accessor node-prev #:init-keyword #:prev) (page #:init-value 0 #:accessor node-page-number #:init-keyword #:pageno) + (force #:init-value 0 #:accessor node-force #:init-keyword #:force) (penalty #:init-value 0 #:accessor node-penalty #:init-keyword #:penalty) + (configuration #:init-value '() #:accessor node-configuration #:init-keyword #:configuration) (lines #:init-value 0 #:accessor node-lines #:init-keyword #:lines)) (define-method (display (node ) port) @@ -118,13 +120,13 @@ )) -(define-public (default-page-make-stencil lines paper scopes number last? ) +(define-public (default-page-make-stencil + lines offsets paper scopes number last? ) "Construct a stencil representing the page from LINES. " (let* ((topmargin (ly:output-def-lookup paper 'topmargin)) ;; TODO: naming vsize/hsize not analogous to TeX. - (vsize (ly:output-def-lookup paper 'vsize)) (hsize (ly:output-def-lookup paper 'hsize)) @@ -143,44 +145,25 @@ (foot (page-headfoot paper scopes number 'make-footer 'footsep DOWN last?)) (line-stencils (map ly:paper-system-stencil lines)) (height-proc (ly:output-def-lookup paper 'page-music-height)) - (music-height (height-proc paper scopes number last?)) - (ragged (ly:output-def-lookup paper 'raggedbottom)) - (ragged-last (ly:output-def-lookup paper 'raggedlastbottom)) - (ragged-bottom (or (eq? #t ragged) - (and last? (eq? #t ragged-last)))) - - (spc-left (- music-height - (apply + (map (lambda (x) - (interval-length (ly:stencil-extent x Y))) - line-stencils)))) - (stretchable-lines (remove ly:paper-system-title? (cdr lines))) - (stretch (if (or (null? stretchable-lines) - (> spc-left (/ music-height 2)) - ragged-bottom) - 0.0 - (/ spc-left (length stretchable-lines)))) (page-stencil (ly:make-stencil '() - (cons leftmargin hsize) - (cons (- topmargin) 0))) - (was-title #t)) - - (set! page-stencil (ly:stencil-combine-at-edge - page-stencil Y DOWN head 0. 0.)) - - (for-each - (lambda (l) - (set! page-stencil - (ly:stencil-combine-at-edge - page-stencil Y DOWN (ly:paper-system-stencil l) - (if was-title - 0.0 - stretch) - )) - - (set! was-title (ly:paper-system-title? l))) - lines) - + (cons leftmargin hsize) + (cons (- topmargin) 0))) + (was-title #t) + (add-system (lambda (stencil-position) + (set! page-stencil + (ly:stencil-add + (ly:stencil-translate-axis + (car stencil-position) + (- 0 + (cadr stencil-position) + topmargin) + Y) + page-stencil)))) + ) + + + (map add-system (zip line-stencils offsets)) (if (ly:stencil? foot) (set! page-stencil (ly:stencil-add @@ -188,7 +171,8 @@ (ly:stencil-translate foot (cons 0 - (+ (- bottom-edge) (- (car (ly:stencil-extent foot Y))))) + (+ (- bottom-edge) + (- (car (ly:stencil-extent foot Y))))) )))) (ly:stencil-translate page-stencil (cons leftmargin 0)) @@ -213,33 +197,10 @@ "Return pages as a list starting with 1st page. Each page is a list of lines. " - (define (make-node prev lines page-num penalty) - (make - #:prev prev - #:lines lines - #:pageno page-num - #:penalty penalty)) (define MAXPENALTY 1e9) (define bookpaper (ly:paper-book-book-paper paper-book)) (define scopes (ly:paper-book-scopes paper-book)) - (define (line-height line) - (ly:paper-system-extent line Y)) - - ;; FIXME: may need some tweaking: square, cubic - (define (height-penalty available used) - ;; FIXME, simplistic - (let* ((left (- available used)) - ;; scale-independent - (relative (abs (/ left available)))) - (if (negative? left) - - ;; too full, penalise more - (* 10 (1+ relative) relative) - - ;; Convexity: two half-empty pages is better than 1 completely - ;; empty page - (* (1+ relative) relative)))) (define (page-height page-number last?) (let @@ -248,11 +209,7 @@ of lines. " (if (procedure? p) (p bookpaper scopes page-number last?) 10000))) - - (define (cumulative-height lines) - (apply + (map line-height lines))) - (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." @@ -260,9 +217,114 @@ is what have collected so far, and has ascending page numbers." (get-path (node-prev node) (cons node done)) done)) - (define (combine-penalties user page prev) - (+ prev page user)) - + (define (combine-penalties force user best-paths) + (let* + ((prev-force (if (null? best-paths) + 0.0 + (node-force (car best-paths)))) + (prev-penalty (if (null? best-paths) + 0.0 + (node-penalty (car best-paths)))) + (inter-system-space (ly:output-def-lookup bookpaper 'betweensystemspace)) + (force-equalization-factor 0.3) + (relative-force (/ force inter-system-space)) + (abs-relative-force (abs relative-force)) + ) + + + (+ (* abs-relative-force (+ abs-relative-force 1)) + prev-penalty + (* force-equalization-factor (/ (abs (- prev-force force)) inter-system-space)) + user))) + + (define (space-systems page-height lines ragged?) + (let* + ((inter-system-space + (ly:output-def-lookup bookpaper 'betweensystemspace)) + + (staff-extents + (list->vector + (append (map + ly:paper-system-staff-extents + lines) + (if (= (length lines) 1) + '((0 . 0)) + '())) + )) + (real-extents + (list->vector + (append + (map + (lambda (sys) (ly:paper-system-extent sys Y)) lines) + (if (= (length lines) 1) + '((0 . 0)) + '()) + ))) + (no-systems (vector-length real-extents)) + (topskip (cdr (vector-ref real-extents 0))) + (space-left (- page-height + (apply + (map interval-length (vector->list real-extents))) + + )) + + (space (- page-height + topskip + (- (car (vector-ref real-extents (1- no-systems)))) + )) + + (calc-spring + (lambda (idx) + (let* + ((this-system-ext (vector-ref staff-extents idx)) + (next-system-ext (vector-ref staff-extents (1+ idx))) + (fixed (- (cdr next-system-ext) + (car this-system-ext))) + (ideal (+ inter-system-space fixed)) + (hooke (/ 1 (- ideal fixed))) + ) + (list ideal hooke)) + )) + + (springs (map calc-spring (iota (1- no-systems)))) + (fixed-dist (ly:output-def-lookup bookpaper 'betweensystempadding)) + (calc-rod + (lambda (idx) + (let* + ((this-system-ext (vector-ref real-extents idx)) + (next-system-ext (vector-ref real-extents (1+ idx))) + (distance (- (+ (car this-system-ext) + fixed-dist) + (cdr next-system-ext) + )) + (entry (list idx (1+ idx) distance))) + entry))) + (rods (map calc-rod (iota (1- no-systems)))) + (page-very-empty (> space-left (/ page-height 3))) + (result (ly:solve-spring-rod-problem + springs rods space + ragged?)) + (force (car result)) + (positions + (map (lambda (y) (+ y topskip) y) + (cdr result))) + ) + + (if #f ;; debug. + (begin + (display (list "\n# systems: " no-systems + "\nreal-ext" real-extents "\nstaff-ext" staff-extents + "\ninterscore" inter-system-space + "\nspace-letf" space-left + "\npage empty" page-very-empty + "\nspring,rod" springs rods + "\ntopskip etc" topskip space + "\npage-height" page-height + "\nragged" ragged? + "\nforce" force + "\npositions" positions "\n")))) + + (cons force positions))) + (define (walk-paths done-lines best-paths current-lines last? current-best) "Return the best optimal-page-break-node that contains CURRENT-LINES. DONE-LINES.reversed ++ CURRENT-LINES is a consecutive @@ -270,46 +332,68 @@ ascending range of lines, and BEST-PATHS contains the optimal breaks 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 bookpaper 'firstpagenumber) (1+ (node-page-number (car best-paths))))) - (prev-penalty (if (null? best-paths) - 0.0 - (node-penalty (car best-paths)))) + + + (ragged? (or (eq? #t (ly:output-def-lookup bookpaper 'raggedbottom)) + (and (eq? #t (ly:output-def-lookup bookpaper 'raggedlastbottom)) + last?))) (page-height (page-height this-page-num last?)) - (space-used (cumulative-height current-lines)) - (this-page-penalty (height-penalty page-height space-used)) + + (vertical-spacing (space-systems page-height current-lines ragged?)) + (satisfied-constraints (car vertical-spacing)) + (force (if satisfied-constraints satisfied-constraints 10000)) + (positions (cdr vertical-spacing)) (user-penalty (ly:paper-system-break-penalty (car current-lines))) (total-penalty (combine-penalties - user-penalty this-page-penalty prev-penalty)) + force user-penalty + best-paths)) + + (better? (or (not current-best) (< total-penalty (node-penalty current-best)))) (new-best (if better? - (make-node (if (null? best-paths) + (make + #:prev (if (null? best-paths) #f (car best-paths)) - current-lines - this-page-num total-penalty) + #:lines current-lines + #:pageno this-page-num + #:force force + #:configuration positions + #:penalty total-penalty) current-best))) - (if #f ;; debug + (if #t ;; debug (display (list - "user pen " user-penalty " prev-penalty " - prev-penalty "\n" - "better? " better? " total-penalty " total-penalty "\n" - "height " page-height " spc used: " space-used "\n" - "pen " this-page-penalty " lines: " current-lines "\n"))) + "\nuser pen " user-penalty + "\nsatisfied-constraints" satisfied-constraints + "\nlast? " last? "ragged?" ragged? + "\nbetter? " better? " total-penalty " total-penalty "\n" + "\nconfig " positions + "\nforce " force + "\nlines: " current-lines "\n"))) + + (if #f ; debug + (display (list "\nnew-best is " (node-lines new-best) + "\ncontinuation of " + (if (null? best-paths) + "start" + (node-lines (car best-paths)))))) (if (and (pair? done-lines) ;; if this page is too full, adding another line won't help - (< this-page-penalty MAXPENALTY)) + satisfied-constraints) (walk-paths (cdr done-lines) (cdr best-paths) (cons (car done-lines) current-lines) last? new-best) - new-best))) + + new-best))) (define (walk-lines done best-paths todo) "Return the best page breaking as a single @@ -321,7 +405,8 @@ DONE." (let* ((this-line (car todo)) (last? (null? (cdr todo))) (next (walk-paths done best-paths (list this-line) last? #f))) - + +; (display "\n***************") (walk-lines (cons this-line done) (cons next best-paths) (cdr todo))))) @@ -332,10 +417,13 @@ DONE." (let* ((best-break-node (walk-lines '() '() lines)) (break-nodes (get-path best-break-node '()))) - (if (ly:get-option 'verbose) + (if #f; (ly:get-option 'verbose) (begin - (format (current-error-port) "breaks: ~S\n" (map line-number break-nodes)) - (force-output (current-error-port)))) + (display (list + "\nbreaks: " (map line-number break-nodes)) + "\nsystems " (map node-lines break-nodes) + "\npenalties " (map node-penalty break-nodes) + "\nconfigs " (map node-configuration break-nodes)))) ; create stencils. @@ -343,6 +431,7 @@ DONE." (map (lambda (node) ((ly:output-def-lookup bookpaper 'page-make-stencil) (node-lines node) + (node-configuration node) bookpaper scopes (node-page-number node) diff --git a/scm/paper.scm b/scm/paper.scm index d430c36a32..599eb51a95 100644 --- a/scm/paper.scm +++ b/scm/paper.scm @@ -39,6 +39,7 @@ (module-define! m 'dimension-variables '(pt mm cm in staffheight staff-space + betweensystemspace betweensystempadding linewidth indent hsize vsize staffspace linethickness ledgerlinethickness blotdiameter interscoreline leftmargin rightmargin)) -- 2.39.2