From: Han-Wen Nienhuys Date: Wed, 9 Mar 2005 16:03:16 +0000 (+0000) Subject: * lily/stem.cc (print): only produce stemlets if there are no X-Git-Tag: release/2.5.15~27 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=9a7dfb0f5156e52dd4c4ad158abad29f165220e9;p=lilypond.git * lily/stem.cc (print): only produce stemlets if there are no noteheads on this stem. * lily/note-spacing.cc (stem_dir_correction): robustness fix: don't crash on stemlet (visible stem without heads). * scm/define-grobs.scm (all-grob-descriptions): junk LeftEdge for unbroken situations. * scm/output-lib.scm (center-invisible): new function. * lily/spacing-loose-columns.cc (set_loose_columns): use spacing wishes to determine loose column space. --- diff --git a/ChangeLog b/ChangeLog index 64a0b363e1..049910bdc5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2005-03-09 Han-Wen Nienhuys + * lily/stem.cc (print): only produce stemlets if there are no + noteheads on this stem. + + * lily/note-spacing.cc (stem_dir_correction): robustness fix: + don't crash on stemlet (visible stem without heads). + + * scm/define-grobs.scm (all-grob-descriptions): junk LeftEdge for + unbroken situations. + + * scm/output-lib.scm (center-invisible): new function. + + * lily/spacing-loose-columns.cc (set_loose_columns): use spacing + wishes to determine loose column space. + * lily/font-config.cc (init_fontconfig): add fonts/{otf,type1,cff} to path. diff --git a/input/mutopia/F.Schubert/morgenlied.ly b/input/mutopia/F.Schubert/morgenlied.ly index 58d36fe65b..ff3416f0f8 100644 --- a/input/mutopia/F.Schubert/morgenlied.ly +++ b/input/mutopia/F.Schubert/morgenlied.ly @@ -172,6 +172,7 @@ pianoLH = \relative c'' \repeat volta 2 { \context { \Lyrics minimumVerticalExtent = #'(-0.5 . 2.5) + \override LyricText #'font-size = #-1 } \context { \Score diff --git a/input/regression/stem-stemlet.ly b/input/regression/stem-stemlet.ly index 72c7433603..4c49a8dfc9 100644 --- a/input/regression/stem-stemlet.ly +++ b/input/regression/stem-stemlet.ly @@ -11,4 +11,5 @@ length can be set with @code{stemlet-length}." \relative { \override Stem #'stemlet-length = #0.75 c8[ r8 c16 r16 c8] + c4 } diff --git a/lily/include/system.hh b/lily/include/system.hh index bf30fa2376..d8aa5a087f 100644 --- a/lily/include/system.hh +++ b/lily/include/system.hh @@ -47,5 +47,7 @@ public: protected: }; + +void set_loose_columns (System* which, Column_x_positions const *posns); #endif /* SYSTEM_HH */ diff --git a/lily/note-spacing.cc b/lily/note-spacing.cc index 9f698361ab..f8924576e2 100644 --- a/lily/note-spacing.cc +++ b/lily/note-spacing.cc @@ -318,11 +318,14 @@ Note_spacing::stem_dir_correction (Grob*me, Item * rcolumn, } Interval hp = Stem::head_positions (stem); - Real chord_start = hp[sd]; - Real stem_end = Stem::stem_end_position (stem); + if (!hp.is_empty()) + { + Real chord_start = hp[sd]; + Real stem_end = Stem::stem_end_position (stem); - stem_posns[d] = Interval (chord_start? stem_end); - head_posns[d].unite (hp); + stem_posns[d] = Interval (chord_start ? stem_end); + head_posns[d].unite (hp); + } } } while (flip (&d) != LEFT); diff --git a/lily/spacing-loose-columns.cc b/lily/spacing-loose-columns.cc new file mode 100644 index 0000000000..329a77a7dd --- /dev/null +++ b/lily/spacing-loose-columns.cc @@ -0,0 +1,112 @@ +/* + spacing-loose-columns.cc -- implement loose column spacing. + + source file of the GNU LilyPond music typesetter + + (c) 2005 Han-Wen Nienhuys + +*/ + +#include "system.hh" +#include "paper-column.hh" +#include "column-x-positions.hh" +#include "staff-spacing.hh" + + +/* Find the loose columns in POSNS, and drape them around the columns + specified in BETWEEN-COLS. */ +void +set_loose_columns (System* which, Column_x_positions const *posns) +{ + int loose_col_count = posns->loose_cols_.size (); + for (int i = 0; i < loose_col_count; i++) + { + int divide_over = 1; + Item *loose = dynamic_cast (posns->loose_cols_[i]); + Paper_column* col = dynamic_cast (loose); + + if (col->system_) + continue; + + Item *left = 0; + Item *right = 0; + while (1) + { + SCM between = loose->get_property ("between-cols"); + if (!scm_is_pair (between)) + break; + + Item *le = dynamic_cast (unsmob_grob (scm_car (between))); + Item *re = dynamic_cast (unsmob_grob (scm_cdr (between))); + + if (!(le && re)) + break; + + if (!left && le) + { + left = le->get_column (); + if (!left->get_system ()) + left = left->find_prebroken_piece (RIGHT); + } + + divide_over++; + loose = right = re->get_column (); + } + + if (!right->get_system ()) + right = right->find_prebroken_piece (LEFT); + + Grob *common = right->common_refpoint (left, X_AXIS); + + int count = 0; + Real total_space = 0.0; + Real total_fixed = 0.0; + for (SCM wish = col->get_property ("spacing-wishes"); scm_is_pair (wish); wish = scm_cdr (wish)) + { + Grob *spacing = unsmob_grob (scm_car (wish)); + if (Staff_spacing::has_interface (spacing)) + { + Real space = 0.0; + Real fixed = 0.0; + Staff_spacing::get_spacing_params (spacing, &space, &fixed); + + total_fixed += fixed; + total_space += space; + count ++; + } + } + + Real right_point = 0.0; + Real distance_to_next = 0.0; + if (count) + { + total_space /= count; + total_fixed /= count; + + distance_to_next = total_space; + right_point = right->relative_coordinate (common, X_AXIS); + } + else + { + Interval my_extent = col->extent (col, X_AXIS); + distance_to_next = my_extent[RIGHT] + 1.0; + right_point = right->extent (common, X_AXIS)[LEFT]; + } +#if 0 + Real left_point = left->extent (common, X_AXIS)[RIGHT]; + + Real space_left = ((right_point - left_point) >? 0.0) + - (my_extent.is_empty() ? 0.0 : my_extent.length ()); + + Real padding = (space_left / 2) system_ = which; + col->translate_axis (my_offset - col->relative_coordinate (common, X_AXIS), X_AXIS); + } +} + diff --git a/lily/staff-spacing.cc b/lily/staff-spacing.cc index 75e6fbedd3..623e271766 100644 --- a/lily/staff-spacing.cc +++ b/lily/staff-spacing.cc @@ -180,7 +180,7 @@ Staff_spacing::get_spacing_params (Grob *me, Real * space, Real * fixed) */ /* - we used to have a warning here, but itgenerates a lot of + we used to have a warning here, but it generates a lot of spurious error messages. */ return ; diff --git a/lily/stem.cc b/lily/stem.cc index f3ed966975..07fe670290 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -647,13 +647,13 @@ Stem::print (SCM smob) Grob *lh = to_boolean (me->get_property ("avoid-note-head")) ? last_head (me) - : lh = first_head (me); + : first_head (me); Grob *beam = get_beam (me); if (!lh && !stemlet) return SCM_EOL; - if (stemlet && !beam) + if (!lh && stemlet && !beam) return SCM_EOL; if (is_invisible (me)) diff --git a/lily/system.cc b/lily/system.cc index 2cb82cb99f..8f1e907f4e 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -165,71 +165,6 @@ System::get_lines () return lines; } -/* Find the loose columns in POSNS, and drape them around the columns - specified in BETWEEN-COLS. */ -static void -set_loose_columns (System* which, Column_x_positions const *posns) -{ - int loose_col_count = posns->loose_cols_.size (); - for (int i = 0; i < loose_col_count; i++) - { - int divide_over = 1; - Item *loose = dynamic_cast (posns->loose_cols_[i]); - Paper_column* col = dynamic_cast (loose); - - if (col->system_) - continue; - - Item *left = 0; - Item *right = 0; - while (1) - { - SCM between = loose->get_property ("between-cols"); - if (!scm_is_pair (between)) - break; - - Item *le = dynamic_cast (unsmob_grob (scm_car (between))); - Item *re = dynamic_cast (unsmob_grob (scm_cdr (between))); - - if (!(le && re)) - break; - - if (!left && le) - { - left = le->get_column (); - if (!left->get_system ()) - left = left->find_prebroken_piece (RIGHT); - } - - divide_over++; - loose = right = re->get_column (); - } - - if (!right->get_system ()) - right = right->find_prebroken_piece (LEFT); - - /* Divide the remaining space of the column over the left and - right side. At the moment, FIXME */ - Grob *common = right->common_refpoint (left, X_AXIS); - - Real right_point = right->extent (common, X_AXIS)[LEFT]; - Real left_point = left->extent (common, X_AXIS)[RIGHT]; - Interval my_extent = col->extent (col, X_AXIS); - - Real space_left = (right_point - left_point) - - (my_extent.is_empty() ? 0.0 : my_extent.length ()); - - Real padding = (space_left / 2) system_ = which; - col->translate_axis (my_offset - col->relative_coordinate (common, X_AXIS), X_AXIS); - } -} - void System::break_into_pieces (Array const &breaking) { diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index e2650a1889..7973045b7b 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -386,12 +386,14 @@ )) (DynamicTextSpanner . ((print-function . ,Dynamic_text_spanner::print) - (font-series . bold) + +;; rather ugh with NCSB +; (font-series . bold) (font-shape . italic) (style . dashed-line) ; need to blend with dynamic texts. - (font-size . 2) + (font-size . 1) (bound-padding . 0.75) (dash-fraction . 0.2) (dash-period . 3.0) @@ -419,6 +421,7 @@ (break-align-symbol . left-edge) (X-extent . (0 . 0)) (breakable . #t) + (break-visibility . ,center-invisible) (space-alist . ( (custos . (extra-space . 0.0)) (ambitus . (extra-space . 2.0)) diff --git a/scm/output-lib.scm b/scm/output-lib.scm index dd4fe7b955..6180d86454 100644 --- a/scm/output-lib.scm +++ b/scm/output-lib.scm @@ -223,6 +223,7 @@ centered, X==1 is at the right, X == -1 is at the left." (define-safe-public (all-visible d) '(#f . #f)) (define-safe-public (all-invisible d) '(#t . #t)) (define-safe-public (begin-of-line-invisible d) (if (= d 1) '(#t . #t) '(#f . #f))) +(define-safe-public (center-invisible d) (if (= d 0) '(#t . #t) '(#f . #f))) (define-safe-public (end-of-line-invisible d) (if (= d -1) '(#t . #t) '(#f . #f)))