From 9f47f5726909af0b99bf38880f330e79c4682710 Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Sun, 12 Aug 2001 16:25:12 +0200
Subject: [PATCH] patch::: 1.5.4.jcn5

---
 VERSION                                |   2 +-
 input/trip.ly                          |   2 +-
 lily/break-algorithm.cc                |  12 ++-
 lily/gourlay-breaking.cc               |   4 +-
 lily/include/break-algorithm.hh        |   6 +-
 lily/include/column-x-positions.hh     |   2 +-
 lily/include/line-of-score.hh          |   2 +-
 lily/include/new-spacing-spanner.hh    |   5 +-
 lily/include/simple-spacer.hh          |   8 +-
 lily/include/spacing-spanner.hh        |   5 +-
 lily/kpath.cc                          |  49 -----------
 lily/line-of-score.cc                  |   8 +-
 lily/new-spacing-spanner.cc            |  76 +++++++++++------
 lily/paper-score.cc                    |   2 +-
 lily/separating-line-group-engraver.cc |  48 ++++++++++-
 lily/simple-spacer.cc                  | 110 ++++++++++++++++++++-----
 lily/spacing-spanner.cc                |  12 +--
 lily/stanza-number-engraver.cc         |   2 +-
 scm/grob-description.scm               |   4 +-
 19 files changed, 225 insertions(+), 134 deletions(-)

diff --git a/VERSION b/VERSION
index fead2c56c1..e033a58807 100644
--- a/VERSION
+++ b/VERSION
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=5
 PATCH_LEVEL=4
-MY_PATCH_LEVEL=jcn4
+MY_PATCH_LEVEL=jcn5
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
diff --git a/input/trip.ly b/input/trip.ly
index 11a30811d3..6aa569f523 100644
--- a/input/trip.ly
+++ b/input/trip.ly
@@ -69,7 +69,7 @@ praeludiumLeft =  \notes \relative c {
 
       cis] }
       \translator Staff = bass 
-      \shiftOff
+      \shiftOff \stemUp
       [bis gis] cis4 |
       dis2 cis4 r8 cis }
     \context Voice = one { \stemUp bis2 }
diff --git a/lily/break-algorithm.cc b/lily/break-algorithm.cc
index e845133d63..887efc3d20 100644
--- a/lily/break-algorithm.cc
+++ b/lily/break-algorithm.cc
@@ -22,7 +22,7 @@
 Array<int>
 Break_algorithm::find_break_indices () const
 {
-  Link_array<Grob> all = pscore_l_->line_l_->column_l_arr ();
+  Link_array<Item> all = pscore_l_->line_l_->column_l_arr ();
   Array<int> retval;
 
   for (int i=0; i < all.size (); i++)
@@ -37,11 +37,11 @@ Break_algorithm::find_break_indices () const
 }
 
 
