From bd2052784e68a4804ef9c07ce11efadabf8070e2 Mon Sep 17 00:00:00 2001 From: hanwen Date: Sun, 18 Jul 2004 16:03:12 +0000 Subject: [PATCH] * scm/define-grobs.scm (all-grob-descriptions): set ratio .25. This flattens short slurs. * lily/new-slur.cc (enumerate_attachments): move X of attachment points for tilted slurs. * input/regression/slur-tilt.ly: new file. * lily/new-slur.cc: cleanup, split in functions. * lily/new-slur.cc (score_encompass): variable head-distance penalty. * lily/new-slur.cc (print): use debug-slur-quanting paper var. --- ChangeLog | 11 +++++++++++ flower/include/offset.hh | 2 +- input/regression/slur-tilt.ly | 25 +++++++++++++++++++++++++ lily/new-slur.cc | 33 ++++++++++++++++++++++++++++----- scm/define-grobs.scm | 2 +- 5 files changed, 66 insertions(+), 7 deletions(-) create mode 100644 input/regression/slur-tilt.ly diff --git a/ChangeLog b/ChangeLog index 3a9b8e30c7..bc8ddeaef1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2004-07-18 Han-Wen Nienhuys + * scm/define-grobs.scm (all-grob-descriptions): set ratio + .25. This flattens short slurs. + + * lily/new-slur.cc (enumerate_attachments): move X of attachment + points for tilted slurs. + + * input/regression/slur-tilt.ly: new file. + + * ly/engraver-init.ly (AncientRemoveEmptyStaffContext): shorten + stems of 16th graces too. + * lily/beam-quanting.cc (score_forbidden_quants): make forbidden quant penalty dependent on how much the line is in the gap. diff --git a/flower/include/offset.hh b/flower/include/offset.hh index 3622c7be41..8c57c3de29 100644 --- a/flower/include/offset.hh +++ b/flower/include/offset.hh @@ -97,7 +97,7 @@ public: return *this; } - Real arg () const; + Real arg () const; Real length () const; //wtf, How is Offset a Complex? is this used? diff --git a/input/regression/slur-tilt.ly b/input/regression/slur-tilt.ly new file mode 100644 index 0000000000..51bae0366e --- /dev/null +++ b/input/regression/slur-tilt.ly @@ -0,0 +1,25 @@ +\header { + + texidoc = "The attachment point for strongly sloped slurs is +shifted horizontally slightly. Without this correction, slurs will +point into one note head, and point over another note head." + +} +\paper { + raggedright = ##t +} + +\relative c'' { + \time 2/4 + g8( f) + a( f) + b( f) + c'( f,) + + g16( f) + a( f) + b( f) + c'16( f,) + + +} diff --git a/lily/new-slur.cc b/lily/new-slur.cc index 62f9400398..94cd426417 100644 --- a/lily/new-slur.cc +++ b/lily/new-slur.cc @@ -570,7 +570,7 @@ New_slur::get_base_attachments (Spanner*me, && Staff_symbol_referencer::on_staffline (head, (int) rint (pos)) && Staff_symbol_referencer::line_count (head) -1 >= rint (pos) ) - y += staff_space * dir / 10 ; + y += 1.5 * staff_space * dir / 10 ; // TODO: calc from slur thick & line thick, parameter. Grob * fh = Note_column::first_head (extremes[d].note_column_); x = fh->extent (common[X_AXIS], X_AXIS).linear_combination (CENTER); @@ -591,7 +591,7 @@ New_slur::generate_curves (Grob*me, Array *scores) Real staff_space = Staff_symbol_referencer::staff_space ((Grob*)me); - Real r_0 = robust_scm2double (me->get_property ("ratio"), 1); + Real r_0 = robust_scm2double (me->get_property ("ratio"), 0.33); Real h_inf = staff_space * ly_scm2double (me->get_property ("height-limit")); for (int i = scores->size(); i-- ;) { @@ -625,7 +625,8 @@ New_slur::enumerate_attachments (Grob * me, Grob *common[], { Slur_score s; Direction d = LEFT; - + + Drul_array attach_to_stem (false, false); do { os[d][X_AXIS] = base_attachment[d][X_AXIS]; @@ -638,6 +639,7 @@ New_slur::enumerate_attachments (Grob * me, Grob *common[], { os[d][X_AXIS] = extremes[d].slur_head_extent_[-d] - d * 0.3; + attach_to_stem[d] = true; } else if (dir *extremes[d].stem_extent_[Y_AXIS][dir] < dir * os[d][Y_AXIS]) { @@ -646,16 +648,37 @@ New_slur::enumerate_attachments (Grob * me, Grob *common[], } } while (flip (&d) != LEFT); - Offset dz = os[RIGHT] - os[LEFT]; + + + + Offset dz; + dz = os[RIGHT] - os[LEFT]; if (dz[X_AXIS] < minimum_length || fabs (dz[Y_AXIS] / dz[X_AXIS]) > score_param->MAX_SLOPE ) { do { if (extremes[d].slur_head_) - os[d][X_AXIS] = extremes[d].slur_head_extent_.center (); + { + os[d][X_AXIS] = extremes[d].slur_head_extent_.center (); + attach_to_stem[d] = false; + } } while (flip (&d) != LEFT); } + + dz = os[RIGHT] - os[LEFT]; + do { + if (extremes[d].slur_head_ + && !attach_to_stem[d]) + { + /* + horizontally move tilted slurs a little. Move more + for bigger tilts. + */ + os[d][X_AXIS] -= + dir * extremes[d].slur_head_extent_.length () * sin (dz.arg ()) / 3; // TODO: parameter + } + } while (flip (&d) != LEFT); s.attachment_ = os; scores.push (s); diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 4a1b44c656..2cdda26f88 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -843,7 +843,7 @@ ,New_slur::height) ; Slur::height) (height-limit . 2.0) - (ratio . 0.333) + (ratio . 0.25) (beautiful . 0.5) (y-free . 0.75) (attachment . (#f . #f)) -- 2.39.5