From 3bd3c4c9300f619f8545f3f1eaa0a5cc9c86bb14 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 20 Aug 2000 09:56:34 +0200 Subject: [PATCH] patch::: 1.3.79.jcn3 1.3.79.jcn3 =========== * Made various fixes for (line-)broken slurs. * Fixed slur_height (), which fixes most ugly slurs (Yeah!). --- CHANGES | 7 ++++ Documentation/regression-test.tely | 11 ++++- VERSION | 2 +- input/test/slur-broken.ly | 14 +++++++ input/test/slur-nice.ly | 15 +++++++ lily/bezier-bow.cc | 8 ++-- lily/slur.cc | 64 ++++++++++++++---------------- scm/slur.scm | 10 ++++- 8 files changed, 90 insertions(+), 41 deletions(-) create mode 100644 input/test/slur-broken.ly create mode 100644 input/test/slur-nice.ly diff --git a/CHANGES b/CHANGES index cd80444b00..0e3fcdf388 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,10 @@ +1.3.79.jcn3 +=========== + +* Made various fixes for (line-)broken slurs. + +* Fixed slur_height (), which fixes most ugly slurs (Yeah!). + 1.3.79.jcn2 =========== diff --git a/Documentation/regression-test.tely b/Documentation/regression-test.tely index 05bf77c1c2..a22fa63767 100644 --- a/Documentation/regression-test.tely +++ b/Documentation/regression-test.tely @@ -157,11 +157,20 @@ Override with @code{noStemExtend}. @mudelafile{beam-position.ly} Slurs should look nice and symmetric. The curvature may increase -only to avoid noteheads, and as little as possible. +only to avoid noteheads, and as little as possible. Slurs never +run through noteheads or stems. +@mudelafile{slur-nice.ly} @mudelafile{slur-symmetry.ly} @mudelafile{slur-symmetry-1.ly} +Across line breaks, slurs behave nicely. On the left, they extend to +just after the preferatory matter, and on the right to the end of the +staff. A slur should follow the same vertical direction it would have +in unbroken state. + +@mudelafile{slur-broken.ly} + Ties are strictly horizontal. They are placed in between note heads. The horizontal middle should not overlap with a staffline. diff --git a/VERSION b/VERSION index befa9231c1..648c53e1ae 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 PATCH_LEVEL=79 -MY_PATCH_LEVEL=jcn2 +MY_PATCH_LEVEL=jcn3 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/input/test/slur-broken.ly b/input/test/slur-broken.ly new file mode 100644 index 0000000000..44d453151e --- /dev/null +++ b/input/test/slur-broken.ly @@ -0,0 +1,14 @@ +\score{ + \notes\relative c''{ + \time 2/4; + e2( + \break + )e4 f,(\break + )f4 f(\break + a2\break + )e'2 + } + \paper{ + linewidth = 60.\mm; + } +} diff --git a/input/test/slur-nice.ly b/input/test/slur-nice.ly new file mode 100644 index 0000000000..c4efee9a62 --- /dev/null +++ b/input/test/slur-nice.ly @@ -0,0 +1,15 @@ +\score{ + \notes\relative c''{ + \time 3/4; + \slurup + \stemboth a ( \stemdown a \stemboth ) a a( c )a a( e' )a, a( g' )a, + \stemup a( e' )a, + \break + \slurdown + \stemboth c ( \stemup c \stemboth ) c c ( a ) c c( d, )c' c( f, )c' + \stemdown c( f, )c' + } + \paper{ + linewidth = 120.\mm; + } +} diff --git a/lily/bezier-bow.cc b/lily/bezier-bow.cc index 6861f61fc4..7b8654d1bb 100644 --- a/lily/bezier-bow.cc +++ b/lily/bezier-bow.cc @@ -12,9 +12,11 @@ #include "misc.hh" #include "bezier.hh" -static Real F0_1 (Real x) + +static Real +F0_1 (Real x) { - return M_PI /2 * atan(2 * x / M_PI); + return 2 / M_PI * atan ( M_PI * x / 2); } Real @@ -37,7 +39,7 @@ slur_height (Real width, Real h_inf, Real r_0) Examples: - * F(x) = pi/2 * atan (2x/pi) + * F(x) = 2/pi * atan (pi x/2) * F(x) 1/alpha * x^alpha / (1 + x^alpha) diff --git a/lily/slur.cc b/lily/slur.cc index 7867482e3e..a2228c73ce 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -208,16 +208,17 @@ Slur::get_attachment (Score_element*me,Direction dir, Real ss = Staff_symbol_referencer::staff_space ((Score_element*)me); Real hs = ss / 2.0; Offset o; - + + Score_element *stem = 0; if (Note_column::has_interface (sp->get_bound (dir))) { Score_element * n =sp->get_bound (dir); - if (Score_element*st = Note_column::stem_l (n)) + if (Score_element *stem = Note_column::stem_l (n)) { if (str == "head") { - o = Offset (0, Stem::chord_start_f (st )); + o = Offset (0, Stem::chord_start_f (stem)); /* Default position is centered in X, on outer side of head Y */ @@ -226,55 +227,48 @@ Slur::get_attachment (Score_element*me,Direction dir, } else if (str == "alongside-stem") { - o = Offset (0, Stem::chord_start_f (st )); + o = Offset (0, Stem::chord_start_f (stem)); /* Default position is on stem X, on outer side of head Y */ o += Offset (n->extent (X_AXIS).length () - * (1 + Stem::get_direction (st )), + * (1 + Stem::get_direction (stem)), 0.5 * ss * Directional_element_interface (me).get ()); } else if (str == "stem") { - o = Offset (0, Stem::stem_end_position (st ) * hs); + o = Offset (0, Stem::stem_end_position (stem) * hs); /* Default position is on stem X, at stem end Y */ o += Offset (0.5 * (n->extent (X_AXIS).length () - - st->extent (X_AXIS).length ()) - * (1 + Stem::get_direction (st )), + - stem->extent (X_AXIS).length ()) + * (1 + Stem::get_direction (stem)), 0); } - else if (str == "loose-end") - { - SCM other_a = dir == LEFT ? gh_cdr (s) : gh_car (s); - if (ly_symbol2string (other_a) != "loose-end") - { - o = Offset (0, get_attachment (me, -dir, common)[Y_AXIS]); - } - else if (dir == RIGHT) - { - o[X_AXIS] = (sp->get_bound (dir)->relative_coordinate (common[X_AXIS], X_AXIS) - - me->relative_coordinate (common[X_AXIS], X_AXIS)); - } - } - - - SCM l = scm_assoc - (scm_listify (a, - gh_int2scm (Stem::get_direction (st ) * dir), - gh_int2scm (Directional_element_interface (me).get () * dir), - SCM_UNDEFINED), - scm_eval (ly_symbol2scm ("slur-extremity-offset-alist"))); - - if (l != SCM_BOOL_F) - { - o += ly_scm2offset (gh_cdr (l)) * ss * dir; - } } } - + else if (str == "loose-end") + { + SCM other_a = dir == LEFT ? gh_cdr (s) : gh_car (s); + if (ly_symbol2string (other_a) != "loose-end") + { + o = Offset (0, get_attachment (me, -dir, common)[Y_AXIS]); + } + } + + SCM l = scm_assoc + (scm_listify (a, + gh_int2scm (stem ? Stem::get_direction (stem) : 1 * dir), + gh_int2scm (Directional_element_interface (me).get () * dir), + SCM_UNDEFINED), + scm_eval (ly_symbol2scm ("slur-extremity-offset-alist"))); + + if (l != SCM_BOOL_F) + { + o += ly_scm2offset (gh_cdr (l)) * ss * dir; + } /* What if get_bound () is not a note-column? diff --git a/scm/slur.scm b/scm/slur.scm index bf36ed76ac..1f4d9132e0 100644 --- a/scm/slur.scm +++ b/scm/slur.scm @@ -26,12 +26,17 @@ (define slur-extremity-rules (list - ;; (cons (lambda (slur dir) (begin (display "before head") (newline))#f) #f) + ;; (cons (lambda (slur dir) (begin (display "before sanity check") (newline))#f) #f) ;; urg: don't crash on a slur without note-columns (cons (lambda (slur dir) (< (length (ly-get-elt-property slur 'note-columns)) 1)) 'head) + ;; (cons (lambda (slur dir) (begin (display "before loose-end") (newline))#f) #f) + (cons (lambda (slur dir) (not (attached-to-stem slur dir))) 'loose-end) + + ;; (cons (lambda (slur dir) (begin (display "before head") (newline))#f) #f) + (cons (lambda (slur dir) ;; urg, code dup (let* ((note-columns (ly-get-elt-property slur 'note-columns)) @@ -87,4 +92,7 @@ ((stem 1 1) . (0 . 0.5)) ((stem -1 -1) . (0 . -0.5)) + + ((loose-end -1 1) . (-4 . 0)) + ((loose-end -1 -1) . (-4 . 0)) )) -- 2.39.5