2002-07-21 Jan Nieuwenhuizen <janneke@gnu.org>
+ * input/test/cue-notes.ly: better example
+
+ * Documentation/user/refman.itely (Font selection): font size doco
+
+ * input/mutopia/F.Schubert/standchen.ly: note bugfix
+
+ * lily/stem.cc: rewrite of scoring to give sane results on knee
+ beams.
+
* lily/beam.cc (set_stem_lengths): extend stems for gapped tremolo
beams.
(connect_beams): chop off beaming outside the beam. Fixes problem
+@comment @c -*-texinfo-*-
@node Preface
-@chapter Preface
+@unnumbered Preface
It must have been during a rehearsal of the EJE (Eindhoven Youth
which enhances readability.
@end table
-For any of these properties, the value @code{*} (i.e. the @em{symbol},
+For any of these properties, the value @code{*} (i.e. the @emph{symbol},
@code{*}, entered as @code{#'*}), acts as a wildcard. This can be used
to override default setting, which are always present. For example:
@example
Direction d = info.dir_;
score[d] += pen
- * (0 >? (info.dir_ * (info.shortest_y_ - current_y)));
+ * (0 >? (d * (info.shortest_y_ - current_y)));
+
+ Real ideal_score = shrink_extra_weight (d * current_y - d * info.ideal_y_);
- score[d] += STEM_LENGTH_DEMERIT_FACTOR
- * shrink_extra_weight (d * current_y - info.dir_ * info.ideal_y_);
+ /*
+
+ we introduce a power, to make the scoring strictly
+ convex. Otherwise a symmetric knee beam (up/down/up/down) does
+ not have an optimum in the middle.
+
+ */
+ if (knee)
+ ideal_score = pow (ideal_score, 1.1);
+ score[d] += STEM_LENGTH_DEMERIT_FACTOR * ideal_score;
count[d] ++;
}
TODO:
take some y-position (chord/beam/nearest?) into account
scmify forced-fraction
-
- TODO:
-
- why is shorten stored in beam, and not directly in stem?
+
+ This is done in beam because the shorten has to be uniform over the
+ entire beam.
*/
void
-Beam::set_stem_shorten (Grob *m)
+Beam::set_stem_shorten (Grob *me)
{
- Spanner*me = dynamic_cast<Spanner*> (m);
-
+ /*
+ shortening looks silly for x staff beams
+ */
+ if (knee_b(me))
+ return ;
+
Real forced_fraction = forced_stem_count (me) / visible_stem_count (me);
int beam_count = get_beam_count (me);
return gh_double2scm (-d * discrete_dist);
}
+bool
+Beam::knee_b (Grob*me)
+{
+ SCM k= me->get_grob_property ("knee");
+ if (gh_boolean_p(k))
+ return gh_scm2bool (k);
+ Link_array<Grob> stems=
+ Pointer_group_interface__extract_grobs (me, (Grob*)0, "stems");
+
+ Drul_array<bool> dirs_found(0,0);
+
+ for (int i= 0; i < stems.size(); i++)
+ {
+ Grob*s = stems[i];
+ dirs_found[Directional_element_interface::get(s)] = true;
+
+ if (dirs_found[LEFT]&&dirs_found[RIGHT])
+ break;
+ }
+
+ bool knee = dirs_found[LEFT]&&dirs_found[RIGHT];
+ me->set_grob_property ("knee", gh_bool2scm (knee));
+
+ return knee;
+}
ADD_INTERFACE (Beam, "beam-interface",
DECLARE_SCHEME_CALLBACK (rest_collision_callback, (SCM element, SCM axis));
Beam (SCM);
static void add_stem (Grob*,Grob*);
+ static bool knee_b (Grob*);
static void set_beaming (Grob*,Beaming_info_list *);
static void set_stemlens (Grob*);
static int get_beam_count (Grob*me);
Grob * beam = beam_l (me);
int beam_count = beam_multiplicity(me).length()+1;
- Real beam_translation_f = Beam::get_beam_translation (beam);
+ Real beam_translation= Beam::get_beam_translation (beam);
Real thick = gh_scm2double (beam->get_grob_property ("thickness"));
- Real ideal_y = chord_start_y (me);
+ Real note_start = chord_start_y (me);
/* from here on, calculate as if dir == UP */
- ideal_y *= mydir;
+ note_start *= mydir;
SCM grace_prop = me->get_grob_property ("grace");
-
bool grace_b = to_boolean (grace_prop);
SCM bml = robust_list_ref ( beam_count ,
me->get_grob_property ("beamed-lengths"));
Real stem_length = gh_scm2double(bl) * staff_space;
- ideal_y += thick + (beam_count - 1) * beam_translation_f;
-
- Real shortest_y = ideal_y + minimum_length
- + (beam_count > 0) ? thick : 0
- + beam_translation_f * (beam_count - 1);
-
+ /*
+ stem goes to center of beam, hence 0.5
+ */
+ Real beam_lengthen = beam_translation* (beam_count - 1)
+ + ((beam_count > 0) ? thick : 0) - 0.5 * thick;
- ideal_y += stem_length;
+ Real shortest_y = note_start + minimum_length + beam_lengthen;
+ Real ideal_y = stem_length + note_start + beam_lengthen;
-
/*
lowest beam of (UP) beam must never be lower than second staffline
staffline
lowest beam of (UP) beam must never be lower than second staffline
*/
-#if 0
- shortest_y =
- shortest_y >? 0
- >? (- 2 * half_space - thick
- + (beam_count > 0) * thick
- + beam_translation_f * (beam_count - 1));
-
-#else
ideal_y =
ideal_y >? 0
- >? (- 2 * half_space - thick
- + (beam_count > 0) * thick
- + beam_translation_f * (beam_count - 1));
-#endif
-
+ >? (- 2 * half_space - thick + beam_lengthen);
}