]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 0.1.38.jcn2: heen en weer
authorJan Nieuwenhuizen <janneke@gnu.org>
Tue, 30 Dec 1997 11:14:19 +0000 (12:14 +0100)
committerJan Nieuwenhuizen <janneke@gnu.org>
Tue, 30 Dec 1997 11:14:19 +0000 (12:14 +0100)
pl 38.jcn3
- experimental whitespace fixes at begin and end of bar

NEWS
VERSION
input/spacing.ly [new file with mode: 0644]
lily/spring-spacer.cc

diff --git a/NEWS b/NEWS
index a25644017fcdfe21726c8dbfc0d4554e1269d49a..dc4641d51172129ffdff60b3b505852bd7b681ee 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+pl 38.jcn3
+       - experimental whitespace fixes at begin and end of bar
+
 pl 38.jcn2
        - added to beams.ly
        - open-up beam spacing for mult > 3
diff --git a/VERSION b/VERSION
index 5432edf03e46188eb379f21b896bc2706fabd5fa..c4ead0b530589a33b8b3e2d20b0f96e7dfba4ef0 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,7 +1,7 @@
 TOPLEVEL_MAJOR_VERSION = 0
 TOPLEVEL_MINOR_VERSION = 1
 TOPLEVEL_PATCH_LEVEL = 38
-TOPLEVEL_MY_PATCH_LEVEL = jcn2
+TOPLEVEL_MY_PATCH_LEVEL = jcn3
 
 # use the above to send patches, always empty for released version:
 # please don't move these comments up; the patch should fail if 
diff --git a/input/spacing.ly b/input/spacing.ly
new file mode 100644 (file)
index 0000000..fb1f108
--- /dev/null
@@ -0,0 +1,22 @@
+\header{
+title= "Spacing";
+subtitle = "proofsheet"; 
+enteredby =     "jcn";
+copyright =     "public domain";
+TestedFeatures =        "This file tests various spacings";
+}
+
+\version "0.1.7";
+
+\score{
+    \melodic{ 
+       c4 d e f
+       c4 d e [f8 f]
+       c4 d e f8 [f16 f]
+       c4 d e f8 f16 [f32 f]
+       c4 d e f8 f16 f32 [f64 f]
+    }
+    \paper {
+%      gourlay_maxmeasures = 4.0
+    }
+}
index 6ae908c2afa2f07cc489dd56f7a710463820d554..6dc6e441be18b252cf7b92f3881175ba99186832 100644 (file)
@@ -20,7 +20,7 @@
 #include "paper-def.hh"
 #include "dimen.hh"
 #include "colhpos.hh"
-
+#include "main.hh"             // experimental_fietsers
 
 Vector
 Spring_spacer::default_solution() const
@@ -517,6 +517,7 @@ Spring_spacer::calc_idealspacing()
   Array<Moment> context_shortest_arr;
   get_ruling_durations(shortest_playing_arr, context_shortest_arr);
 
+  Real interline_f = paper_l ()->interline_f ();
 
   Array<Real> ideal_arr_;
   Array<Real> hooke_arr_;
@@ -572,21 +573,96 @@ Spring_spacer::calc_idealspacing()
          Real dist = paper_l()->duration_to_dist (shortest_playing_len, k);
          dist *= delta_t / shortest_playing_len;
 
-         /* all sorts of ugliness to avoid running into bars/clefs, but not taking
-            extra space if this is not needed */
-         if (!scol_l (i+1)->musical_b())
+         /*
+            this is an experimental try to fix the spacing 
+            at the beginning and end of bars.
+            if -t option is not used, the old algorithm should still 
+            be in effect.
+
+            the "old" comment below about ugliness seems to indicate that
+            the code below it address the  same problem? but it sounds real
+            bad.
+
+            According to [Ross] and [Wanske], and from what i've seen:
+            * whitespace at the begin of the bar should be fixed at 
+            (about) two interlines.
+            [Ross]:
+            when spacing gets real tight, a smaller fixed value may be 
+            used, so that there are two discrete amounts of whitespace 
+            possible at the begin of a bar; but this is not implemented 
+            right now.
+            * whitespace at the end of the bar is the normal amount of 
+            "hinterfleish" that would have been used, had there been
+            yet another note in the bar.  
+            [Ross]:
+            some editors argue that the bar line should not take any 
+            space, not to hinder the flow of music spaced around a bar 
+            line.  
+            [Ross] and [Wanske] do not suggest this, however.  Further,
+            it introduces some spacing problems and think that it is ugly 
+            too.
+          */
+
+         if (experimental_features_global_b)
            {
-             Real minimum_dist =  - cols[i+1].width_[LEFT] + 2 PT + cols[i].width_[RIGHT];
-             if (ideal_arr_[i+1] + minimum_dist < dist)
+             /* 
+                first musical column of bar?
+              */
+             Moment now_mom = scol_l (i)->when ();
+             if (i && !scol_l (i - 1)->musical_b ()
+                 && ((Moment) floor (now_mom) == now_mom))
+               {
+                 /* 
+                    wtk1-fugue2: very nice
+                    standchen: fuk, koor dump in check_feasible ()
+                  */
+                 // fixed: probably should set minimum (rod/spring)?
+                 cols[i-1].width_[RIGHT] += 1.5 * interline_f;
+                 // should adjust dist too?
+                 ideal_arr_[i-1] += 1.5 * interline_f;
+               }
+
+             /* 
+                last musical column of bar?
+              */
+             Moment next_mom = scol_l (i + 1)->when ();
+             if ((i + 1 < cols.size ()) && !scol_l (i + 1)->musical_b ()
+                 && ((Moment) floor (next_mom) == next_mom))
+               {
+                 // hmm, how bout?
+                 dist = dist >? interline_f;
+
+                 // uhuh, this looks fine, already??
+                 // someone is junking this last "hinterfleisch" whitespace?!
+                 /* 
+                    wtk1-fugue2: very nice
+                    standchen: fuk, koor dump in check_feasible ()
+                  */
+                 cols[i].width_[RIGHT] = cols[i].width_[RIGHT] >? dist;
+               }
+
+             // ugh, do we need this?
+             if (!scol_l (i + 1)->musical_b ())
                {
-                 ideal_arr_[i] = dist - ideal_arr_[i+1];
-                 // hooke_arr_[i+1] =1.0;
-               } else {
-                 ideal_arr_[i] = minimum_dist;
+                 Real minimum = -cols[i + 1].width_[LEFT] + cols[i].width_[RIGHT]
+                 + interline_f / 2;
+                 dist = dist >? minimum;
                }
+           }
 
-           } else
-             ideal_arr_[i] = dist;
+         /* all sorts of ugliness to avoid running into bars/clefs, 
+            but not taking extra space if this is not needed 
+          */
+         else if (!scol_l (i + 1)->musical_b ())
+           {
+             Real minimum_dist = -cols[i + 1].width_[LEFT] + 2 PT
+             + cols[i].width_[RIGHT];
+             if (ideal_arr_[i + 1] + minimum_dist < dist)
+               dist -= ideal_arr_[i + 1];
+             else
+               dist = minimum_dist;
+           }
+         ideal_arr_[i] = dist;
        }
     }