]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.3.79.jcn3
authorJan Nieuwenhuizen <janneke@gnu.org>
Sun, 20 Aug 2000 07:56:34 +0000 (09:56 +0200)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sun, 20 Aug 2000 07:56:34 +0000 (09:56 +0200)
1.3.79.jcn3
===========

* Made various fixes for (line-)broken slurs.

* Fixed slur_height (), which fixes most ugly slurs (Yeah!).

CHANGES
Documentation/regression-test.tely
VERSION
input/test/slur-broken.ly [new file with mode: 0644]
input/test/slur-nice.ly [new file with mode: 0644]
lily/bezier-bow.cc
lily/slur.cc
scm/slur.scm

diff --git a/CHANGES b/CHANGES
index cd80444b006595b13e8631bfbcad228d994e90e1..0e3fcdf38802dbec0048f161d725a9c5d4dc4e56 100644 (file)
--- 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
 ===========
 
index 05bf77c1c256e8a4dabf544924f564a40c5734c0..a22fa6376753d68397bd73a7ff5a71afc26e0569 100644 (file)
@@ -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 befa9231c181110af473571b3b9f8befd9a927a9..648c53e1aec59b0dc729df671c85363c08903850 100644 (file)
--- 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 (file)
index 0000000..44d4531
--- /dev/null
@@ -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 (file)
index 0000000..c4efee9
--- /dev/null
@@ -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;
+       }
+}
index 6861f61fc4d1e3e2f8861b9ca70831595a393b0f..7b8654d1bbe6c6fbdb896d3c98e43f99fd197aee 100644 (file)
 #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)
 
index 7867482e3ee0f8c04e2f372be478f111733e3086..a2228c73ce13da30d21186a27ce28401b7a197a7 100644 (file)
@@ -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?
index bf36ed76ac122b768aa8ea39a09cb3d553c6af0f..1f4d9132e006e6ddde3905621514f2df5450fc2a 100644 (file)
 (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))
     ))