-/**
- callback that centers the element on itself
- */
-MAKE_SCHEME_CALLBACK (Side_position_interface,aligned_on_self,2);
-SCM
-Side_position_interface::aligned_on_self (SCM element_smob, SCM axis)
-{
- Grob *me = unsmob_grob (element_smob);
- Axis a = (Axis) gh_scm2int (axis);
- String s ("self-alignment-");
-
- s += (a == X_AXIS) ? "X" : "Y";
-
- SCM align (me->get_grob_property (s.ch_C ()));
- if (gh_number_p (align))
- {
- Interval ext (me->extent (me,a));
-
- if (ext.empty_b ())
- {
- programming_error ("I'm empty. Can't align on self");
- return gh_double2scm (0.0);
- }
- else
- {
- return gh_double2scm (- ext.linear_combination (gh_scm2double (align)));
- }
- }
- else if (unsmob_grob (align))
- {
- return gh_double2scm (- unsmob_grob (align)->relative_coordinate (me, a));
- }
- return gh_double2scm (0.0);
-}
-