]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/slur-configuration.cc (fit_factor): oops, skip point if
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 22 Feb 2006 13:26:44 +0000 (13:26 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 22 Feb 2006 13:26:44 +0000 (13:26 +0000)
intersection gets smaller. This fixes slurs over extreme points.

* lily/melody-engraver.cc (stop_translation_timestep): ignore
stems with neutral-direction set.

* lily/piano-pedal-engraver.cc (create_text_grobs): idem.

* lily/open-type-font.cc (load_table): format error.

* lily/change-iterator.cc (process): format fix.

* flower/include/international.hh (_f): idem.

* flower/include/std-string.hh: add format printf attribute.

* scm/define-grobs.scm (all-grob-descriptions): height of all
PedalLineSpanner is Y-extent property. Fixes pedal-ped.ly

20 files changed:
ChangeLog
flower/include/international.hh
flower/include/std-string.hh
lily/change-iterator.cc
lily/context-def.cc
lily/include/misc.hh
lily/include/slur-configuration.hh
lily/include/slur-score-parameters.hh [new file with mode: 0644]
lily/include/slur-scoring.hh
lily/melody-engraver.cc
lily/misc.cc
lily/open-type-font.cc
lily/piano-pedal-engraver.cc
lily/slur-configuration.cc
lily/slur-score-parameters.cc [new file with mode: 0644]
lily/slur-scoring.cc
lily/slur.cc
lily/tie-formatting-problem.cc
scm/define-grobs.scm
scm/layout-slur.scm

index 80515e582902e963f9513a6b202677762935c307..a3e60e6b1a9b6715be7221cad6265f5fe81a0a94 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,24 @@
 2006-02-22  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * lily/slur-configuration.cc (fit_factor): oops, skip point if
+       intersection gets smaller. This fixes slurs over extreme points.
+
+       * lily/melody-engraver.cc (stop_translation_timestep): ignore
+       stems with neutral-direction set.
+
+       * lily/piano-pedal-engraver.cc (create_text_grobs): idem.
+
+       * lily/open-type-font.cc (load_table): format error.
+
+       * lily/change-iterator.cc (process): format fix.
+
+       * flower/include/international.hh (_f): idem.
+
+       * flower/include/std-string.hh: add format printf attribute.
+
+       * scm/define-grobs.scm (all-grob-descriptions): height of all
+       PedalLineSpanner is Y-extent property. Fixes pedal-ped.ly
+
        * lily/ambitus-engraver.cc (finalize): use grob_array. This fixes
        ambitus lines.
 
index 1b29c45fa973beb218cab8f209e6a6365dbb39bf..d1c71ed08b15f3be19d5970f132a76d9a0dad2c6 100644 (file)
@@ -28,7 +28,8 @@ string _ (char const *ch);
    Internationalisation: _f ("Usage: %s [FILE]", "lilypond") gets "translated" by
    GNU gettext
 */
-string _f (char const *format, ...);
+string _f (char const *format, ...)
+          __attribute__ ((format (printf, 1, 2)));
 string _f (char const *format, string s, string s2 = "", string s3 = "");
 
 #endif // INTERNATIONAL_HH
index d9552b4820290062876fb8d38f1e493af84e9c30..bc2fd61ee5f75bd90ccbd02692b7514aa72ac006 100644 (file)
@@ -26,7 +26,8 @@ string to_string (long);
 string to_string (long unsigned);
 string to_string (unsigned);
 string to_string (bool b);
-string to_string (char const *format, ...);
+string to_string (char const *format, ...)
+  __attribute__ ((format (printf, 1, 2)));
   
 string &replace_all (string &str, string find, string replace);
 string &replace_all (string &str, char find, char replace);
index 43631687c88c5594d580cde15daeee852b710955..aef7567be0f74e1390b96c55e3b0438b6525b3ba 100644 (file)
@@ -88,7 +88,7 @@ Change_iterator::process (Moment m)
 
           last->translator_id_string () = get_change
           ()->change_to_id_string (); */
-       error (_f ("not changing to same context type: %s", to_type));
+       error (_f ("not changing to same context type: %s", ly_symbol2string (to_type).c_str ()));
       }
   else
     /* FIXME: uncomprehensable message */
