]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/spacing-spanner.cc (musical_column_spacing): set
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 18 Jun 2006 12:57:37 +0000 (12:57 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 18 Jun 2006 12:57:37 +0000 (12:57 +0000)
compound_fixed_note_space to 0.0. Document why.

* lily/simple-spacer.cc (is_sane): also have a kludge for numeric
range of inverse_hooke_
(Simple_spacer): init completely.
(fits): const
(get_line_configuration): don't use cols.resize(); it introduces
initialized data.

* scm/framework-ps.scm (dump-page): add setstrokeadjust. Backportme.

* ps/music-drawing-routines.ps: remove selectfont L1 hack.

ChangeLog
THANKS
lily/gourlay-breaking.cc
lily/include/simple-spacer.hh
lily/sequential-iterator.cc
lily/simple-spacer.cc
lily/spacing-spanner.cc
lily/tie-formatting-problem.cc
ps/music-drawing-routines.ps
scm/framework-ps.scm

index 4d1a0d9dfcfa1d982e1b3107c15e0adce4cf155e..6322fde1b7bf4f3ac6df91e48f0494d9f384bce0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2006-06-18  Han-Wen Nienhuys  <hanwen@lilypond.org>
 
+       * lily/spacing-spanner.cc (musical_column_spacing): set
+       compound_fixed_note_space to 0.0. Document why.
+
+       * lily/simple-spacer.cc (is_sane): also have a kludge for numeric
+       range of inverse_hooke_
+       (Simple_spacer): init completely.
+       (fits): const
+       (get_line_configuration): don't use cols.resize(); it introduces
+       initialized data.
+
+       * scm/framework-ps.scm (dump-page): add setstrokeadjust. Backportme.
+
+       * ps/music-drawing-routines.ps: remove selectfont L1 hack.
+
        * lily/beaming-pattern.cc (best_splitpoint_index): urg, 2nd
        try. Divide by beatlength.
 
@@ -27,7 +41,7 @@
        * lily/align-interface.cc (align_to_fixed_distance): remove
        hungarian suffix.
 
-       * lily/beaming-pattern.cc (count_factor_twos): oops. We want to
+       * lily/beaming-pattern.cc (count_factor_twos): oops. We want
        x%2==0.
 
 2006-06-15  Han-Wen Nienhuys  <hanwen@lilypond.org>
diff --git a/THANKS b/THANKS
index 6ca6bc7963e504c1a74f478e9f7b0ee926e70eeb..84143c9024a2c6b9721dd625e8cf003e5d8b51c9 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -65,6 +65,7 @@ Rick Hansen
 Ruud van Silfhout
 Sietse Brouwer
 Stephen Carter
+Stephen Kress
 Thies Albrecht
 Trent Johnston
 Vaclav Smilauer
index 8599a6a57c58665047b5a533cd4510d5d25f11fd..8e4b357232918bd144830fa3bc02dd23a562ddf9 100644 (file)
@@ -114,6 +114,7 @@ Gourlay_breaking::solve ()
 
          Column_x_positions cp = get_line_configuration (line, line_dims[RIGHT] - line_dims[LEFT],
                                                          line_dims[LEFT], ragged);
+
          if (ragged && last_line)
            cp.force_ = 0.0;
 
index 47e8080ced6cb9b122e04210d3f7641da26ccb5f..39d9a3f853062cfd3eab5f0654fddd30f9e01fd2 100644 (file)
@@ -45,11 +45,11 @@ public:
   void add_spring (Real, Real);
   Real range_ideal_len (int l, int r) const;
   Real range_stiffness (int l, int r) const;
-  Real configuration_length () const;
+  Real configuration_length (Real) const;
   vector<Real> spring_positions () const;
 
-  Real force ();
-  bool fits ();
+  Real force () const;
+  bool fits () const;
 
   DECLARE_SIMPLE_SMOBS (Simple_spacer,);
 
index 86bacecf4826c557f35d1ba5fb6dac57522e89bc..214d1c2e676697ce5e3c0984035f6d7281d0260e 100644 (file)
@@ -171,7 +171,7 @@ Sequential_iterator::next_element (bool)
        in that chunk should be in len.grace_part_
 
       */
-      last_mom_ = here_mom_;;
+      last_mom_ = here_mom_;
       here_mom_ += len;
     }
 
index e027b5e26ad85a387f2e0181ac902d444dbe729c..3532c03606a1d7a33adccdf639ca598157274082 100644 (file)
 
 Simple_spacer::Simple_spacer ()
 {
-  force_ = 0.;
+  line_len_ = 0.0;
+  force_ = 0.0;
   fits_ = true;
+  ragged_ = true;
 }
 
 Real
-Simple_spacer::force ()
+Simple_spacer::force () const
 {
   return force_;
 }
 
 bool
-Simple_spacer::fits ()
+Simple_spacer::fits () const
 {
   return fits_;
 }
@@ -129,11 +131,11 @@ Simple_spacer::range_stiffness (int l, int r) const
 }
 
 Real
-Simple_spacer::configuration_length () const
+Simple_spacer::configuration_length (Real force) const
 {
   Real l = 0.;
   for (vsize i = 0; i < springs_.size (); i++)
-    l += springs_[i].length (force_);
+    l += springs_[i].length (force);
 
   return l;
 }
