+MAKE_SCHEME_CALLBACK (Stem, calc_stem_begin_position, 1);
+SCM
+Stem::calc_stem_begin_position (SCM smob)
+{
+ Grob *me = unsmob_grob (smob);
+ Direction d = get_grob_direction (me);
+ Real half_space = Staff_symbol_referencer::staff_space (me) * 0.5;
+ Grob *lh
+ = to_boolean (me->get_property ("avoid-note-head"))
+ ? last_head (me)
+ : first_head (me);
+
+ Real pos = Staff_symbol_referencer::get_position (lh);
+
+ if (Grob *head = support_head (me))
+ {
+ Interval head_height = head->extent (head, Y_AXIS);
+ Real y_attach = Note_head::stem_attachment_coordinate (head, Y_AXIS);
+
+ y_attach = head_height.linear_combination (y_attach);
+ pos += d * y_attach / half_space;
+ }
+
+ return scm_from_double (pos);
+}
+