-Link_array<Grob>
+Link_array<Item>
 Break_algorithm::find_breaks () const
 {
-  Link_array<Grob> all = pscore_l_->line_l_->column_l_arr ();
-  Link_array<Grob> retval;
+  Link_array<Item> all = pscore_l_->line_l_->column_l_arr ();
+  Link_array<Item> retval;
 
   for (int i=0; i < all.size (); i++)
     if (Item::breakable_b (all[i]))
@@ -56,7 +56,7 @@ Break_algorithm::find_breaks () const
 
 
 Simple_spacer*
-Break_algorithm::generate_spacing_problem (Link_array<Grob> curline, Interval line) const
+Break_algorithm::generate_spacing_problem (Link_array<Item> curline, Interval line) const
 {
   Simple_spacer * sp =  new Simple_spacer;
 
@@ -80,8 +80,6 @@ Break_algorithm::generate_spacing_problem (Link_array<Grob> curline, Interval li
     sp->line_len_f_ = line.length ();
   
   sp->add_columns (curline);
-
-
   return sp;
 }
 
diff --git a/lily/gourlay-breaking.cc b/lily/gourlay-breaking.cc
index 04112971d3..4b8b6048fc 100644
--- a/lily/gourlay-breaking.cc
+++ b/lily/gourlay-breaking.cc
@@ -54,7 +54,7 @@ Array<Column_x_positions>
 Gourlay_breaking::do_solve () const
 {
   Array<Break_node> optimal_paths;
-  Link_array<Grob> all =
+  Link_array<Item> all =
     pscore_l_->line_l_->column_l_arr ();
   
   Array<int> breaks = find_break_indices ();
@@ -80,7 +80,7 @@ Gourlay_breaking::do_solve () const
 
       for (int start_idx = break_idx; start_idx--;)
 	{
-	  Link_array<Grob> line = all.slice (breaks[start_idx], breaks[break_idx]+1);
+	  Link_array<Item> line = all.slice (breaks[start_idx], breaks[break_idx]+1);
   
 	  line[0]     = dynamic_cast<Item*> (line[0])    ->find_prebroken_piece (RIGHT);
 	  line.top () = dynamic_cast<Item*> (line.top ())->find_prebroken_piece (LEFT);
diff --git a/lily/include/break-algorithm.hh b/lily/include/break-algorithm.hh
index c91a00bdaf..ba0048b9b2 100644
--- a/lily/include/break-algorithm.hh
+++ b/lily/include/break-algorithm.hh
@@ -28,7 +28,7 @@ protected:
   Real linewidth_f_;
 
   /// search all pcols which are breakable.
-  Link_array<Grob> find_breaks () const;
+  Link_array<Item> find_breaks () const;
 
   Array<int> find_break_indices () const;
     
@@ -37,10 +37,10 @@ protected:
   void solve_line (Column_x_positions*) const;
 
   /// does curline fit on the paper?    
-  bool feasible (Link_array<Grob>) const;
+  bool feasible (Link_array<Item>) const;
     
 
-  Simple_spacer* generate_spacing_problem (Link_array<Grob>, Interval) const;
+  Simple_spacer* generate_spacing_problem (Link_array<Item>, Interval) const;
 
   virtual Array<Column_x_positions> do_solve () const=0;
 
diff --git a/lily/include/column-x-positions.hh b/lily/include/column-x-positions.hh
index e8688d3bcd..7e1a48245c 100644
--- a/lily/include/column-x-positions.hh
+++ b/lily/include/column-x-positions.hh
@@ -13,7 +13,7 @@
 
 struct Column_x_positions
 {
-  Link_array<Grob> cols_;
+  Link_array<Item> cols_;
   Array<Real> config_;
   Real force_f_;
   bool satisfies_constraints_b_;
diff --git a/lily/include/line-of-score.hh b/lily/include/line-of-score.hh
index e2c2fc4b73..5de05af03f 100644
--- a/lily/include/line-of-score.hh
+++ b/lily/include/line-of-score.hh
@@ -26,7 +26,7 @@ public:
   void output_lines ();
 
   Link_array<Item> broken_col_range (Item const*, Item const*) const;
-  Link_array<Grob> column_l_arr () const;
+  Link_array<Item> column_l_arr () const;
   
   void add_column (Paper_column*);
   void typeset_grob (Grob*);
diff --git a/lily/include/new-spacing-spanner.hh b/lily/include/new-spacing-spanner.hh
index 0137a5c8a1..e46b406ce7 100644
--- a/lily/include/new-spacing-spanner.hh
+++ b/lily/include/new-spacing-spanner.hh
@@ -17,13 +17,14 @@ class New_spacing_spanner
 {
 public:
   static void set_interface (Grob*);
-  static void do_measure (Grob*,Link_array<Grob> const &) ;
-  static void stretch_to_regularity (Grob*, Array<Spring> *, Link_array<Grob> const &);
+  static void do_measure (Grob*,Link_array<Item> const &) ;
+  static void stretch_to_regularity (Grob*, Array<Spring> *, Link_array<Item> const &);
   DECLARE_SCHEME_CALLBACK (set_springs, (SCM ));
   static Real stem_dir_correction (Grob*,Grob*,Grob*)  ;
   static Real default_bar_spacing (Grob*,Grob*,Grob*,Moment)  ;
   static Real note_spacing (Grob*,Grob*,Grob*,Moment)  ;
   static Real get_duration_space (Grob*,Moment dur, Moment shortest) ;
+  static void breakable_column_spacing (Item*,Item*);
 };
 
 #endif /* SPACING_SPANNER_HH */
diff --git a/lily/include/simple-spacer.hh b/lily/include/simple-spacer.hh
index 2f13a107d2..2f12339490 100644
--- a/lily/include/simple-spacer.hh
+++ b/lily/include/simple-spacer.hh
@@ -63,7 +63,10 @@ struct Spring_description
 struct Simple_spacer
 {
   Array<Spring_description> springs_;
+  Link_array<Item> spaced_cols_;
+  Link_array<Item> all_cols_; 
 
+  
   Real force_f_;
   Real indent_f_;
   Real line_len_f_;
@@ -71,9 +74,10 @@ struct Simple_spacer
 
 
   Simple_spacer ();
-  
+
+  void do_wide_springs (Column_x_positions*) const;
   void solve (Column_x_positions *) const;
-  void add_columns (Link_array<Grob>);
+  void add_columns (Link_array<Item>);
   void my_solve_linelen ();
   void my_solve_natural_len ();
   Real active_springs_stiffness () const;
diff --git a/lily/include/spacing-spanner.hh b/lily/include/spacing-spanner.hh
index b045401a02..fa3a92f1c7 100644
--- a/lily/include/spacing-spanner.hh
+++ b/lily/include/spacing-spanner.hh
@@ -17,9 +17,10 @@ class Spacing_spanner
 {
 public:
   static void set_interface (Grob*);
-  static void do_measure (Grob*,Link_array<Grob> const &) ;
-  static void stretch_to_regularity (Grob*, Array<Spring> *, Link_array<Grob> const &);
+  static void do_measure (Grob*,Link_array<Item> const &) ;
+  static void stretch_to_regularity (Grob*, Array<Spring> *, Link_array<Item> const &);
   DECLARE_SCHEME_CALLBACK (set_springs, (SCM ));
+
   static Real stem_dir_correction (Grob*,Grob*,Grob*)  ;
   static Real default_bar_spacing (Grob*,Grob*,Grob*,Moment)  ;
   static Real note_spacing (Grob*,Grob*,Grob*,Moment)  ;
diff --git a/lily/kpath.cc b/lily/kpath.cc
index f42c5fd1f6..d97cacba31 100644
--- a/lily/kpath.cc
+++ b/lily/kpath.cc
@@ -25,7 +25,6 @@ extern "C" {
 #include "string.hh"
 #include "main.hh"
 #include "kpath.hh"
-#include "lily-version.hh"
 
 
 char *
@@ -96,55 +95,7 @@ ly_init_kpath (char *av0)
    */
   kpse_set_program_name (av0, NULL);
   kpse_maketex_option ("tfm", TRUE);
-
-#if  0
-
-
-  /*
-    
-    Remove the setting for TFMFONTS if we have kpathsea, because
-    kpathsea can find TFM fonts anyway.
-
-    If we don't lily will want to make tfms for cmr fonts, even if
-    there is a :: entry in the TFMFONTS path.
-
-    This will fail if a user has special fonts (outside of feta) that
-    can not be found by kpath.
-
-    If TFMFONTS is unset, TFMs of feta will be generated on the
-    fly. The risk is that this will cause checksum mismatch errors,
-    but MF is reasonably deterministic (so we hope not).
-
-    The advantage is that the PK font will also be generated under
-    /var/texmf/fonts, reducing clutter and compilation time.
-
-   */
-
-#ifndef __CYGWIN__  /* mktextfm/mktexpk does not work on windows */
-  unsetenv ("TFMFONTS");
-#endif
-
-#ifdef DEBIAN
-  String my_tfm = "$VARTEXFONTS/tfm/public/lilypond";
-#else
-  String my_tfm = "$VARTEXFONTS/tfm/lilypond/";
-  my_tfm += version_str () + "/";
-#endif
-
-#ifdef DEBIAN
-  char * mypath = strdup ((my_tfm + ":").ch_C());
-  kpse_format_info[kpse_tfm_format].client_path = mypath;
-#else
-  char * mypath = kpse_expand (my_tfm.ch_C ());
-			   
-  String prog = "mktextfm --destdir ";
-  prog += mypath;
-  
-  kpse_format_info[kpse_tfm_format].program = strdup (prog.ch_C ());
-#endif
 #endif
-#endif
-  
 }
 
 
diff --git a/lily/line-of-score.cc b/lily/line-of-score.cc
index 9c70f62adb..bb3384f023 100644
--- a/lily/line-of-score.cc
+++ b/lily/line-of-score.cc
@@ -132,7 +132,7 @@ Line_of_score::break_into_pieces (Array<Column_x_positions> const &breaking)
       Line_of_score *line_l = dynamic_cast <Line_of_score*> (clone ());
       line_l->rank_i_ = i;
       //      line_l->set_immutable_grob_property ("rank", gh_int2scm (i));
-      Link_array<Grob> c (breaking[i].cols_);
+      Link_array<Item> c (breaking[i].cols_);
       pscore_l_->typeset_line (line_l);
       
       line_l->set_bound (LEFT,c[0]);
@@ -393,11 +393,11 @@ Line_of_score::broken_col_range (Item const*l, Item const*r) const
    Return all columns, but filter out any unused columns , since they might
    disrupt the spacing problem.
  */
-Link_array<Grob>
+Link_array<Item>
 Line_of_score::column_l_arr ()const
 {
-  Link_array<Grob> acs
-    = Pointer_group_interface__extract_elements (this, (Grob*) 0, "columns");
+  Link_array<Item> acs
+    = Pointer_group_interface__extract_elements (this, (Item*) 0, "columns");
   bool bfound = false;
   for (int i= acs.size (); i -- ;)
     {
diff --git a/lily/new-spacing-spanner.cc b/lily/new-spacing-spanner.cc
index 009dd0f0aa..324a6cd377 100644
--- a/lily/new-spacing-spanner.cc
+++ b/lily/new-spacing-spanner.cc
@@ -39,7 +39,7 @@ New_spacing_spanner::set_interface (Grob*me)
   
  */
 void
-New_spacing_spanner::do_measure (Grob*me, Link_array<Grob> const & cols) 
+New_spacing_spanner::do_measure (Grob*me, Link_array<Item> const & cols) 
 {
   Moment shortest;
   Moment mean_shortest;
@@ -77,30 +77,54 @@ New_spacing_spanner::do_measure (Grob*me, Link_array<Grob> const & cols)
   Array<Spring> springs;
 
   Item * first_col = 0;
-  Item * last_col = 0;
-  
   for (int i= 0; i < cols.size () - 1; i++)
     {
       Item * l = dynamic_cast<Item*> (cols[i]);
 
-      if (!Paper_column::musical_b (l))
-	continue ;
-
-      if (!first_col)
+      if (!first_col && Paper_column::musical_b (l))
 	first_col = l;
+
+      SCM between = cols[i]->get_grob_property ("between-cols"); 
+      if (gh_pair_p (between)
+	  && i > 0
+	  && i < cols.size ()-1
+	  && (gh_cdr (between) != cols[i+1]->self_scm ()
+	   || gh_car (between) != cols[i-1]->self_scm ()) 
+	  )
+	continue ;
       
-      last_col = l;
       int j = i+1;
-      for (; j < cols.size () -1 ; j++)
-	if (Paper_column::musical_b (cols[j]))
-	  break ;
-      
+      for (; j < cols.size () - 1; j++)
+	{
+	  if  (Paper_column::musical_b (cols[j]))
+	    break;
+
+	  SCM between = cols[j]->get_grob_property ("between-cols");
+	  if (!gh_pair_p (between))
+	    continue;
+
+	  if (gh_car (between) == cols[i]->self_scm () )
+	    break ;
+	}
+
       Item * r =  dynamic_cast<Item*> (cols[j]);
       Paper_column * lc = dynamic_cast<Paper_column*> (l);
       Paper_column *rc = dynamic_cast<Paper_column*> (r);
-      if (!lc || !rc)
-	continue;
 
+
+      cout << "params for cols " << Paper_column::rank_i (l) << " " << Paper_column::rank_i (r) << endl;
+      cout << " musical: " << Paper_column::musical_b (l) << " " << Paper_column::musical_b (r) << endl;
+      if (!Paper_column::musical_b (l))
+	{
+	  breakable_column_spacing (l, r);
+
+	  l = l->find_prebroken_piece (RIGHT);
+	  if (l)
+	    breakable_column_spacing (l,r);
+
+	  continue ; 
+	}
+      
       Real note_space = note_spacing (me,lc, rc, shortest <? base_shortest_duration);
       Real hinterfleisch = note_space;
       Real headwid = gh_scm2double (me->get_grob_property ("arithmetic-multiplier"));
@@ -139,11 +163,14 @@ New_spacing_spanner::do_measure (Grob*me, Link_array<Grob> const & cols)
 	}
     }
 
-  Item * l = dynamic_cast<Item*> (cols[0])->find_prebroken_piece (RIGHT);
+}
 
-  /*
-    TODO read different spacing hints from break-alignment.
-   */
+/*
+  Read hints from L (todo: R) and generate springs.
+ */
+void
+New_spacing_spanner::breakable_column_spacing (Item* l, Item *r)
+{
   Spring s;
 
   Real break_dist = 0.0;
@@ -167,11 +194,8 @@ New_spacing_spanner::do_measure (Grob*me, Link_array<Grob> const & cols)
   s.distance_f_ = break_dist;
   s.strength_f_ = 1/break_stretch;
   s.item_l_drul_[LEFT] = l;
-  s.item_l_drul_[RIGHT] = first_col;
-
-  s.add_to_cols ();
+  s.item_l_drul_[RIGHT] = r;
 
-  s.item_l_drul_[LEFT] = dynamic_cast<Item*>(cols[0]);
   s.add_to_cols ();
 }
 
@@ -213,7 +237,7 @@ New_spacing_spanner::do_measure (Grob*me, Link_array<Grob> const & cols)
 void
 New_spacing_spanner::stretch_to_regularity (Grob *me,
 					Array<Spring> * springs,
-					Link_array<Grob> const & cols)
+					Link_array<Item> const & cols)
 {
   /*
     Find the starting column of the run. REGULAR-DISTANCE-TO points
@@ -225,7 +249,7 @@ New_spacing_spanner::stretch_to_regularity (Grob *me,
   for (int i = 0 ;  i <  cols.size () && !first_regular_spaced_col; i++)
     {
       SCM rdt = cols[i]->get_grob_property ("regular-distance-to");
-      if (cols.find_l (unsmob_grob (rdt)))
+      if (cols.find_l (dynamic_cast<Item*> (unsmob_grob (rdt))))
 	first_regular_spaced_col = unsmob_grob (rdt);
     }
   for (int i = springs->size ();  i-- ;)
@@ -446,7 +470,7 @@ SCM
 New_spacing_spanner::set_springs (SCM smob)
 {
   Grob *me = unsmob_grob (smob);
-  Link_array<Grob> all (me->pscore_l_->line_l_->column_l_arr ()) ;
+  Link_array<Item> all (me->pscore_l_->line_l_->column_l_arr ()) ;
 
   int j = 0;
 
@@ -455,7 +479,7 @@ New_spacing_spanner::set_springs (SCM smob)
       Grob *sc = all[i];
       if (Item::breakable_b (sc))
         {
-	  Link_array<Grob> measure (all.slice (j, i+1));	  
+	  Link_array<Item> measure (all.slice (j, i+1));	  
           do_measure (me, measure);
 	  j = i;
         }
diff --git a/lily/paper-score.cc b/lily/paper-score.cc
index 6d659d7064..0a9f8114b7 100644
--- a/lily/paper-score.cc
+++ b/lily/paper-score.cc
@@ -82,7 +82,7 @@ Paper_score::process ()
   /*
     Be sure to set breakability on first & last column.
    */
-  Link_array<Grob> pc (line_l_->column_l_arr ());
+  Link_array<Item> pc (line_l_->column_l_arr ());
   
   pc[0]->set_grob_property ("breakable", SCM_BOOL_T);
   pc.top ()->set_grob_property ("breakable", SCM_BOOL_T);
diff --git a/lily/separating-line-group-engraver.cc b/lily/separating-line-group-engraver.cc
index 5ac8910896..d767d1bade 100644
--- a/lily/separating-line-group-engraver.cc
+++ b/lily/separating-line-group-engraver.cc
@@ -6,6 +6,7 @@
   (c) 1998--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
+#include <iostream.h>
 
 #include "separating-group-spanner.hh"
 #include "separation-item.hh"
@@ -25,6 +26,8 @@ protected:
     
    */
   Item * last_step_musical_malt_p_;
+  Item * last_nonnil_musical_malt_p_;
+  Item * last_nonnil_break_malt_p_;
   
   Spanner * sep_span_p_;
   
@@ -40,6 +43,9 @@ public:
 Separating_line_group_engraver::Separating_line_group_engraver ()
 {
   last_step_musical_malt_p_ = 0;
+  last_nonnil_break_malt_p_ = 0;
+  last_nonnil_musical_malt_p_ = 0;
+  
   sep_span_p_ = 0;
   break_malt_p_ = 0;
   musical_malt_p_ =0;
@@ -96,14 +102,50 @@ Separating_line_group_engraver::stop_translation_timestep ()
   if (break_malt_p_)
     {
       Separating_group_spanner::add_spacing_unit (sep_span_p_, break_malt_p_);
-      
+
       typeset_grob (break_malt_p_);
+
+      last_nonnil_break_malt_p_ = break_malt_p_;
       break_malt_p_ =0;
     }
+
   if (musical_malt_p_)
     {
       Separating_group_spanner::add_spacing_unit (sep_span_p_, musical_malt_p_);
 
+
+      /* TODO
+
+	 move this mucketry into separation-spanner.
+	 
+       */
+      if (last_nonnil_break_malt_p_ && last_nonnil_musical_malt_p_)
+	{
+	  cout << now_mom ().str () <<endl;
+	  Item *col = 	  last_nonnil_break_malt_p_->column_l();
+	  if (!col)
+	    col = dynamic_cast<Item*> (unsmob_grob (get_property ("currentCommandColumn")));
+	  
+	  SCM between = col->get_grob_property ("between-cols");
+
+	  SCM left = last_nonnil_musical_malt_p_->column_l()->self_scm ();
+	  SCM right = get_property ("currentMusicalColumn"); // musical_malt_p_->column_l()->self_scm ();
+	  if (gh_pair_p (between))
+	    {
+	      /*
+		ugh. set_..._x ()
+	       */
+	      if (Paper_column::rank_i (unsmob_grob (gh_car (between))) < Paper_column::rank_i (unsmob_grob (left)))
+		gh_set_car_x (between, left);
+	      if (Paper_column::rank_i (unsmob_grob (gh_cdr (between))) > Paper_column::rank_i (unsmob_grob (right)))
+		gh_set_cdr_x (between, right);
+	    }
+	  else
+	    {
+	      col->set_grob_property ("between-cols", gh_cons (left, right));
+	    }
+	}
+      
       if (last_step_musical_malt_p_)
 	{
 	  Paper_column *col = 
@@ -114,7 +156,11 @@ Separating_line_group_engraver::stop_translation_timestep ()
 				  gh_cons (newtup,
 					   col->get_grob_property ("spacing-sequence")));
 	}
+
       
+
+      last_nonnil_break_malt_p_ = 0;
+      last_nonnil_musical_malt_p_ = musical_malt_p_;
       typeset_grob (musical_malt_p_);
     }
   last_step_musical_malt_p_ = musical_malt_p_;
diff --git a/lily/simple-spacer.cc b/lily/simple-spacer.cc
index 0340596ad3..f058f56f4f 100644
--- a/lily/simple-spacer.cc
+++ b/lily/simple-spacer.cc
@@ -13,6 +13,7 @@
 #include <math.h>
 #include <libc-extension.hh>	// isinf
 
+#include "string-convert.hh"
 #include "simple-spacer.hh"
 #include "paper-column.hh"
 #include "spring.hh"
@@ -165,55 +166,66 @@ Simple_spacer::my_solve_natural_len ()
 }
 
 void
-Simple_spacer::add_columns (Link_array<Grob> cols)
+Simple_spacer::add_columns (Link_array<Item> cols)
 {
+  for (int i =0; i < cols.size (); i++)
+    all_cols_.push ( dynamic_cast<Item*> (cols[i]));
+
+  Grob *next = 0;  
   for (int i=0; i < cols.size () - 1; i++)
     {
       SCM spring_params = SCM_UNDEFINED;
+
+      if (next && cols[i] != next)
+	continue;
+
       for (SCM s = cols[i]->get_grob_property ("ideal-distances");
-	   spring_params == SCM_UNDEFINED && gh_pair_p (s);
+	   !gh_pair_p (spring_params) && gh_pair_p (s);
 	   s = gh_cdr (s))
 	{
 	  Grob *other = unsmob_grob (gh_caar (s));
-	  if (other != cols[i+1])
+	  int j = i+1;
+	  for (; j < cols.size (); j++)
+	    if (cols[j] == other)
+	      break;
+
+	  if(j == cols.size ())
 	    continue;
 
+	  next = other;
 	  spring_params = gh_cdar (s);
 	}
 
       Spring_description desc;
-      if (spring_params != SCM_UNDEFINED)
+      desc.ideal_f_ = -1;
+      if (gh_pair_p(spring_params))
 	{
 	  desc.ideal_f_ = gh_scm2double (gh_car (spring_params));
 	  desc.hooke_f_ = gh_scm2double (gh_cdr (spring_params));
 	}
-      else
+
+      if (gh_pair_p (spring_params) && desc.sane_b ())
 	{
-	  programming_error (_f("No spring between column %d and next one",
-				Paper_column::rank_i (cols[i])
-				));
-	  desc.hooke_f_ = 1.0;
-	  desc.ideal_f_ = default_space_f_;
+	  spaced_cols_.push (dynamic_cast<Item*> (cols[i]));
+	  desc.block_force_f_ = - desc.hooke_f_ * desc.ideal_f_; // block at distance 0
+	  springs_.push (desc);
 	}
-
-      if (!desc.sane_b ())
+      else if (gh_pair_p (spring_params) && !desc.sane_b ())
 	{
-	  programming_error ("Insane spring found. Setting to unit spring.");
-	  desc.hooke_f_ = 1.0;
-	  desc.ideal_f_ = 1.0;
+	  programming_error (String_convert::form_str  ("insane springs at col %d", Paper_column::rank_i (cols[i])));
+	  // Generate rods for these cols. 
 	}
-      
-      desc.block_force_f_ = - desc.hooke_f_ * desc.ideal_f_; // block at distance 0
-      springs_.push (desc);
     }
+
+  spaced_cols_.push (all_cols_.top ());
   
-  for (int i=0; i < cols.size () - 1; i++)
+  for (int i=0; i < spaced_cols_.size () - 1; i++)
     {
-      for (SCM s = Spaceable_grob::get_minimum_distances (cols[i]);
+      for (SCM s = Spaceable_grob::get_minimum_distances (spaced_cols_[i]);
 	   gh_pair_p (s); s = gh_cdr (s))
 	{
-	  Grob * other = unsmob_grob (gh_caar (s));
-	  int oi = cols.find_i (other);
+	  Item * other = dynamic_cast<Item*> (unsmob_grob (gh_caar (s)));
+	  int oi = spaced_cols_.find_i (other);
 	  if (oi >= 0)
 	    {
 	      add_rod (i, oi, gh_scm2double (gh_cdar (s)));
@@ -242,6 +254,60 @@ Simple_spacer::solve (Column_x_positions *positions) const
     }
 
   positions->satisfies_constraints_b_ = (line_len_f_ < 0) || active_b ();
+  positions->cols_ = spaced_cols_;
+  do_wide_springs (positions);
+}
+
+/*
+  Do the columns whose springs didn't paricipate in the spacing process
+ */
+void
+Simple_spacer::do_wide_springs ( Column_x_positions *positions_)const
+{
+  int i  = 0;
+
+
+  Array<Real> all_posns;
+  for (int j = 0; j < all_cols_.size () && i < spaced_cols_.size (); j++)
+    {
+      if (all_cols_[j] == spaced_cols_[i])
+	{
+	  all_posns.push (positions_->config_[i] );
+	  i++;
+	  continue;
+	}
+
+
+      SCM between = all_cols_[j]->get_grob_property ("between-cols");
+      if (!gh_pair_p (between))
+	{
+	  programming_error (String_convert::form_str ("loose column rank %d not beween spaced cols", Paper_column::rank_i (all_cols_[j] )));
+	  all_posns.push (positions_->config_[i]);
+	  continue;
+	}
+      
+      Item * prev = dynamic_cast<Item*>  (unsmob_grob (gh_car (between)));
+      Item *next = dynamic_cast<Item*> (unsmob_grob (gh_cdr (between)));
+      int ip = i;
+      int in = i;
+      for (; ip--; )
+	if(spaced_cols_[ip] == prev)
+	  break;
+
+      for (; in < spaced_cols_.size (); in++)
+	if(spaced_cols_[in] == next)
+	  break;
+
+      // TODO: compute iso. 0.5
+      if (ip >= 0 && in < positions_->config_.size ())
+	all_posns.push (0.5 * (positions_->config_[ip] + positions_->config_[in]));
+      else
+	all_posns.push (positions_->config_[i]);
+      
+    }
+
+  positions_->config_ = all_posns;
+  positions_->cols_ = all_cols_;
 }
 
 
diff --git a/lily/spacing-spanner.cc b/lily/spacing-spanner.cc
index e5a519f1ea..9b281e83b0 100644
--- a/lily/spacing-spanner.cc
+++ b/lily/spacing-spanner.cc
@@ -104,7 +104,7 @@ find_runs (Grob*me, Link_array<Grob> cols)
   
  */
 void
-Spacing_spanner::do_measure (Grob*me, Link_array<Grob> const & cols) 
+Spacing_spanner::do_measure (Grob*me, Link_array<Item> const & cols) 
 {
   Moment shortest;
   Moment mean_shortest;
@@ -313,7 +313,7 @@ Spacing_spanner::do_measure (Grob*me, Link_array<Grob> const & cols)
 void
 Spacing_spanner::stretch_to_regularity (Grob *me,
 					Array<Spring> * springs,
-					Link_array<Grob> const & cols)
+					Link_array<Item> const & cols)
 {
   /*
     Find the starting column of the run. REGULAR-DISTANCE-TO points
@@ -325,7 +325,7 @@ Spacing_spanner::stretch_to_regularity (Grob *me,
   for (int i = 0 ;  i <  cols.size () && !first_regular_spaced_col; i++)
     {
       SCM rdt = cols[i]->get_grob_property ("regular-distance-to");
-      if (cols.find_l (unsmob_grob (rdt)))
+      if (cols.find_l (dynamic_cast<Item*> (unsmob_grob (rdt))))
 	first_regular_spaced_col = unsmob_grob (rdt);
     }
   for (int i = springs->size ();  i-- ;)
@@ -553,16 +553,16 @@ SCM
 Spacing_spanner::set_springs (SCM smob)
 {
   Grob *me = unsmob_grob (smob);
-  Link_array<Grob> all (me->pscore_l_->line_l_->column_l_arr ()) ;
+  Link_array<Item> all (me->pscore_l_->line_l_->column_l_arr ()) ;
 
   int j = 0;
 
   for (int i = 1; i < all.size (); i++)
     {
-      Grob *sc = all[i];
+      Item *sc = all[i];
       if (Item::breakable_b (sc))
         {
-	  Link_array<Grob> measure (all.slice (j, i+1));	  
+	  Link_array<Item> measure (all.slice (j, i+1));	  
           do_measure (me, measure);
 	  j = i;
         }
diff --git a/lily/stanza-number-engraver.cc b/lily/stanza-number-engraver.cc
index 5d4b0a5e01..5c3d0421e9 100644
--- a/lily/stanza-number-engraver.cc
+++ b/lily/stanza-number-engraver.cc
@@ -38,7 +38,7 @@ Stanza_number_engraver::Stanza_number_engraver ()
 }
 
 void
-Stanza_number_engraver::acknowledge_grob (Grob_info i)
+Stanza_number_engraver::acknowledge_grob (Grob_info )
 {
   if (gh_string_p (get_property ("whichBar")))
     {
diff --git a/scm/grob-description.scm b/scm/grob-description.scm
index a66b6ddadc..4eb74a3e74 100644
--- a/scm/grob-description.scm
+++ b/scm/grob-description.scm
@@ -2,7 +2,7 @@
 ;;;;
 ;;;;  source file of the GNU LilyPond music typesetter
 ;;;; 
-;;;; (c) 1998--2001  Han-Wen Nienhuys <hanwen@cs.uu.nl>
+;;;; (c) 1998--20.301  Han-Wen Nienhuys <hanwen@cs.uu.nl>
 ;;;;                 Jan Nieuwenhuizen <janneke@gnu.org>
 
 ; distances are given in stafflinethickness (thicknesses) and
@@ -466,7 +466,7 @@
 	(Script . (
 		;; don't set direction here: it breaks staccato.
 		(molecule-callback . ,Script::brew_molecule)
-		(padding . 0.3) 
+		(padding . 0.29) 
 		(X-offset-callbacks . (,Side_position_interface::centered_on_parent))
 		(before-line-breaking-callback . ,Script::before_line_breaking)
 		(meta . ,(grob-description "Script" script-interface side-position-interface font-interface))
-- 
2.39.5