index d8349f4d97ad3a2fad5f9a0668bb14e82449e369..d77b075322ed0433ac17a367f4ffcde327a8f5e1 100644 (file)
@@ -308,7 +308,7 @@ Context_def::instantiate (SCM ops, Object_key const *key)
     {
       Translator *t = get_translator (scm_car (s));
       if (!t)
-       warning (_f ("can't find: `%s'", s));
+       warning (_f ("can't find: `%s'", ly_symbol2string (scm_car (s)).c_str ()));
       else
        {
          Translator *tr = t->clone ();
index be9b2c4f2c51c7ca1ac07c3665f394937cac00ce..4303d3b7b59e9f7ef7054a30143f3db173e73d3f 100644 (file)
@@ -37,5 +37,6 @@ linear_interpolate (Real x, Real x1, Real x2, Real y1, Real y2)
 
 Real directed_round (Real f, Direction d);
 
+Real peak_around (Real epsilon,  Real threshold, Real x);
 #endif
 
index f9ebea2a7de9a956fb78ca26ae53c234c825b6ea..b1b9f9a6e55033009f86c9f6b63a63252a2ce5d7 100644 (file)
 
 class Slur_configuration
 {
+  Real score_;
+  string score_card_;
+
 public:
   Drul_array<Offset> attachment_;
-  Real score_;
   Bezier curve_;
   Real height_;
 
   int index_;
 
-  string score_card_;
-
   Slur_configuration ();
 
+  Real score () const { return score_; }
+  string card () const { return score_card_; } 
+  void add_score (Real, string);
+  
   void generate_curve (Slur_score_state const &state, Real r0, Real h_inf,
                       vector<Offset> const &);
-  void score (Slur_score_state const &);
+  void calculate_score (Slur_score_state const &);
 protected:
   void score_extra_encompass (Slur_score_state const &);
   void score_slopes (Slur_score_state const &);
diff --git a/lily/include/slur-score-parameters.hh b/lily/include/slur-score-parameters.hh
new file mode 100644 (file)
index 0000000..5ae1407
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+  slur-score-paramaters.hh -- declare Slur_score_parameters
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
+#ifndef SLUR_SCORE_PARAMATERS_HH
+#define SLUR_SCORE_PARAMATERS_HH
+
+#include "lily-proto.hh"
+
+struct Slur_score_parameters
+{
+  int region_size_;
+  Real head_encompass_penalty_;
+  Real stem_encompass_penalty_;
+  Real closeness_factor_;
+  Real edge_attraction_factor_;
+  Real same_slope_penalty_;
+  Real steeper_slope_factor_;
+  Real non_horizontal_penalty_;
+  Real max_slope_;
+  Real max_slope_factor_;
+  Real extra_object_collision_penalty_;
+  Real accidental_collision_;
+  Real free_slur_distance_;
+  Real free_head_distance_;
+  Real extra_encompass_free_distance_;
+  Real absolute_closeness_measure_;
+  Real edge_slope_exponent_;
+  Real head_slur_distance_max_ratio_;
+  Real head_slur_distance_factor_;
+
+  void fill (Grob *him);
+};
+#endif /* SLUR_SCORE_PARAMATERS_HH */
index 0164116a148cee6cb629d4558a3ed6633231455c..4668c584895542b8b3ee5d612e2f0c7bb7f867ff 100644 (file)
 #include "lily-proto.hh"
 #include "std-vector.hh"
 #include "lily-guile.hh"
-
-struct Slur_score_parameters
-{
-  int region_size_;
-  Real head_encompass_penalty_;
-  Real stem_encompass_penalty_;
-  Real closeness_factor_;
-  Real edge_attraction_factor_;
-  Real same_slope_penalty_;
-  Real steeper_slope_factor_;
-  Real non_horizontal_penalty_;
-  Real max_slope_;
-  Real max_slope_factor_;
-  Real extra_object_collision_penalty_;
-  Real accidental_collision_;
-  Real free_slur_distance_;
-  Real free_head_distance_;
-  Real extra_encompass_free_distance_;
-  Real absolute_closeness_measure_;
-  Real edge_slope_exponent_;
-  Real head_slur_distance_max_ratio_;
-  Real head_slur_distance_factor_;
-
-  void fill (Grob *him);
-};
+#include "slur-score-parameters.hh"
 
 struct Extra_collision_info
 {
index 86e637ca3687ee79754fbbb6f5158b50bf416dec..ee0e07c9b9d1639ce196577a02c265a7e7b4a75d 100644 (file)
@@ -43,7 +43,8 @@ Melody_engraver::process_music ()
 void
 Melody_engraver::stop_translation_timestep ()
 {
-  if (stem_)
+  if (stem_
+      && !is_direction (stem_->get_property_data (ly_symbol2scm  ("neutral-direction"))))
     {
       extract_grob_set (stem_, "rests", rests);
       if (rests.size ())
index 54da3d0f5566a035e3d804655cc3f79f90f985f8..e7c3063df234c6ce79bca6185bf9358e837e401b 100644 (file)
@@ -43,3 +43,15 @@ directed_round (Real f, Direction d)
     return ceil (f);
 }
 
+
+
+/*
+   0 at threshold,  1 at 0, with 1/x falloff.
+ */
+Real
+peak_around (Real epsilon,  Real threshold, Real x)
+{
+  if (x < 0)
+    return 1.0;
+  return max (- epsilon * (x - threshold) / ((x + epsilon)  * threshold), 0.0);
+}
index 73395fb9cbeacf40addb2d5c31c1444523b0a065..8e50a1a576b4ee385af3bb43ccd9864d6407d8bc 100644 (file)
@@ -30,7 +30,7 @@ load_table (char const *tag_str, FT_Face face, FT_ULong *length)
     {
       FT_Byte *buffer = (FT_Byte *) malloc (*length);
       if (buffer == NULL)
-       error (_f ("can't allocate %d bytes", *length));
+       error (_f ("can't allocate %lu bytes", *length));
 
       error_code = FT_Load_Sfnt_Table (face, tag, 0, buffer, length);
       if (error_code)
index 86e0e032e92144d6c83bb92d73591917f17ddfc3..2d380fb3522699deece022a6c24e6c0ce4fba6ab 100644 (file)
@@ -220,7 +220,7 @@ Piano_pedal_engraver::create_text_grobs (Pedal_info *p, bool mixed)
       Music *m = p->event_drul_[START];
       if (!m) m = p->event_drul_ [STOP];
 
-      string msg = _f ("expect 3 strings for piano pedals, found: %d",
+      string msg = _f ("expect 3 strings for piano pedals, found: %ld",
                       scm_ilength (strings));
       if (m)
        m->origin ()->warning (msg);
@@ -511,16 +511,31 @@ Piano_pedal_engraver::typeset_all (Pedal_info *p)
 }
 
 #include "translator.icc"
+
 ADD_ACKNOWLEDGER (Piano_pedal_engraver, note_column);
+
 ADD_TRANSLATOR (Piano_pedal_engraver,
-               /* doc */ "Engrave piano pedal symbols and brackets.",
-               /* create */ "SostenutoPedal SustainPedal UnaCordaPedal SostenutoPedalLineSpanner SustainPedalLineSpanner UnaCordaPedalLineSpanner",
-               /* accept */ "pedal-event",
-               /* read */ "currentCommandColumn "
+
+               /* doc */
+               "Engrave piano pedal symbols and brackets.",
+
+               /* create */
+               "SostenutoPedal "
+               "SostenutoPedalLineSpanner "
+               "SustainPedal "
+               "SustainPedalLineSpanner "
+               "UnaCordaPedal "
+               "UnaCordaPedalLineSpanner ",
+
+               /* accept */
+               "pedal-event",
+
+               /* read */
+               "currentCommandColumn "
                "pedalSostenutoStrings "
-               "pedalSustainStrings "
-               "pedalUnaCordaStrings "
                "pedalSostenutoStyle "
+               "pedalSustainStrings "
                "pedalSustainStyle "
+               "pedalUnaCordaStrings "
                "pedalUnaCordaStyle",
                /* write */ "");
index 29b9844863ea73f376be283fb74ca013ec69d36f..d846b9d6159a8a429daf9e838746d5455282e18e 100644 (file)
@@ -85,7 +85,7 @@ fit_factor (Offset dz_unit, Offset dz_perp,
       Real eps = 0.01;
       Interval pext = eps * Interval (-1,1) + p[X_AXIS];
       pext.intersect (curve_xext);
-      if (pext.is_empty () || pext.length () <= 2.1* eps)
+      if (pext.is_empty () || pext.length () <= 1.999 * eps)
        continue;
 
       Real y = curve.get_other_coordinate (X_AXIS, p[X_AXIS]);
@@ -170,6 +170,17 @@ Slur_configuration::Slur_configuration ()
   index_ = -1;
 };
 
+
+void
+Slur_configuration::add_score (Real s, string desc)
+{
+  if (s)
+    {
+      score_card_ += to_string ("%s=%.2f ", desc.c_str (), s);
+      score_ += s;
+    }
+}
+
 void
 Slur_configuration::score_encompass (Slur_score_state const &state)
 {
@@ -251,9 +262,8 @@ Slur_configuration::score_encompass (Slur_score_state const &state)
            / state.encompass_infos_.size ();
        }
     }
-
-  Real variance_penalty = 0.0;
-
+  add_score (demerit, "encompass");
+  
   if (convex_head_distances.size ())
     {
       Real avg_distance = 0.0;
@@ -281,27 +291,21 @@ Slur_configuration::score_encompass (Slur_score_state const &state)
        as penalty.
       */
       avg_distance /= n;
-      variance_penalty = state.parameters_.head_slur_distance_max_ratio_;
+      Real variance_penalty = state.parameters_.head_slur_distance_max_ratio_;
       if (min_dist > 0.0)
        variance_penalty
          = min ((avg_distance / (min_dist + state.parameters_.absolute_closeness_measure_) - 1.0), variance_penalty);
 
       variance_penalty = max (variance_penalty, 0.0);
       variance_penalty *= state.parameters_.head_slur_distance_factor_;
-    }
-
-#if DEBUG_SLUR_SCORING
-  score_card_ += to_string ("C%.2f", demerit);
-  score_card_ += to_string ("D%.2f", variance_penalty);
-#endif
 
-  score_ += demerit + variance_penalty;
+      add_score (variance_penalty, "variance");
+    }
 }
 
 void
 Slur_configuration::score_extra_encompass (Slur_score_state const &state)
 {
-  Real demerit = 0.0;
   for (vsize j = 0; j < state.extra_encompass_infos_.size (); j++)
     {
       Drul_array<Offset> attachment = attachment_;
@@ -363,20 +367,14 @@ Slur_configuration::score_extra_encompass (Slur_score_state const &state)
       else
        programming_error ("unknown avoidance type");
 
-      Real epsilon = 0.1;
-      Real factor
-       = (1.0 / (max (dist, 0.0) + epsilon * state.parameters_.extra_encompass_free_distance_));
-      Real threshold 
-       = 1.0 / ((1 + epsilon) * state.parameters_.extra_encompass_free_distance_);
+      dist = max (dist, 0.0);
       
-      demerit
-       += max (info.penalty_ * (factor - threshold), 0.0);
+      Real penalty = info.penalty_ * peak_around (0.1 * state.parameters_.extra_encompass_free_distance_,
+                                                 state.parameters_.extra_encompass_free_distance_,
+                                                 dist);
+      
+      add_score (penalty, "extra");
     }
-#if DEBUG_SLUR_SCORING
-  score_card_ += to_string ("X%.2f", demerit);
-#endif
-  
-  score_ += demerit;
 }
 
 void
@@ -401,10 +399,7 @@ Slur_configuration::score_edges (Slur_score_state const &state)
       demerit *= exp (state.dir_ * d * slope
                      * state.parameters_.edge_slope_exponent_);
 
-      score_ += demerit;
-#if DEBUG_SLUR_SCORING
-      score_card_ += to_string ("E%.2f", demerit);
-#endif
+      add_score (demerit, "edge");
     }
   while (flip (&d) != LEFT);
 }
@@ -447,14 +442,11 @@ Slur_configuration ::score_slopes (Slur_score_state const &state)
       ? state.parameters_.same_slope_penalty_ / 10
       : state.parameters_.same_slope_penalty_;
 
-#if DEBUG_SLUR_SCORING
-  score_card_ += to_string ("S%.2f", demerit);
-#endif
-  score_ += demerit;
+  add_score (demerit, "slope");
 }
 
 void