@@ -141,14 +143,14 @@ Simple_spacer::configuration_length () const
 void
 Simple_spacer::solve (Real line_len, bool ragged)
 {
-  Real conf = configuration_length ();
+  Real conf = configuration_length (force_);
 
   ragged_ = ragged;
   line_len_ = line_len;
   if (ragged)
     {
       force_ = 0;
-      fits_ = configuration_length () <= line_len_;
+      fits_ = configuration_length (force_) <= line_len_;
       /* we need to calculate a force here to prevent a bunch of short lines */
       if (fits_)
        force_ = expand_line ();
@@ -163,7 +165,7 @@ Real
 Simple_spacer::expand_line ()
 {
   double inv_hooke = 0;
-  double cur_len = configuration_length ();
+  double cur_len = configuration_length (force_);
 
   fits_ = true;
   for (vsize i=0; i < springs_.size (); i++)
@@ -177,7 +179,7 @@ Real
 Simple_spacer::compress_line ()
 {
   double inv_hooke = 0;
-  double cur_len = configuration_length ();
+  double cur_len = configuration_length (force_);
   double cur_force = force_;
 
   fits_ = true;
@@ -197,8 +199,18 @@ Simple_spacer::compress_line ()
        break;
 
       double block_dist = (cur_force - sp.block_force_) * inv_hooke;
-      if (cur_len - block_dist <= line_len_)
-       return cur_force + (line_len_ - cur_len) / inv_hooke;
+      if (cur_len - block_dist < line_len_)
+       {
+        cur_force += (line_len_ - cur_len) / inv_hooke;
+        cur_len = line_len_;
+
+        /*
+          Paranoia check.
+         */
+        assert (fabs (configuration_length (cur_force) - cur_len) < 1e-6);
+        return cur_force;
+       }
+      
       cur_len -= block_dist;
       inv_hooke -= sp.inverse_hooke_;
       cur_force = sp.block_force_;
@@ -254,7 +266,9 @@ Spring_description::is_sane () const
 {
   return (inverse_hooke_ >= 0)
     && ideal_ > 0
-    && !isinf (ideal_) && !isnan (ideal_);
+    && !isinf (ideal_) && !isnan (ideal_)
+    && (inverse_hooke_ == 0.0 || fabs (inverse_hooke_) > 1e-8)
+    ;
 }
 
 Real
@@ -489,7 +503,7 @@ get_line_forces (vector<Grob*> const &icols, vector<vsize> breaks,
 }
 
 Column_x_positions
-get_line_configuration (vector<Grob*>const &columns,
+get_line_configuration (vector<Grob*> const &columns,
                        Real line_len,
                        Real indent,
                        bool ragged)
@@ -508,13 +522,11 @@ get_line_configuration (vector<Grob*>const &columns,
     }
   ret.cols_.push_back (dynamic_cast<Item*> (columns.back ())->find_prebroken_piece (LEFT));
 
-  cols.resize (ret.cols_.size () - 1);
-
   /* since we've already put our line-ending column in the column list, we can ignore
      the end_XXX_ fields of our column_description */
-  for (vsize i = 0; i < cols.size (); i++)
+  for (vsize i = 0; i < ret.cols_.size () - 1; i++)
     {
-      cols[i] = get_column_description (ret.cols_, i, i == 0);
+      cols.push_back (get_column_description (ret.cols_, i, i == 0));
       spacer.add_spring (cols[i].ideal_, cols[i].inverse_hooke_);
     }
   for (vsize i = 0; i < cols.size (); i++)
index 5aca1009612d5ffd9a3ac2fc80147a9faaad8000..9c48aaec0a0a384413db2d6e35ada1cd3af3e549 100644 (file)
@@ -332,8 +332,21 @@ Spacing_spanner::musical_column_spacing (Grob *me,
 
       if (compound_note_space < 0 || wish_count == 0)
        {
+         /*
+           Fixed should be 0.0. If there are no spacing wishes, we're
+           likely dealing with polyphonic spacing of hemiolas.
+           
+           We used to have compound_fixed_note_space = options->increment_
+
+           but this can lead to numeric instability problems when we
+           do
+           
+              inverse_strength = (compound_note_space - compound_fixed_note_space)
+      
+         */
+         
          compound_note_space = base_note_space;
-         compound_fixed_note_space = options->increment_;
+         compound_fixed_note_space = 0.0;
        }
       else if (to_boolean (me->get_property ("average-spacing-wishes")))
        {
index 1d42902a4fd32d81386f8e4ac2d7814feb80b21c..dada24694cb14f1f0c0673f61ed8e2f546bc29ca 100644 (file)
@@ -885,7 +885,6 @@ Tie_formatting_problem::find_best_variation (Ties_configuration const &base,
 Ties_configuration
 Tie_formatting_problem::generate_optimal_chord_configuration ()
 {
-  
   Ties_configuration base = generate_base_chord_configuration ();
   vector<Tie_configuration_variation> vars = generate_collision_variations (base);
   
index e0f28e82a6a21e9b9918409a81bd5c0c255858af..8864569af1a0b191e04ecf0a500cefc76b214f99 100644 (file)
@@ -7,29 +7,6 @@
 
 % TODO: use dicts or prefixes to prevent namespace pollution.
 
-% Emulation code from Postscript Language Reference.
-
-/*SF
-{
-       exch findfont exch
-       dup type /arraytype eq
-               {makefont}
-               {scalefont}
-       ifelse
-       setfont
-} bind def
-
-/languagelevel where
-       {pop languagelevel}
-       {1}
-ifelse
-
-2 lt
-       { /selectfont /*SF load def }
-if
-
-% end emulation code
-
 /pdfmark where
 {pop} {userdict /pdfmark /cleartomark load put} ifelse
 
index ea450708dee6a1adb46f188b9791a0fe49ae5e34..a32979b529bd14d9aca4e972c94ef355ee4ad3b1 100644 (file)
        "page-width output-scale lily-output-units mul mul 0 translate 90 rotate\n"
        "")
     "%%EndPageSetup\n"
-
+    
+    "true setstrokeadjust\n"
     "gsave 0 paper-height translate "
     "set-ps-scale-to-lily-scale "
     "\n"))