From: Han-Wen Nienhuys Date: Tue, 13 Jan 2004 12:48:57 +0000 (+0000) Subject: * lily/side-position-interface.cc (out_of_staff): also do X-Git-Tag: release/2.1.23~250 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=d77933148612eca5821af90e30803793d2e3daed;hp=b9fc4bb5b3ce7d75e7e5284352eeaa04bbe78e14;p=lilypond.git * lily/side-position-interface.cc (out_of_staff): also do out_of_staff() correctly for d == DOWN. * lily/text-spanner.cc (brew_molecule): only put vertical line and horizontal line if they move to the right. * scm/define-grobs.scm (all-grob-descriptions): set text-repeat-if-broken for ottava spanner * lily/text-spanner.cc (brew_molecule): text-repeat-if-broken property. --- diff --git a/ChangeLog b/ChangeLog index 16a36943d2..72eadf0cc4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2004-01-13 Han-Wen Nienhuys + * lily/side-position-interface.cc (out_of_staff): also do + out_of_staff() correctly for d == DOWN. + + * lily/text-spanner.cc (brew_molecule): only put vertical line and + horizontal line if they move to the right. + + * scm/define-grobs.scm (all-grob-descriptions): set + text-repeat-if-broken for ottava spanner + + * lily/text-spanner.cc (brew_molecule): text-repeat-if-broken + property. + * mf/feta18.mf: design size is 18 not 22.5 * lily/new-lyric-combine-music-iterator.cc (process): new file. diff --git a/input/regression/ottava.ly b/input/regression/ottava.ly index a271427c03..06423dbf6e 100644 --- a/input/regression/ottava.ly +++ b/input/regression/ottava.ly @@ -2,7 +2,11 @@ \header { texidoc = "Ottava brackets are supported, through the -use of the scheme function @code{set-octavation}. +use of the scheme function @code{set-octavation}. + +The spanner should go below for 8va bassa, and the string can be tuned +with @code{Staff.ottavation}. + " } @@ -13,17 +17,24 @@ use of the scheme function @code{set-octavation}. \score { \notes\relative c''' \notes { a b c a + #(set-octavation 1) + a b c a + #(set-octavation 0) #(set-octavation 2) - a' b - c a + a b c a #(set-octavation 0) - - a, #(set-octavation 1) b + #(set-octavation -1) + a b c a + #(set-octavation 0) + a, + #(set-octavation 1) + \property Staff.ottavation = #"8" + b #(set-octavation 0) c a #(set-octavation -1) b a g #(set-octavation 0) - c + c } } diff --git a/lily/ottava-engraver.cc b/lily/ottava-engraver.cc index 2afa0c321a..3426052280 100644 --- a/lily/ottava-engraver.cc +++ b/lily/ottava-engraver.cc @@ -52,9 +52,13 @@ Ottava_spanner_engraver::process_music () span_ = new Spanner (get_property ("OttavaSpanner")); span_->set_grob_property ("edge-text", gh_cons (ott, SCM_EOL)); announce_grob (span_, SCM_EOL); + + SCM c0 (get_property ("centralCPosition")); + SCM oc0 (get_property ("originalCentralCPosition")); + if (scm_less_p (oc0, c0) == SCM_BOOL_T) + span_->set_grob_property ("direction", gh_int2scm (DOWN)); } } - last_ottavation_ = ott; } @@ -76,8 +80,6 @@ Ottava_spanner_engraver::typeset_all () { if (finished_) { - Side_position_interface::add_staff_support (finished_); - Direction d = LEFT; do { diff --git a/lily/side-position-interface.cc b/lily/side-position-interface.cc index 40a8e0767f..ea15805b3e 100644 --- a/lily/side-position-interface.cc +++ b/lily/side-position-interface.cc @@ -239,7 +239,7 @@ Side_position_interface::out_of_staff (SCM element_smob, SCM axis) Interval staff_size = st->extent (common, Y_AXIS); Interval me_ext = me->extent (common, a); Real diff = d*staff_size[d] + padding - d*me_ext[-d]; - return gh_double2scm (diff >? 0); + return gh_double2scm (d* (diff >? 0)); } void diff --git a/lily/text-spanner.cc b/lily/text-spanner.cc index b441bdf8c9..61de7fbc34 100644 --- a/lily/text-spanner.cc +++ b/lily/text-spanner.cc @@ -32,6 +32,16 @@ MAKE_SCHEME_CALLBACK (Text_spanner, brew_molecule, 1); /* TODO: this function is too long + + + TODO: the string for ottava shoudl depend on the available space, ie. + + + Long: 15ma Short: 15ma Empty: 15 + 8va 8va 8 + 8va bassa 8ba 8 + + */ SCM Text_spanner::brew_molecule (SCM smob) @@ -80,8 +90,8 @@ Text_spanner::brew_molecule (SCM smob) Direction d = LEFT; do { - /* Don't repeat edge text for broken end */ - if (broken[d]) + if (!to_boolean (me->get_grob_property ("text-repeat-if-broken")) + && broken[d]) continue; SCM text = index_get_cell (edge_text, d); @@ -113,6 +123,7 @@ Text_spanner::brew_molecule (SCM smob) span_points[RIGHT] -= gh_scm2double (ly_cdr (ew)); } + Real thick = paper->get_realvar (ly_symbol2scm ("linethickness")); SCM st = me->get_grob_property ("thickness"); if (gh_number_p (st)) @@ -147,21 +158,31 @@ Text_spanner::brew_molecule (SCM smob) do { Interval ext = edge[d].extent (X_AXIS); - - edge[d].translate_axis (span_points[d], X_AXIS); - m.add_molecule (edge[d]); - edge_line[d].translate_axis (span_points[d], X_AXIS); - m.add_molecule (edge_line[d]); if (!ext.is_empty ()) - span_points[d] += -d * ext[-d]; + { + edge[d].translate_axis (span_points[d], X_AXIS); + m.add_molecule (edge[d]); + span_points[d] += -d * ext[-d]; + } + } + while (flip (&d) != LEFT); + do + { + if (d* span_points[d] > d * edge[-d].extent(X_AXIS)[d]) + { + edge_line[d].translate_axis (span_points[d], X_AXIS); + m.add_molecule (edge_line[d]); + } } while (flip (&d) != LEFT); - Molecule l =Line_spanner::line_molecule (me, thick, - Offset (span_points[LEFT], 0), - Offset (span_points[RIGHT], 0)); - m.add_molecule (l); - + if (!span_points.is_empty ()) + { + Molecule l =Line_spanner::line_molecule (me, thick, + Offset (span_points[LEFT], 0), + Offset (span_points[RIGHT], 0)); + m.add_molecule (l); + } m.translate_axis (- me->relative_coordinate (common, X_AXIS), X_AXIS); return m.smobbed_copy (); } @@ -171,5 +192,5 @@ Text_spanner::brew_molecule (SCM smob) ADD_INTERFACE (Text_spanner,"text-spanner-interface", "generic text spanner", - "dash-period if-text-padding dash-fraction edge-height bracket-flare edge-text shorten-pair style thickness enclose-bounds width-correct"); + "text-repeat-if-broken dash-period if-text-padding dash-fraction edge-height bracket-flare edge-text shorten-pair style thickness enclose-bounds width-correct"); diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index 0fa1c14207..e9d4e2bc77 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -435,6 +435,8 @@ the Nth element of the list gives the amount stem shortening of a note with N fl (grob-property-description 'stems grob-list? "list of stem objects, corresponding to the notes that the arpeggio has to be before.") (grob-property-description 'stropha boolean? "is this neume a stropha?.") (grob-property-description 'style symbol? "a string determining what style of glyph is typeset. Valid choices depend on the function that is reading this property. .") +(grob-property-description 'text-repeat-if-broken boolean? + "Repeat text on broken text-spanner?") (grob-property-description 'text markup? "Text markup. See the notation manual for more information.") (grob-property-description 'thick-thickness number? "thickness, measured in stafflinethickness.") diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 5569834df6..5999f04749 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -1077,9 +1077,13 @@ (OttavaSpanner . ( - (Y-offset-callbacks . (,Side_position_interface::aligned_side)) + (Y-offset-callbacks . (,Side_position_interface::out_of_staff + ,Side_position_interface::aligned_side)) (molecule-callback . ,Text_spanner::brew_molecule) (font-family . roman) + (text-repeat-if-broken . #t) + (shorten-pair . (0.0 . -0.6)) + (staff-padding . 1.0) (enclose-bounds . #t) (width-correct . 0.0) (style . dashed-line) diff --git a/scm/music-functions.scm b/scm/music-functions.scm index 41a725101a..f5ed7b89cd 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -189,6 +189,19 @@ i.e. this is not an override" m )) +(define-public (make-grob-property-override grob gprop val) + + "Make a Music expression that sets GPROP to VAL in GROB. Does a pop first, +i.e. this is not an override" + + (let* ((m (make-music-by-name 'OverrideProperty))) + (ly:set-mus-property! m 'symbol grob) + (ly:set-mus-property! m 'grob-property gprop) + (ly:set-mus-property! m 'grob-value val) + + m + + )) (define-public (make-grob-property-revert grob gprop) @@ -363,9 +376,10 @@ a property set for MultiMeasureRestNumber." (define (ottava-modify context) - "Either reset centralCPosition to the stored original, -or remember old centralCPosition, add OCTAVATION to centralCPosition, -and set OTTAVATION to `8va', or whatever appropriate." + "Either reset centralCPosition to the stored original, or remember +old centralCPosition, add OCTAVATION to centralCPosition, and set +OTTAVATION to `8va', or whatever appropriate." + (if (number? (ly:get-context-property context 'centralCPosition)) (if (= octavation 0)