From: Han-Wen Nienhuys Date: Tue, 27 Sep 2005 11:33:28 +0000 (+0000) Subject: * lily/include/paper-system.hh (class Paper_system): remove X-Git-Tag: release/2.7.11~12 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=4700a805e1627eb33cc38d7d3fa20e9d96ffe70f;p=lilypond.git * lily/include/paper-system.hh (class Paper_system): remove staff_extents_ member. * lily/paper-system-scheme.cc (LY_DEFINE): remove. * lily/include/paper-system.hh (class Paper_system): remove number_ variable. Remove is_title_. Remove break_before_penalty_ * lily/paper-system-scheme.cc: remove ly:paper-system-break-before-penalty remove ly:paper-system-number. * scm/lily-library.scm (paper-system-title?): new function. * scm/paper.scm (set-paper-dimension-variables): add pagetopspace * scm/page-layout.scm (ly:optimal-page-breaks): read next-space and next-padding. (optimal-page-breaks): rename from ly:optimal-page-breaks. * lily/paper-system-scheme.cc (LY_DEFINE): new function. * lily/paper-system.cc (internal_get_property): new function. * scm/page-layout.scm (ly:optimal-page-breaks): add support for pagetopspace * input/regression/page-spacing.ly: new file. * lily/paper-system.cc (read_left_bound): new function. Read line-break-system-details from left bound to determine extents. --- diff --git a/ChangeLog b/ChangeLog index da4975e517..8a327aa9a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2005-09-27 Han-Wen Nienhuys + * lily/include/paper-system.hh (class Paper_system): remove + staff_extents_ member. + + * lily/paper-system-scheme.cc (LY_DEFINE): remove. + * lily/include/paper-system.hh (class Paper_system): remove number_ variable. Remove is_title_. Remove break_before_penalty_ diff --git a/VERSION b/VERSION index ce8dc973f6..d5ecc913e8 100644 --- a/VERSION +++ b/VERSION @@ -1,6 +1,6 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=2 MINOR_VERSION=7 -PATCH_LEVEL=10 +PATCH_LEVEL=11 MY_PATCH_LEVEL= diff --git a/input/regression/page-spacing.ly b/input/regression/page-spacing.ly index 928659a643..015ad62285 100644 --- a/input/regression/page-spacing.ly +++ b/input/regression/page-spacing.ly @@ -18,34 +18,46 @@ used for global overrides. \book { \score { - \relative c'' \new StaffGroup << + \relative c'' \new PianoStaff << \new Voice { - c1\break + c1_"followed by default spacing"\break + c\break \outputProperty #"Score.NonMusicalPaperColumn" #'line-break-system-details #'((Y-extent . (-30 . 10))) - c^"This system has big extents (property Y-extent)"\break + c_"Big bounding box (property Y-extent)"\break - c\break \outputProperty #"Score.NonMusicalPaperColumn" #'line-break-system-details - #'((next-padding . 20)) + #'((refpoint-Y-extent . (-37 . -10))) + c_\markup { + \column { + "Refpoints further apart (property refpoint-Y-extent)." + "Stretchable space runs between refpoints" + } + } + + \break + + \outputProperty + #"Score.NonMusicalPaperColumn" + #'line-break-system-details + #'((next-padding . 10)) - c^"This system is followed by padding, ie unstretchable space. (property next-padding)" \break + c_"Followed by padding, ie unstretchable space. (property next-padding)" \break \outputProperty #"Score.NonMusicalPaperColumn" #'line-break-system-details #'((next-space . 20)) - c^"This system is followed by stretchable space (property next-space)"\break - c\break + c_"Followed by stretchable space (property next-space)"\break c\break \outputProperty #"Score.NonMusicalPaperColumn" #'line-break-system-details #'((bottom-space . 25.0)) - c^"This system has 25 staff space to the bottom of the page. (property bottom-space)"\break + c_"25 staff space to the bottom of the page. (property bottom-space)"\break } @@ -55,5 +67,11 @@ used for global overrides. \paper { raggedlastbottom = ##f betweensystemspace = 1.0 + #(set! text-font-defaults + (acons + 'font-size 6 + text-font-defaults) + + ) } } diff --git a/lily/beam.cc b/lily/beam.cc index 95e5c4fefc..d0fc280075 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -778,7 +778,7 @@ set_minimum_dy (Grob *me, Real *dy) Real hang = 1.0 - (thickness - slt) / 2; *dy = sign (*dy) * max (fabs (*dy), - min (min (sit, inter), hang)); + min (min (sit, inter), hang)); } } diff --git a/lily/include/paper-system.hh b/lily/include/paper-system.hh index e35077b9cb..7cf6285ed5 100644 --- a/lily/include/paper-system.hh +++ b/lily/include/paper-system.hh @@ -26,7 +26,6 @@ class Paper_system void init_vars (); public: - Interval staff_refpoints_; Paper_system (Stencil, SCM); Stencil to_stencil () const; @@ -35,7 +34,6 @@ public: void internal_set_property (SCM sym, SCM val); bool is_title () const; Real break_before_penalty () const; - Interval staff_refpoints () const; }; DECLARE_UNSMOB (Paper_system, paper_system); diff --git a/lily/paper-system-scheme.cc b/lily/paper-system-scheme.cc index 8f89313e5b..9d887213c0 100644 --- a/lily/paper-system-scheme.cc +++ b/lily/paper-system-scheme.cc @@ -28,15 +28,6 @@ LY_DEFINE (ly_paper_system_stencil, "ly:paper-system-stencil", return ps->to_stencil ().smobbed_copy (); } -LY_DEFINE (ly_paper_system_staff_extent, "ly:paper-system-staff-extents", - 1, 0, 0, (SCM system), - "Return the top and bottom staff refpoint.") -{ - Paper_system *ps = unsmob_paper_system (system); - SCM_ASSERT_TYPE (ps, system, SCM_ARG1, __FUNCTION__, "paper-system"); - return ly_interval2scm (ps->staff_refpoints ()); -} - LY_DEFINE (ly_paper_system_property, "ly:paper-system-property", diff --git a/lily/paper-system.cc b/lily/paper-system.cc index a7e95227d0..0d206a0aae 100644 --- a/lily/paper-system.cc +++ b/lily/paper-system.cc @@ -21,7 +21,6 @@ Paper_system::Paper_system (Stencil s, SCM immutable_init) immutable_property_alist_ = immutable_init; smobify_self (); stencil_ = s; - staff_refpoints_ = Interval (0, 0); init_vars (); } @@ -45,8 +44,9 @@ Paper_system::print_smob (SCM smob, SCM port, scm_print_state*) scm_puts ("#<", port); scm_puts (classname (p), port); scm_display (p->mutable_property_alist_, port); + scm_display (p->immutable_property_alist_, port); - scm_puts (" >", port); + scm_puts (" >\n", port); return 1; } @@ -61,22 +61,14 @@ void Paper_system::init_vars () { SCM yext = get_property ("Y-extent"); - SCM staff_ext = get_property ("refpoint-Y-extent"); - if (scm_is_pair (yext) - && is_number_pair (scm_cdr (yext))) + if (is_number_pair (yext)) { Box b = stencil_.extent_box(); - b[Y_AXIS] = ly_scm2interval (scm_cdr (yext)); + b[Y_AXIS] = ly_scm2interval (yext); stencil_ = Stencil (b, stencil_.expr ()); } - - if (scm_is_pair (staff_ext) - && is_number_pair (scm_cdr (staff_ext))) - { - staff_refpoints_ = ly_scm2interval (scm_cdr (staff_ext)); - } } SCM @@ -100,12 +92,3 @@ Paper_system::internal_set_property (SCM sym, SCM val) { mutable_property_alist_ = scm_assq_set_x (mutable_property_alist_, sym, val); } - -/* - todo: move to Paper_system property. - */ -Interval -Paper_system::staff_refpoints () const -{ - return staff_refpoints_; -} diff --git a/lily/system.cc b/lily/system.cc index 1ede4824c5..4795e63c0a 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -374,24 +374,28 @@ System::get_paper_system () scm_cons (ly_symbol2scm ("combine-stencil"), exprs)); - Interval staff_refpoints; - staff_refpoints.set_empty (); - extract_grob_set (this, "spaceable-staves", staves); - for (int i = staves.size (); i--;) - { - Grob *g = staves[i]; - staff_refpoints.add_point (g->relative_coordinate (this, Y_AXIS)); - } + Grob *left_bound = this->get_bound (LEFT); SCM prop_init = left_bound->get_property ("line-break-system-details"); Paper_system *pl = new Paper_system (sys_stencil, prop_init); - - pl->staff_refpoints_ = staff_refpoints; pl->set_property ("penalty", left_bound->get_property ("page-penalty")); + if (!scm_is_pair (pl->get_property ("refpoint-Y-extent"))) + { + Interval staff_refpoints; + staff_refpoints.set_empty (); + extract_grob_set (this, "spaceable-staves", staves); + for (int i = staves.size (); i--;) + { + Grob *g = staves[i]; + staff_refpoints.add_point (g->relative_coordinate (this, Y_AXIS)); + } + pl->set_property ("refpoint-Y-extent", ly_interval2scm (staff_refpoints)); + } + return pl->unprotect (); } diff --git a/scm/font.scm b/scm/font.scm index 2dd29cc9d4..d72a8d23a1 100644 --- a/scm/font.scm +++ b/scm/font.scm @@ -34,9 +34,11 @@ (define-method (display (leaf ) port) (map (lambda (x) (display x port)) (list - "Font-size-family: \n" + "#" + ))) (define-method (display (node ) port) @@ -66,6 +68,7 @@ (define-method (add-font (node ) fprops size-family) (define (assoc-delete key alist) (assoc-remove! (list-copy alist) key)) + (define (make-node fprops size-family) (if (null? fprops) (make-font-tree-leaf (car size-family) (cdr size-family)) diff --git a/scm/page-layout.scm b/scm/page-layout.scm index 3272a2ff3f..172b5f4ff7 100644 --- a/scm/page-layout.scm +++ b/scm/page-layout.scm @@ -32,6 +32,8 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(define-public (paper-system-staff-extents ps) + (ly:paper-system-property ps 'refpoint-Y-extent '(0 . 0))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -143,9 +145,9 @@ create offsets. (add-to-page system-separator-stencil (average (- last-y - (car (ly:paper-system-staff-extents last-system))) + (car (paper-system-staff-extents last-system))) (- y - (cdr (ly:paper-system-staff-extents system)))))) + (cdr (paper-system-staff-extents system)))))) (set! last-system system) (set! last-y y))))) @@ -244,11 +246,11 @@ is what have collected so far, and has ascending page numbers." '())))) (staff-extents (list->vector - (append (map ly:paper-system-staff-extents lines) + (append (map paper-system-staff-extents lines) (if (= (length lines) 1) '((0 . 0)) '())))) - + (real-extents (list->vector (append @@ -347,8 +349,8 @@ is what have collected so far, and has ascending page numbers." (begin (display (list "\n# systems: " system-count "\nreal-ext" real-extents "\nstaff-ext" staff-extents - "\ninterscore" inter-system-space - "\nspace-letf" space-left + "\ninterscore" global-inter-system-space + "\nspace-left" space-left "\nspring,rod" springs rods "\ntopskip " topskip " space " space @@ -398,11 +400,11 @@ CURRENT-BEST is the best result sofar, or #f." (+ (max (get-break-penalty (car current-lines)) 0.0) user-nobreak-penalties)) + (total-penalty (combine-penalties force user-penalty best-paths)) - (better? (or (not current-best) (< total-penalty (node-penalty current-best)))) @@ -450,6 +452,7 @@ CURRENT-BEST is the best result sofar, or #f." for optimally breaking TODO ++ DONE.reversed. BEST-PATHS is a list of break nodes corresponding to DONE." + (if (null? todo) (car best-paths) (let* ((this-line (car todo)) @@ -468,6 +471,8 @@ DONE." (set! force-equalization-factor (ly:output-def-lookup paper 'verticalequalizationfactor 0.3)) + (display lines) + (let* ((best-break-node (walk-lines '() '() lines)) (break-nodes (get-path best-break-node '())) (last-node (car (last-pair break-nodes)))) diff --git a/scm/paper.scm b/scm/paper.scm index 2b3512b04f..2b4d2d1a5d 100644 --- a/scm/paper.scm +++ b/scm/paper.scm @@ -40,7 +40,7 @@ (if tex-backend? (make-cmr-tree (/ sz (* 20 pt))) (make-century-schoolbook-tree - (/ sz (* 20 pt))))) + (/ sz (* 20 pt))))) (module-define! m 'staffheight sz) (module-define! m 'staff-space ss) (module-define! m 'staffspace ss)