]> git.donarmstrong.com Git - lilypond.git/commitdiff
* input/regression/stem-shorten.ly: new file.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 13 Jun 2003 23:12:42 +0000 (23:12 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 13 Jun 2003 23:12:42 +0000 (23:12 +0000)
* lily/stem.cc (get_default_stem_end_position): revise stem
shortening code.

ChangeLog
input/regression/stem-shorten.ly [new file with mode: 0644]
lily/stem.cc
scm/define-grob-properties.scm

index 5b570f1450c2b8fa3007144feebc2c7080d892fb..922c44fdd21c0869e6bac1d8567f37f7806a91d3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2003-06-14  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
 
+       * input/regression/stem-shorten.ly: new file.
+
+       * lily/stem.cc (get_default_stem_end_position): revise stem
+       shortening code.
+
        * input/regression/spacing-multi-tuplet.ly: move from input/test/
 
        * input/test/{scripts,volta-start,sleur}.ly: remove
diff --git a/input/regression/stem-shorten.ly b/input/regression/stem-shorten.ly
new file mode 100644 (file)
index 0000000..31554a6
--- /dev/null
@@ -0,0 +1,15 @@
+\version "1.7.18"
+
+\header {
+    
+    texidoc = "Stems in forced directions (as well as the ones
+    starting from the middle line) are shortened"
+
+}
+
+\score {
+    \notes \relative c'' { \stemDown d c b a g f e
+                          \stemUp a b c d e f g a 
+                      } 
+    \paper  {raggedright = ##t }
+}
index 7a63f20b7c5eeb0e5d6a8f023f11ca07faadc34e..51c2c5853034934a9500871eacca3304a34756d1 100644 (file)
@@ -289,32 +289,32 @@ Stem::get_default_stem_end_position (Grob*me)
   SCM s;
   Array<Real> a;
 
-  Real length_f = 3.5;
+  Real length = 3.5;
   SCM scm_len = me->get_grob_property ("length");
   if (gh_number_p (scm_len))
     {
-      length_f = gh_scm2double (scm_len);
+      length = gh_scm2double (scm_len);
     }
   else
     {
       s = me->get_grob_property ("lengths");
       if (gh_pair_p (s))
        {
-         length_f = 2* gh_scm2double (robust_list_ref (duration_log(me) -2, s));
+         length = 2* gh_scm2double (robust_list_ref (duration_log(me) -2, s));
        }
     }
 
-  Real shorten_f = 0.0;
+  Real shorten = 0.0;
   
   SCM sshorten = me->get_grob_property ("stem-shorten");
-  if (gh_pair_p (sshorten))
+  SCM scm_shorten = gh_pair_p (sshorten) ?
+    robust_list_ref ((duration_log (me) - 2) >? 0, sshorten): SCM_EOL;
+  if (gh_number_p (scm_shorten))
     {
-      shorten_f = 2* gh_scm2double (robust_list_ref ((duration_log (me) - 2) >? 0, sshorten));
+      shorten = 2* gh_scm2double (scm_shorten);
     }
 
-  /* On boundary: shorten only half */
-  if (abs (chord_start_y (me)) == 0.5)
-    shorten_f *= 0.5;
+
 
   /* URGURGURG
      'set-default-stemlen' sets direction too
@@ -325,16 +325,19 @@ Stem::get_default_stem_end_position (Grob*me)
       dir = get_default_dir (me);
       Directional_element_interface::set (me, dir);
     }
+
+  /* On boundary: shorten only half */
+  if (abs (head_positions (me)[get_direction (me)]) <= 1)
+    shorten *= 0.5;
   
   /* stems in unnatural (forced) direction should be shortened, 
     according to [Roush & Gourlay] */
-  if (chord_start_y (me)
-      && (get_direction (me) != get_default_dir (me)))
-    length_f -= shorten_f;
+  if (!chord_start_y (me)
+      || (get_direction (me) != get_default_dir (me)))
+    length -= shorten;
 
   Interval hp = head_positions (me);  
-  Real st = hp[dir] + dir * length_f;
-
+  Real st = hp[dir] + dir * length;
 
   /*
     TODO: change name  to extend-stems to staff/center/'()
@@ -417,11 +420,9 @@ Stem::position_noteheads (Grob*me)
     heads.reverse ();
 
 
-  bool invisible = invisible_b (me);
   Real thick = gh_scm2double (me->get_grob_property ("thickness"))
      * me->get_paper ()->get_var ("linethickness");
       
-
   Grob *hed = support_head (me);
   Real w = Note_head::head_extent (hed,X_AXIS)[dir];
   for (int i=0; i < heads.size (); i++)
@@ -430,7 +431,7 @@ Stem::position_noteheads (Grob*me)
                                X_AXIS);
     }
   
-  bool parity= true;           // todo: make me settable.
+  bool parity= true;
   int lastpos = int (Staff_symbol_referencer::get_position (heads[0]));
   for (int i=1; i < heads.size (); i ++)
     {
@@ -910,7 +911,6 @@ Stem::calc_stem_info (Grob *me)
   if (gh_number_p (shorten))
     ideal_y -= gh_scm2double (shorten);
 
-
   Real minimum_free =
     gh_scm2double (robust_list_ref
                   (beam_count - 1,
index 8e0687d00f99e7d311eeaca8215552109e247c2e..a6fdceef56ec9f31f48adc2b79f4e2bb5bb937bc 100644 (file)
@@ -102,6 +102,7 @@ In the case of alignment grobs, this should contain only one number.")
 (grob-property-description 'beamed-lengths list? "list of stem lengths given beam multiplicity .")
 (grob-property-description 'beamed-minimum-free-lengths list? "list of normal minimum free stem lengths (chord to beams) given beam multiplicity.")
 (grob-property-description 'beamed-extreme-minimum-free-lengths list? "list of extreme minimum free stem lengths (chord to beams) given beam multiplicity.")
+
 (grob-property-description 'beamed-stem-shorten list? "shorten beamed stems in forced direction.")
 (grob-property-description 'beaming pair?
                           "Pair of number lists. Each number list