]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scm/define-grobs.scm (all-grob-descriptions): set ratio
authorhanwen <hanwen>
Sun, 18 Jul 2004 16:03:12 +0000 (16:03 +0000)
committerhanwen <hanwen>
Sun, 18 Jul 2004 16:03:12 +0000 (16:03 +0000)
.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
flower/include/offset.hh
input/regression/slur-tilt.ly [new file with mode: 0644]
lily/new-slur.cc
scm/define-grobs.scm

index 3a9b8e30c7c754cd74854fc932b871b31c05e714..bc8ddeaef147528c09673c3d7e8a7324b907f8af 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2004-07-18  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
+       * 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.
 
index 3622c7be41384178ca6ecaec3ec30bcac82f873e..8c57c3de2968d1bab7c46ff4671bb6f655fab499 100644 (file)
@@ -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 (file)
index 0000000..51bae03
--- /dev/null
@@ -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,)
+    
+
+}
index 62f9400398c4a3738e8f241571685272206193d2..94cd426417cb58a18382d080c5802d4fb777ef14 100644 (file)
@@ -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<Slur_score> *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<bool> 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);
index 4a1b44c656b219979a97e706c45af82de17f0595..2cdda26f88ed20a86b3518df5ed189f930801411 100644 (file)
                           ,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))