- Note_column * rcol = rests[0];
-
- // try to be opposite of noteheads.
- Direction dir = - notes[0]->dir();
-
- Interval restdim = rcol->rest_dim ();
- if (restdim.empty_b ())
- return SCM_UNDEFINED;
-
- // staff ref'd?
- Real staff_space = me->paper_l()->get_var ("interline");
-
- /* FIXME
- staff_space = rcol->rests[0]->staff_space ();
- */
- Real minimum_dist = gh_scm2double (me->get_elt_property ("minimum-distance")) * staff_space;
-
- /*
- assumption: ref points are the same.
- */
+ Grob *rcol = 0;
+ Direction dir = CENTER;
+
+ for (int i = rests.size (); !rcol && i--;)
+ if (Note_column::dir (rests[i]))
+ {
+ dir = Note_column::dir (rests[i]);
+ rcol = rests[i];
+ }
+
+ if (!rcol)
+ return SCM_UNSPECIFIED;
+
+ Grob *common = common_refpoint_of_array (notes, rcol, Y_AXIS);
+
+ Interval restdim = rcol->extent (common, Y_AXIS);
+ if (restdim.is_empty ())
+ return SCM_UNSPECIFIED;
+
+ Real staff_space = Staff_symbol_referencer::staff_space (rcol);
+ Real minimum_dist = robust_scm2double (me->get_property ("minimum-distance"), 1.0) * staff_space;
+