-Slur_configuration::score (Slur_score_state const &state)
+Slur_configuration::calculate_score (Slur_score_state const &state)
 {
   score_extra_encompass (state);
   score_slopes (state);
diff --git a/lily/slur-score-parameters.cc b/lily/slur-score-parameters.cc
new file mode 100644 (file)
index 0000000..84a3d1c
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+  slur-score-paramaters.cc -- implement Slur_score_parameters
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
+
+#include "slur-score-parameters.hh"
+#include "grob.hh"
+
+
+Real
+get_detail (SCM alist, SCM sym)
+{
+  SCM entry = scm_assq (sym, alist);
+  return robust_scm2double (scm_is_pair (entry)
+                           ? scm_cdr (entry)
+                           : SCM_EOL,
+                           0.0);
+}
+
+void
+Slur_score_parameters::fill (Grob *me)
+{
+  SCM details = me->get_property ("details");
+
+  region_size_
+    = (int) get_detail (details, ly_symbol2scm ("region-size"));
+  head_encompass_penalty_
+    = get_detail (details, ly_symbol2scm ("head-encompass-penalty"));
+  stem_encompass_penalty_
+    = get_detail (details, ly_symbol2scm ("stem-encompass-penalty"));
+  closeness_factor_
+    = get_detail (details, ly_symbol2scm ("closeness-factor"));
+  edge_attraction_factor_
+    = get_detail (details, ly_symbol2scm ("edge-attraction-factor"));
+  same_slope_penalty_
+    = get_detail (details, ly_symbol2scm ("same-slope-penalty"));
+  steeper_slope_factor_
+    = get_detail (details, ly_symbol2scm ("steeper-slope-factor"));
+  non_horizontal_penalty_
+    = get_detail (details, ly_symbol2scm ("non-horizontal-penalty"));
+  max_slope_
+    = get_detail (details, ly_symbol2scm ("max-slope"));
+  max_slope_factor_
+    = get_detail (details, ly_symbol2scm ("max-slope-factor"));
+  free_head_distance_
+    = get_detail (details, ly_symbol2scm ("free-head-distance"));
+  absolute_closeness_measure_
+    = get_detail (details, ly_symbol2scm ("absolute-closeness-measure"));
+  extra_object_collision_penalty_
+    = get_detail (details, ly_symbol2scm ("extra-object-collision-penalty"));
+  accidental_collision_
+    = get_detail (details, ly_symbol2scm ("accidental-collision"));
+  extra_encompass_free_distance_
+    = get_detail (details, ly_symbol2scm ("extra-encompass-free-distance"));
+  head_slur_distance_factor_
+    = get_detail (details, ly_symbol2scm ("head-slur-distance-factor"));
+  head_slur_distance_max_ratio_
+    = get_detail (details, ly_symbol2scm ("head-slur-distance-max-ratio"));
+  free_slur_distance_
+    = get_detail (details, ly_symbol2scm ("free-slur-distance"));
+  edge_slope_exponent_
+    = get_detail (details, ly_symbol2scm ("edge-slope-exponent"));
+}
index 2e3510f86afe978730c62c14007c7edfe8746a9a..77a5a22c0f39903fdac5a94d01de7480ca38a925 100644 (file)
@@ -9,22 +9,24 @@
 
 
 #include "slur-scoring.hh"
-#include "libc-extension.hh"
-#include "slur-configuration.hh"
+
+#include "accidental-interface.hh"
 #include "beam.hh"
 #include "directional-element-interface.hh"
-#include "pointer-group-interface.hh"
-#include "slur.hh"
+#include "libc-extension.hh"
+#include "main.hh"
 #include "note-column.hh"
 #include "output-def.hh"
+#include "paper-column.hh"
 #include "pitch.hh"
+#include "pointer-group-interface.hh"
+#include "slur-configuration.hh"
+#include "slur.hh"
 #include "spanner.hh"
 #include "staff-symbol-referencer.hh"
 #include "staff-symbol.hh"
 #include "stem.hh"
 #include "warn.hh"
-#include "paper-column.hh"
-#include "accidental-interface.hh"
 
 /*
   TODO:
@@ -64,61 +66,6 @@ Slur_score_state::~Slur_score_state ()
   junk_pointers (configurations_);
 }
 
-Real
-get_detail (SCM alist, SCM sym)
-{
-  SCM entry = scm_assq (sym, alist);
-  return robust_scm2double (scm_is_pair (entry)
-                           ? scm_cdr (entry)
-                           : SCM_EOL,
-                           0.0);
-}
-
-void
-Slur_score_parameters::fill (Grob *me)
-{
-  SCM details = me->get_property ("details");
-
-  region_size_
-    = (int) get_detail (details, ly_symbol2scm ("region-size"));
-  head_encompass_penalty_
-    = get_detail (details, ly_symbol2scm ("head-encompass-penalty"));
-  stem_encompass_penalty_
-    = get_detail (details, ly_symbol2scm ("stem-encompass-penalty"));
-  closeness_factor_
-    = get_detail (details, ly_symbol2scm ("closeness-factor"));
-  edge_attraction_factor_
-    = get_detail (details, ly_symbol2scm ("edge-attraction-factor"));
-  same_slope_penalty_
-    = get_detail (details, ly_symbol2scm ("same-slope-penalty"));
-  steeper_slope_factor_
-    = get_detail (details, ly_symbol2scm ("steeper-slope-factor"));
-  non_horizontal_penalty_
-    = get_detail (details, ly_symbol2scm ("non-horizontal-penalty"));
-  max_slope_
-    = get_detail (details, ly_symbol2scm ("max-slope"));
-  max_slope_factor_
-    = get_detail (details, ly_symbol2scm ("max-slope-factor"));
-  free_head_distance_
-    = get_detail (details, ly_symbol2scm ("free-head-distance"));
-  absolute_closeness_measure_
-    = get_detail (details, ly_symbol2scm ("absolute-closeness-measure"));
-  extra_object_collision_penalty_
-    = get_detail (details, ly_symbol2scm ("extra-object-collision-penalty"));
-  accidental_collision_
-    = get_detail (details, ly_symbol2scm ("accidental-collision"));
-  extra_encompass_free_distance_
-    = get_detail (details, ly_symbol2scm ("extra-encompass-free-distance"));
-  head_slur_distance_factor_
-    = get_detail (details, ly_symbol2scm ("head-slur-distance-factor"));
-  head_slur_distance_max_ratio_
-    = get_detail (details, ly_symbol2scm ("head-slur-distance-max-ratio"));
-  free_slur_distance_
-    = get_detail (details, ly_symbol2scm ("free-slur-distance"));
-  edge_slope_exponent_
-    = get_detail (details, ly_symbol2scm ("edge-slope-exponent"));
-}
-
 Real
 broken_trend_y (Slur_score_state const &state, Direction hdir)
 {
@@ -404,46 +351,49 @@ Slur_score_state::get_best_curve ()
   Real opt = 1e6;
 
 #if DEBUG_SLUR_SCORING
+  bool debug_slurs = to_boolean (slur_->layout ()
+                                ->lookup_variable (ly_symbol2scm ("debug-slur-scoring")));
   SCM inspect_quants = slur_->get_property ("inspect-quants");
-  if (to_boolean (slur_->layout ()
-                 ->lookup_variable (ly_symbol2scm ("debug-slur-scoring")))
+  if (debug_slurs
       && scm_is_pair (inspect_quants))
     {
       opt_idx = get_closest_index (inspect_quants);
-      configurations_[opt_idx]->score (*this);
-      opt = configurations_[opt_idx]->score_;
+      configurations_[opt_idx]->calculate_score (*this);
+      opt = configurations_[opt_idx]->score ();
     }
   else
 #endif
     {
       for (vsize i = 0; i < configurations_.size (); i++)
-       configurations_[i]->score (*this);
+       configurations_[i]->calculate_score (*this);
       for (vsize i = 0; i < configurations_.size (); i++)
        {
-         if (configurations_[i]->score_ < opt)
+         if (configurations_[i]->score () < opt)
            {
-             opt = configurations_[i]->score_;
+             opt = configurations_[i]->score ();
              opt_idx = i;
            }
        }
     }
 
 #if DEBUG_SLUR_SCORING
-  if (opt_idx >= 0)
-    {
-      configurations_[opt_idx]->score_card_ += to_string ("=%.2f", opt);
-      configurations_[opt_idx]->score_card_ += to_string ("i%d", opt_idx);
-    }
-  else
+  if (debug_slurs)
     {
-      programming_error ("No optimal slur found. Guessing 0.");
-      opt_idx = 0;
-    }
+      string total;
+      if (opt_idx >= 0)
+       {
+         total = configurations_[opt_idx]->card ();
+         total += to_string ("TOTAL=%.2f idx=%d", configurations_[opt_idx]->score (), opt_idx); 
+       }
+      else
+       {
+         programming_error ("No optimal slur found. Guessing 0.");
+         total = "no sol?";
+       }
   
-  // debug quanting
-  slur_->set_property ("quant-score",
-                      scm_makfrom0str (configurations_[opt_idx]->score_card_.c_str ()));
-
+      slur_->set_property ("quant-score",
+                          scm_makfrom0str (total.c_str ()));
+    }
 #endif
 
   return configurations_[opt_idx]->curve_;
@@ -796,7 +746,7 @@ Slur_score_state::get_extra_encompass_infos () const
 
          for (int k = 0; k < 3; k++)
            {
-             Direction hdir = Direction (k / 2 - 1);
+             Direction hdir = Direction (k - 1);
 
              /*
                Only take bound into account if small slur starts
@@ -815,7 +765,7 @@ Slur_score_state::get_extra_encompass_infos () const
              Interval xext (-1, 1);
              xext = xext * (thickness_ * 2) + z[X_AXIS];
              Extra_collision_info info (small_slur,
-                                        k - 1.0,
+                                        hdir,
                                         xext,
                                         yext,
                                         parameters_.extra_object_collision_penalty_);
index 2a5518c2c6edb480fe106fb4cd8ac064c536f01a..905c158697b3ad8d6cbf4d6dea6b13e05647854d 100644 (file)
@@ -115,6 +115,8 @@ Slur::print (SCM smob)
       string str;
       SCM properties = Font_interface::text_font_alist_chain (me);
 
+      properties = scm_cons (scm_acons (ly_symbol2scm ("font-size"), scm_from_int (-6), SCM_EOL),
+                                properties);
       Stencil tm = *unsmob_stencil (Text_interface::interpret_markup
                                    (me->layout ()->self_scm (), properties,
                                     quant_score));
index 4fe618c92eefccf3c0767f761a63f635f0fe9070..7926652284619a936a3b9c5931517002c719009a 100644 (file)
@@ -13,6 +13,7 @@
 #include "directional-element-interface.hh"
 #include "item.hh"
 #include "libc-extension.hh"
+#include "misc.hh"
 #include "note-head.hh"
 #include "rhythmic-head.hh"
 #include "spanner.hh" 
 #include "tie.hh"
 #include "warn.hh"
 
-/*
-   0 at threshold,  1 at 0, with 1/x falloff.
- */
-Real peak_around (Real epsilon,  Real threshold, Real x)
-{
-  if (x < 0)
-    return 1.0;
-  return max (- epsilon * (x - threshold) / ((x + epsilon)  * threshold), 0.0);
-}
 
 void
 Tie_formatting_problem::print_ties_configuration (Ties_configuration const *ties)
index c99b2eedec1246b4e4cbe6cdffd2f77d93c7d504..077e06982eab997c1df0a0d0119158f139172592 100644 (file)
        (minimum-length . 1.5)
        (height-limit . 2.0)
        (ratio . 0.25)
+       (avoid-slur . inside)
        (meta . ((class . Spanner)
                 (interfaces . (slur-interface))))))
 
     (SostenutoPedalLineSpanner
      . (
        (axes . (1))
-       (X-extent . ,ly:axis-group-interface::height)
+       (Y-extent . ,ly:axis-group-interface::height)
        (Y-offset . ,ly:side-position-interface::y-aligned-side)
        (side-axis . ,Y)
+       (staff-padding . 1.0)
        (padding . 1.2)
        (minimum-space . 1.0)
        (direction . ,DOWN)
 
            ))
 
