if (sign (dd - du))
return Direction (sign (dd -du));
- return to_dir (me->get_grob_property ("default-neutral-direction"));
+ return to_dir (me->get_grob_property ("neutral-direction"));
}
Real
stem_y.unite (Interval (y2,y1));
Real dy = Staff_symbol_referencer::staff_space (me)/2.0;
- Real head_wid = 0;
-
- /*
-TODO:
-
- I don't really get the idea of the attachment-angle.
- It seems like that you attach the Stem to the NoteHead at point
- (1,tan(aa)/2), making it still nessesary to have special CENTER-STEMS
- option - and if I would like to attach stem i.e. here:
-
- |
- |
- |
- XXX
- XXXXX
- XXXXX
- XXX
-
- That would be impossible.
- Why haven't you just made ATTACHMENT-COORDINATES as a pair of reals,
- with (0 . 0) meaning CENTER, (1 . 1) upper right, etc...?
-
--Rune
-
-
- */
- Real slope =0.0;
if (Grob *hed = support_head (me))
{
- head_wid = hed->extent (hed,X_AXIS).length ();
+ Interval head_height = hed->extent (hed,Y_AXIS);
+ Real y_attach = Note_head::stem_attachment_coordinate ( hed, Y_AXIS);
- slope = gh_scm2double (hed->get_grob_property ("attachment-slope"));
+ y_attach = head_height.linear_combination (y_attach);
+ stem_y[Direction (-d)] += d * 2*y_attach;
}
- stem_y[Direction (-d)] += d * head_wid * slope/ (2*dy);
+
if (!invisible_b (me))
{
Real r=0;
if (Grob * f = first_head (me))
{
- Interval head_wid (0, f->extent (f,X_AXIS).length ());
+ Interval head_wid = f->extent (f,X_AXIS);
+
+ Real attach =
+ Note_head::stem_attachment_coordinate(f, X_AXIS);
- if (to_boolean (me->get_grob_property ("stem-centered")))
- return gh_double2scm (head_wid.center ());
-
- Real rule_thick = gh_scm2double (me->get_grob_property ("thickness")) * me->paper_l ()->get_var ("stafflinethickness");
Direction d = get_direction (me);
- r = head_wid[d] - d * rule_thick * 0.5;
+
+ Real real_attach = head_wid.linear_combination (d * attach);
+
+ r = real_attach;
+
+ /*
+ If not centered: correct for stem thickness.
+ */
+ if (attach)
+ {
+ Real rule_thick
+ = gh_scm2double (me->get_grob_property ("thickness"))
+ * me->paper_l ()->get_var ("stafflinethickness");
+
+
+ r += - d * rule_thick * 0.5;
+ }
}
return gh_double2scm (r);
}