From 87bf11c367d9c8c91cbd3d148572103200ca6ba8 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 6 Jan 2004 00:52:26 +0000 Subject: [PATCH] * lily/tie.cc: change 'heads to 'head-pair. * lily/lyric-phrasing-engraver.cc (process_acknowledged_grobs): fill in 'heads field. * lily/lyric-extender.cc (brew_molecule): use heads for width, use minimum-length for short ones, and shorten so collisions with the next syllable are avoided. * lily/beam-quanting.cc (score_slopes_dy): add extra points for near-zero slopes. Only do DAMPING_DIRECTION_PENALTY for non-horizontal dy * lily/dots.cc: remove quantized_position callback. All Y positioning is done by dot-column.cc * lily/dot-column.cc (do_shifts): rewrite shifting routine: do exhaustive test of all dot positions. This fixes disappearing dots in dotted chords. --- input/mutopia/F.Schubert/morgenlied.ly | 6 +++--- lily/beam-quanting.cc | 9 ++++++--- lily/lyric-extender.cc | 15 ++++++++------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/input/mutopia/F.Schubert/morgenlied.ly b/input/mutopia/F.Schubert/morgenlied.ly index f220dbed2c..012c8c3cc9 100644 --- a/input/mutopia/F.Schubert/morgenlied.ly +++ b/input/mutopia/F.Schubert/morgenlied.ly @@ -60,7 +60,7 @@ melody = \notes \relative c'' \repeat volta 2 \context Voice = singer { g4.~ g8-\fermata g8 g | as4 as8 g4 g8 | fis4 fis8 r8 g g | - a4 a8 g4 g8 | + a!4 a8 g4 g8 | fis4 fis8 d'16[ c b a] g[ f] | e4 g8 d4 g8 e4 r8 b'16[ c d b] g[ f] | e4 g8 d4 a'16[ g] | @@ -111,7 +111,7 @@ pianoRH = \notes \relative c''' \repeat volta 2 { } pianoLH = \notes \relative c'' \repeat volta 2 { - + \modernAccidentals g16( fis a g fis g f e d c b a) | \clef bass g4.( c,8) r r \clef treble r4 8([ )] r | @@ -148,7 +148,7 @@ pianoLH = \notes \relative c'' \repeat volta 2 { \new PianoStaff << \property PianoStaff.instrument = \markup { \bold - \bigger\bigger \huge "2. " } + \bigger\bigger\bigger\bigger \huge "2. " } \new Staff \pianoRH \new Staff \pianoLH >> diff --git a/lily/beam-quanting.cc b/lily/beam-quanting.cc index 5dee786850..550a0a877c 100644 --- a/lily/beam-quanting.cc +++ b/lily/beam-quanting.cc @@ -31,6 +31,7 @@ const int DAMPING_DIRECTION_PENALTY = 800; const int MUSICAL_DIRECTION_FACTOR = 400; const int IDEAL_SLOPE_FACTOR = 10; +const Real ROUND_TO_ZERO_SLOPE = 0.05; const int ROUND_TO_ZERO_POINTS = 4; extern bool debug_beam_quanting_flag; @@ -361,14 +362,16 @@ Beam::score_slopes_dy (Real yl, Real yr, bool xstaff) { Real dy = yr - yl; - Real dem = 0.0; /* DAMPING_DIRECTION_PENALTY is a very harsh measure, while for complex beaming patterns, horizontal is often a good choice. + + TODO: find a way to incorporate the complexity of the beam in this + penalty. */ - if (sign (dy) + if (fabs (dy/dx) > ROUND_TO_ZERO_SLOPE && sign (dy_damp) != sign (dy)) { dem += DAMPING_DIRECTION_PENALTY; @@ -392,7 +395,7 @@ Beam::score_slopes_dy (Real yl, Real yr, almost zero slopes look like errors in horizontal beams. */ if (fabs (dy) > 1e-3 - && (dy / dx < 0.05)) + && fabs (dy / dx) < ROUND_TO_ZERO_SLOPE) dem += ROUND_TO_ZERO_POINTS; return dem; diff --git a/lily/lyric-extender.cc b/lily/lyric-extender.cc index 52ef6cedcf..4a6a54d5c5 100644 --- a/lily/lyric-extender.cc +++ b/lily/lyric-extender.cc @@ -33,11 +33,13 @@ Lyric_extender::brew_molecule (SCM smob) Link_array heads (Pointer_group_interface__extract_grobs (me, (Grob*)0, "heads")); + if (!heads.size ()) + return SCM_EOL; + common = common_refpoint_of_array (heads, common, X_AXIS); Real left_point = 0.0; - if (!heads.size() - || l->internal_has_interface (ly_symbol2scm ("lyric-syllable-interface"))) + if (l->internal_has_interface (ly_symbol2scm ("lyric-syllable-interface"))) left_point = l->extent (common, X_AXIS)[RIGHT]; else left_point = heads[0]->extent (common, X_AXIS)[LEFT]; @@ -57,18 +59,17 @@ Lyric_extender::brew_molecule (SCM smob) Real right_point = left_point + (gh_number_p (minlen) ? gh_scm2double (minlen) : 0.0); - if (heads.size ()) - right_point = right_point >? heads.top ()->extent (common, X_AXIS)[RIGHT]; + right_point = right_point >? heads.top ()->extent (common, X_AXIS)[RIGHT]; Real h = sl * gh_scm2double (me->get_grob_property ("thickness")); - - right_point = right_point extent (common, X_AXIS)[LEFT] - h); + Real pad = 2* h; + right_point = right_point extent (common, X_AXIS)[LEFT] - pad); if (isinf (right_point)) return SCM_EOL; - right_point += h; + right_point += pad; Real w = right_point - left_point; -- 2.39.2