-
-       ;; default stem direction for note on middle line
-       (neutral-direction . ,DOWN)
-
        ;; We use the normal minima as minimum for the ideal lengths,
        ;; and the extreme minima as abolute minimum length.
 
     (SustainPedalLineSpanner
      . (
        (axes . (1))
-       (X-extent . ,ly:axis-group-interface::height)
+       (Y-extent . ,ly:axis-group-interface::height)
        (Y-offset . ,ly:side-position-interface::y-aligned-side)
        (side-axis . ,Y)
        (padding . 1.2)
     (UnaCordaPedalLineSpanner
      . (
        (axes . (1))
-       (X-extent . ,ly:axis-group-interface::height)
+       (Y-extent . ,ly:axis-group-interface::height)
        (Y-offset . ,ly:side-position-interface::y-aligned-side)
        (side-axis . ,Y)
        (padding . 1.2)
index 64dc4496fec8224b550649e63db11202cee2889b..95f717d566f5474e21872d6b6665b67c2e77642d 100644 (file)
@@ -20,7 +20,7 @@
     (free-slur-distance . 0.8)
     (extra-object-collision-penalty . 50)
     (accidental-collision . 3)
-    (extra-encompass-free-distance . 0.3)
+    (extra-encompass-free-distance . 0.8)
     (head-slur-distance-max-ratio . 3)
     (head-slur-distance-factor . 10)
     (absolute-closeness-measure . 0.3)