Direction d = get_direction (me);
if (d && d * head_positions (me)[get_direction (me)] >= se * d)
- me->warning (_ ("Weird stem size; check for narrow beams"));
+ me->warning (_ ("weird stem size, check for narrow beams"));
me->set_property ("stem-end-position", scm_make_real (se));
}
{
SCM sshorten = me->get_property ("stem-shorten");
SCM scm_shorten = scm_is_pair (sshorten)
- ? robust_list_ref ((duration_log (me) - 2) >? 0, sshorten) : SCM_EOL;
+ ? robust_list_ref (max (duration_log (me) - 2, 0), sshorten) : SCM_EOL;
Real shorten = 2* robust_scm2double (scm_shorten, 0);
/* On boundary: shorten only half */
if (dir == DOWN)
minlen -= 1.0;
}
- length = length >? (minlen + 1.0);
+ length = max (length, minlen + 1.0);
}
Real st = dir ? hp[dir] + dir * length : 0;
Direction d = get_direction (me);
if (d == CENTER)
{
- programming_error ("No stem direction");
+ programming_error ("no stem direction");
d = UP;
}
iv[d] += d * Beam::get_thickness (b) * 0.5;
SCM
Stem::width_callback (SCM e, SCM ax)
{
- Axis a = (Axis) scm_to_int (ax);
- assert (a == X_AXIS);
+ (void) ax;
+ assert (scm_to_int (ax) == X_AXIS);
Grob *me = unsmob_grob (e);
Interval r;
}
else
{
- r = flag (me).extent (X_AXIS)
- + thickness (me) / 2;
+ r = Interval (-1,1) * thickness (me) * 0.5;
+ r.unite (flag (me).extent (X_AXIS));
}
return ly_interval2scm (r);
}
y2 -= d
* (0.5 * beam_thickness
- + beam_translation * (0 >? (beam_count - 1))
+ + beam_translation * max (0, (beam_count - 1))
+ stemlet_length) / half_space;
}
- Interval stem_y (y1 <? y2, y2 >? y1);
+ Interval stem_y (min (y1, y2), max (y2, y1));
if (Grob *hed = support_head (me))
{
if (!my_dir)
{
- programming_error ("No stem dir set?");
+ programming_error ("no stem dir set");
my_dir = UP;
}
/* stem only extends to center of beam */
- 0.5 * beam_thickness;
- ideal_length = ideal_length >? ideal_minimum_length;
+ ideal_length = max (ideal_length, ideal_minimum_length);
/* Convert to Y position, calculate for dir == UP */
Real note_start
{
/* Highest beam of (UP) beam must never be lower than middle
staffline */
- ideal_y = ideal_y >? 0;
+ ideal_y = max (ideal_y, 0.0);
/* Lowest beam of (UP) beam must never be lower than second staffline */
- ideal_y = ideal_y >? (-staff_space
- - beam_thickness + height_of_my_beams);
+ ideal_y = max (ideal_y, (-staff_space
+ - beam_thickness + height_of_my_beams));
}
ideal_y -= robust_scm2double (beam->get_property ("shorten"), 0);
/* stem only extends to center of beam */
- 0.5 * beam_thickness;
+ if (Grob *tremolo = unsmob_grob (me->get_property ("tremolo-flag")))
+ {
+ Interval y_ext = tremolo->extent (tremolo, Y_AXIS);
+ y_ext.widen (0.5); // FIXME. Should be tunable?
+ minimum_length = max (minimum_length, y_ext.length ());
+ }
+
ideal_y *= my_dir;
Real minimum_y = note_start + minimum_length;
Real shortest_y = minimum_y * my_dir;