X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fstem.cc;h=5f072fac6ae2585362bd7c733483134203415e52;hb=f5be1aa53d66363cacf2a73534f8f856b02adbb0;hp=4d5b7746b59fcfc1e8292741b335c7fd46b4a470;hpb=f0fe9c843e926066299c1f9a33004649f42e1f24;p=lilypond.git diff --git a/lily/stem.cc b/lily/stem.cc index 4d5b7746b5..5f072fac6a 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -289,9 +289,7 @@ Stem::is_normal_stem (Grob *me) if (!head_count (me)) return false; - extract_grob_set (me, "note-heads", heads); - SCM style = heads[0]->get_property ("style"); - return style != ly_symbol2scm ("kievan") && scm_to_int (me->get_property ("duration-log")) >= 1; + return scm_to_int (me->get_property ("duration-log")) >= 1; } MAKE_SCHEME_CALLBACK (Stem, pure_height, 3) @@ -805,6 +803,33 @@ Stem::internal_calc_stem_begin_position (Grob *me, bool calc_beam) return pos; } + +MAKE_SCHEME_CALLBACK (Stem, pure_calc_length, 3); +SCM +Stem::pure_calc_length (SCM smob, SCM /*start*/, SCM /*end*/) +{ + Grob *me = unsmob_grob (smob); + Real beg = robust_scm2double (me->get_pure_property ("stem-begin-position", 0, INT_MAX), 0.0); + Real res = fabs (internal_calc_stem_end_position (me, false) - beg); + return scm_from_double (res); +} + +MAKE_SCHEME_CALLBACK (Stem, calc_length, 1); +SCM +Stem::calc_length (SCM smob) +{ + Grob *me = unsmob_grob (smob); + if (unsmob_grob (me->get_object ("beam"))) + { + me->programming_error ("ly:stem::calc-length called but will not be used for beamed stem."); + return scm_from_double (0.0); + } + + Real beg = robust_scm2double (me->get_property ("stem-begin-position"), 0.0); + Real res = fabs (internal_calc_stem_end_position (me, true) - beg); + return scm_from_double (res); +} + bool Stem::is_valid_stem (Grob *me) {