Real blot
= me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter"));
- Real y2 = pure
- ? stem->pure_height (stem, 0, INT_MAX)[d]
- : stem->extent (stem, Y_AXIS)[d];
+ Interval stem_extent = pure
+ ? stem->pure_height (stem, 0, INT_MAX)
+ : stem->extent (stem, Y_AXIS);
- return scm_from_double (y2 - d * blot / 2);
+ return scm_from_double (stem_extent.is_empty ()
+ ? 0.0
+ : stem_extent[d] - d * blot / 2);
}
MAKE_SCHEME_CALLBACK (Flag, calc_x_offset, 1);
}
// We never want nan, so we avoid shifting infinite values.
- for (LEFT_and_RIGHT (d))
- if (!isinf (real_ext[d]))
- real_ext[d] += offset;
+ if(!isinf (offset))
+ real_ext.translate(offset);
+ else
+ this->warning(_f ("ignored infinite %s-offset",
+ a == X_AXIS ? "X" : "Y"));
return real_ext;
}
}
bool whole_note = Stem::duration_log (stem) <= 0;
- if (whole_note)
+ if (whole_note || isinf(end_y))
{
/* we shouldn't position relative to the end of the stem since the stem
is invisible */
= hed->extent (hed, X_AXIS).linear_combination (CENTER)
- heads[i]->extent (heads[i], X_AXIS).linear_combination (CENTER);
- heads[i]->translate_axis (amount, X_AXIS);
+ if (!isnan (amount)) // empty heads can produce NaN
+ heads[i]->translate_axis (amount, X_AXIS);
}
bool parity = true;
Real lastpos = Real (Staff_symbol_referencer::get_position (heads[0]));
Real y_attach = Note_head::stem_attachment_coordinate (head, Y_AXIS);
y_attach = head_height.linear_combination (y_attach);
- pos += d * y_attach * 2 / ss;
+ if (!isinf (y_attach) && !isnan (y_attach)) // empty heads
+ pos += d * y_attach * 2 / ss;
}
return pos;
Direction d = get_grob_direction (me);
Real real_attach = head_wid.linear_combination (d * attach);
- Real r = real_attach;
+ Real r = isnan(real_attach)? 0.0: real_attach;
/* If not centered: correct for stem thickness. */
string style = robust_symbol2string (f->get_property ("style"), "default");