]> git.donarmstrong.com Git - lilypond.git/commitdiff
''
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 27 Apr 2002 23:02:01 +0000 (23:02 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 27 Apr 2002 23:02:01 +0000 (23:02 +0000)
ChangeLog
Documentation/user/refman.itely
Documentation/user/tutorial.itely
VERSION
lily/beam.cc
lily/box.cc
lily/font-size-engraver.cc
lily/include/box.hh
lily/include/group-interface.hh
lily/include/slur-bezier-bow.hh
lily/slur.cc

index eefb7c539b0364a70edafee1b75d18c85c89989f..2c9979a6c74a5eb48f0cc57739a42496701cbf6e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2002-04-27  Han-Wen  <hanwen@cs.uu.nl>
+
+       * lily/beam.cc: move scoring constants out of code
+
 2002-04-25  Han-Wen  <hanwen@cs.uu.nl>
 
        * mf/feta-nummer.mf: scalability fixes.
index 01b9b8b1e9751725f2f20d062b4ee0b6162dd4d2..139209c90dbe0a7ac514efc3f748eb1e467eb62f 100644 (file)
@@ -3597,19 +3597,25 @@ You may enter these dimension using units (@code{cm}, @code{in},
 @c .  {Font size}
 @node Font Size
 @subsection Font size
-@cindex font size
+@cindex font size, setting
+@cindex staff size, setting
+@cindex @code{paper} file
 
 The Feta font provides musical symbols at six different sizes.  These
-fonts are 11 point, 13 point, 16 point, 20 point,
-23 point, and 26 point.  The point size of a font is the
-height of the five lines in a staff when displayed in the font.
+fonts are 11 point, 13 point, 16 point, 20 point, 23 point, and 26
+point.  The point size of a font is the height of the five lines in a
+staff when displayed in the font.
 
 Definitions for these sizes are the files @file{paperSZ.ly}, where
 @code{SZ} is one of 11, 13, 16, 20, 23 and 26.  If you include any of
 these files, the identifiers @code{paperEleven}, @code{paperThirteen},
 @code{paperSixteen}, @code{paperTwenty}, @code{paperTwentythree}, and
 @code{paperTwentysix} are defined respectively.  The default
-@code{\paper} block is also set.
+@code{\paper} block is also set. These files should be imported at toplevel, i.e.
+@example
+       \include "paper26.ly"
+       \score @{  ... @}
+@end example
 
 The font definitions are generated using a Scheme function. For more
 details, see the file @file{scm/font.scm}.
index 41c7d7f7a5cbbff2998cfd83ddd72a365c5ef48b..62cb86775f3fcb49f01191ad98c06002027f8e2c 100644 (file)
@@ -925,7 +925,9 @@ can also make longer comments by enclosing text in @code{%@{} and
 @end example
 @cindex @code{\include}
 @cindex point, printer's
-@cindex staff size setting 
+@cindex staff size, setting
+@cindex font size, setting
+
 By default, LilyPond will typeset the music in a size such that each
 staff is 20 point (0.7 cm, or 0.27 inch) high.  We want smaller output
 (16 point staff height), so we must import the settings for that size,
diff --git a/VERSION b/VERSION
index 7b73fcc3e12a47fb4d857d98260c2e5d6dce0602..fb964200e00165619506e057bddd7cd292d063be 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,7 +1,7 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=5
-PATCH_LEVEL=53
+PATCH_LEVEL=54
 MY_PATCH_LEVEL=uu1
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
index 8c360baede26e72566579fb2340910e5a642d24a..57ff7ff3f83d058783df5f3db9267f0ff96ecc8f 100644 (file)
@@ -25,6 +25,8 @@
   */
 
 
+
+
 #include <math.h> // tanh.
 
 #include "molecule.hh" 
 
 #define DEBUG_QUANTING 0
 
+const int INTER_QUANT_PENALTY = 1000; 
+const int SECONDARY_BEAM_DEMERIT  = 15;
+const int STEM_LENGTH_DEMERIT_FACTOR = 5;
+const int STEM_LENGTH_LIMIT_PENALTY = 500;
+const int DAMPING_DIRECTIION_PENALTY = 800;
+const int MUSICAL_DIRECTION_FACTOR = 400;
+const int IDEAL_SLOPE_FACTOR = 10;
+
 
 static Real
 shrink_extra_weight (Real x)
@@ -551,10 +561,10 @@ Beam::score_stem_lengths (Link_array<Grob>stems,
       Stem_info info = stem_infos[i];
       Direction d = Direction (directions[i]);
       
-      demerit_score += 500 * ( 0 >? (info.min_y - d * current_y));
-      demerit_score += 500 * ( 0 >? (d * current_y  - info.max_y));
+      demerit_score += STEM_LENGTH_LIMIT_PENALTY * ( 0 >? (info.min_y - d * current_y));
+      demerit_score += STEM_LENGTH_LIMIT_PENALTY * ( 0 >? (d * current_y  - info.max_y));
 
-      demerit_score += 5 * shrink_extra_weight (d * current_y  - info.ideal_y);
+      demerit_score += STEM_LENGTH_DEMERIT_FACTOR * shrink_extra_weight (d * current_y  - info.ideal_y);
     }
 
   demerit_score *= 2.0 / stems.size (); 
@@ -571,13 +581,13 @@ Beam::score_slopes_dy (Grob *me, Real yl, Real yr,
   Real dem = 0.0;
   if (sign (dy_damp) != sign (dy))
     {
-      dem += 800;
+      dem += DAMPING_DIRECTIION_PENALTY;
     }
-  
-   dem += 400* (0 >? (fabs (dy) - fabs (dy_mus)));
+
+   dem += MUSICAL_DIRECTION_FACTOR * (0 >? (fabs (dy) - fabs (dy_mus)));
   
 
-   dem += shrink_extra_weight (fabs (dy_damp) - fabs (dy))* 10;
+   dem += shrink_extra_weight (fabs (dy_damp) - fabs (dy))* IDEAL_SLOPE_FACTOR;
    return dem;
 }
 
@@ -599,9 +609,9 @@ Beam::score_forbidden_quants (Grob*me,
 
   Real dem = 0.0;
   if (fabs (yl) < rad && fabs ( my_modf (yl) - 0.5) < 1e-3)
-    dem += 1000;
+    dem += INTER_QUANT_PENALTY;
   if (fabs (yr) < rad && fabs ( my_modf (yr) - 0.5) < 1e-3)
-    dem += 1000;
+    dem += INTER_QUANT_PENALTY;
 
   // todo: use multiplicity of outer stems.
   if (multiplicity >= 2)
@@ -615,10 +625,10 @@ Beam::score_forbidden_quants (Grob*me,
       Direction dir = Directional_element_interface::get (me);
       if (fabs (yl - dir * interbeam) < rad
          && fabs (my_modf (yl) - inter) < 1e-3)
-       dem += 15;
+       dem += SECONDARY_BEAM_DEMERIT;
       if (fabs (yr - dir * interbeam) < rad
          && fabs (my_modf (yr) - inter) < 1e-3)
-       dem += 15;
+       dem += SECONDARY_BEAM_DEMERIT;
 
       Real eps = 1e-3;
 
@@ -630,28 +640,29 @@ Beam::score_forbidden_quants (Grob*me,
 
        --hwn
        */
-      
+
+
       // hmm, without Interval/Drul_array, you get ~ 4x same code...
       if (fabs (yl - dir * interbeam) < rad + inter)
        {
          if (dir == UP && dy <= eps
              && fabs (my_modf (yl) - sit) < eps)
-           dem += 15;
+           dem += SECONDARY_BEAM_DEMERIT;
          
          if (dir == DOWN && dy >= eps
              && fabs (my_modf (yl) - hang) < eps)
-           dem += 15;
+           dem += SECONDARY_BEAM_DEMERIT;
        }
 
       if (fabs (yr - dir * interbeam) < rad + inter)
        {
          if (dir == UP && dy >= eps
              && fabs (my_modf (yr) - sit) < eps)
-           dem += 15;
+           dem += SECONDARY_BEAM_DEMERIT;
          
          if (dir == DOWN && dy <= eps
              && fabs (my_modf (yr) - hang) < eps)
-           dem += 15;
+           dem += SECONDARY_BEAM_DEMERIT;
        }
       
       if (multiplicity >= 3)
@@ -660,22 +671,22 @@ Beam::score_forbidden_quants (Grob*me,
            {
              if (dir == UP && dy <= eps
                  && fabs (my_modf (yl) - straddle) < eps)
-               dem += 15;
+               dem += SECONDARY_BEAM_DEMERIT;
              
              if (dir == DOWN && dy >= eps
                  && fabs (my_modf (yl) - straddle) < eps)
-               dem += 15;
+               dem += SECONDARY_BEAM_DEMERIT;
        }
          
          if (fabs (yr - 2 * dir * interbeam) < rad + inter)
            {
              if (dir == UP && dy >= eps
                  && fabs (my_modf (yr) - straddle) < eps)
-               dem += 15;
+               dem += SECONDARY_BEAM_DEMERIT;
              
              if (dir == DOWN && dy <= eps
                  && fabs (my_modf (yr) - straddle) < eps)
-               dem += 15;
+               dem += SECONDARY_BEAM_DEMERIT;
            }
        }
     }
@@ -1176,7 +1187,15 @@ Beam::brew_molecule (SCM smob)
       dx = stems.top ()->relative_coordinate (0, X_AXIS) - x0;
     }
 
-  Interval pos = ly_scm2interval (me->get_grob_property ("positions"));
+  SCM posns = me->get_grob_property ("positions");
+  Interval pos;
+  if (!ly_number_pair_p (posns))
+    {
+      programming_error ("No beam posns");
+      pos = Interval (0,0);
+    }
+  else
+    pos= ly_scm2interval (posns);
   Real dy = pos.delta ();
   Real dydx = dy && dx ? dy/dx : 0;
 
index a74a6a7ad0fe9ec1d10a84fe87a2fe95bd458bb7..efed2217b57af21b1d870e0e11a95d90d44a17b8 100644 (file)
@@ -68,3 +68,10 @@ Box::add_point (Offset o)
   interval_a_[X_AXIS].add_point (o[X_AXIS]);
   interval_a_[Y_AXIS].add_point (o[Y_AXIS]);  
 }
+
+Offset
+Box::center () const
+{
+  return Offset (interval_a_[X_AXIS].center(),
+                interval_a_[Y_AXIS].center()); 
+}
index 863bc6bf11d01c9a60c2ed4adde50b1e99f51820..41874eeae3c3eb91ec354d207943b401fd240b00 100644 (file)
@@ -25,6 +25,10 @@ Font_size_engraver::Font_size_engraver ()
 
 }
 
+/*
+  TODO: use fontSize = NUMBER as a scaling constant: find the closest
+  integer design size, and use magnification to do the fractional bit.
+*/
 void
 Font_size_engraver::acknowledge_grob (Grob_info gi)
 {
index 8e7b57417b5cc2db3fd6bc64358244733ae0f841..cbdfc2da7aef9724821eb5a7ac37c313d051f153 100644 (file)
@@ -22,6 +22,8 @@ struct Box
   Interval y () const{return interval_a_[Y_AXIS]; }
   Interval operator[] (Axis a) const;
   Interval &operator[] (Axis a);
+
+  Offset center () const;
     
   void translate (Offset o);
   /// smallest box enclosing #b#
index 64476d0a0aefaabf0938f08d3585081577df6abb..5ee3a085e59d54f5ede1f9cf3fc9a70556013425 100644 (file)
@@ -38,6 +38,22 @@ public:
 /** 
   Put all score elements of ELT's property called NAME into an array,
   and return it.  */
+
+inline Link_array<Grob>
+list_to_grob_array (SCM l)
+{
+  Link_array<Grob> arr;
+
+  for (SCM s = l; gh_pair_p (s); s = gh_cdr (s))
+    {
+      SCM e = gh_car (s);
+      arr.push (unsmob_grob (e));
+    }
+
+  arr.reverse ();
+  return arr;
+}
+
 template<class T>
 Link_array<T>
 Pointer_group_interface__extract_grobs (Grob const *elt, T *, const char* name)
index 14e14eba7120ca5512045067c4ef46996421a852..f690b202fecfa3f4c63432b2910c0a5eccd6f8ff 100644 (file)
 
 class Slur_bezier_bow
 {
-
-protected:
   Array<Offset> encompass_;
 
-private:
   void to_canonical_form ();
   Direction dir_;
   Real alpha_;
   Offset origin_;
   Real h_inf_, r_0_;
+
 public:
+
   /**
      The canonical bezier.
    */
   Bezier curve_;
 
-
   Slur_bezier_bow (Array<Offset> encompass, Direction dir,
                   Real hinf, Real r0);
   Bezier get_bezier () const;
index b4439de631010ddadb65b8942fa8f1083bf30b21..4cc43ecf18cafa34eed221e09525caab83bd17e2 100644 (file)
@@ -93,6 +93,8 @@ Slur::de_uglyfy (Grob*me, Slur_bezier_bow* bb, Real default_height)
   bb->curve_.assert_sanity ();
 }
 
+
+
 Direction
 Slur::get_default_dir (Grob*me) 
 {
@@ -131,6 +133,7 @@ Slur::after_line_breaking (SCM smob)
 void
 Slur::check_slope (Grob *me)
 {
+
   /*
     Avoid too steep slurs.
    */
@@ -169,6 +172,7 @@ Slur::check_slope (Grob *me)
                                         ly_offset2scm (o[RIGHT])));
        }
     }
+
 }
 
 /*
@@ -278,6 +282,11 @@ Slur::broken_trend_offset (Grob *me, Direction dir)
   return o;
 }
 
+/*
+  COMMON is size-2 array with common refpoints.
+
+UGH: this routine delivers offsets which are *not* relative to COMMON.
+*/ 
 Offset
 Slur::get_attachment (Grob *me, Direction dir,
                      Grob **common) 
@@ -455,15 +464,7 @@ Slur::get_encompass_offset_arr (Grob *me)
   common[X_AXIS] = common[X_AXIS]->common_refpoint (sp->get_bound (RIGHT), X_AXIS);
   common[X_AXIS] = common[X_AXIS]->common_refpoint (sp->get_bound (LEFT), X_AXIS);
   
-  Link_array<Grob>  encompass_arr;
-  while (gh_pair_p (eltlist))
-    {
-      encompass_arr.push (unsmob_grob (ly_car (eltlist)));      
-      eltlist =ly_cdr (eltlist);
-    }
-  encompass_arr.reverse ();
-
-  
+  Link_array<Grob>  encompass_arr = list_to_grob_array (eltlist);
   Array<Offset> offset_arr;
 
   Offset origin (me->relative_coordinate (common[X_AXIS], X_AXIS),
@@ -578,6 +579,7 @@ Slur::set_control_points (Grob*me)
                      Directional_element_interface::get (me),
                      h_inf, r_0);
 
+
   if (bb.fit_factor () > 1.0)
     {
       Real length = bb.curve_.control_[3][X_AXIS];