+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.
@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}.
@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,
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
*/
+
+
#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)
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 ();
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;
}
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)
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;
--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)
{
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;
}
}
}
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;
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());
+}
}
+/*
+ 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)
{
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#
/**
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)
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;
bb->curve_.assert_sanity ();
}
+
+
Direction
Slur::get_default_dir (Grob*me)
{
void
Slur::check_slope (Grob *me)
{
+
/*
Avoid too steep slurs.
*/
ly_offset2scm (o[RIGHT])));
}
}
+
}
/*
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)
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),
Directional_element_interface::get (me),
h_inf, r_0);
+
if (bb.fit_factor () > 1.0)
{
Real length = bb.curve_.control_[3][X_AXIS];