From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Tue, 30 Dec 1997 11:14:19 +0000 (+0100)
Subject: patch::: 0.1.38.jcn2: heen en weer
X-Git-Tag: release/0.1.39~1
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=333471d02eafa2641f299bc0ce903e10a4060649;p=lilypond.git

patch::: 0.1.38.jcn2: heen en weer

pl 38.jcn3
	- experimental whitespace fixes at begin and end of bar
---

diff --git a/NEWS b/NEWS
index a25644017f..dc4641d511 100644
--- 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 5432edf03e..c4ead0b530 100644
--- 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
index 0000000000..fb1f1085c0
--- /dev/null
+++ b/input/spacing.ly
@@ -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
+    }
+}
diff --git a/lily/spring-spacer.cc b/lily/spring-spacer.cc
index 6ae908c2af..6dc6e441be 100644
--- a/lily/spring-spacer.cc
+++ b/lily/spring-spacer.cc
@@ -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;
 	}
     }