+ return r.smobbed_copy ();
+}
+
+MAKE_SCHEME_CALLBACK (Multi_measure_rest,print,1);
+SCM
+Multi_measure_rest::print (SCM smob)
+{
+ Grob *me = unsmob_grob (smob);
+ Spanner * sp = dynamic_cast<Spanner*> (me);
+
+ Interval sp_iv;
+ Direction d = LEFT;
+
+ Grob *common = sp->get_bound (LEFT)->common_refpoint (sp->get_bound (RIGHT), X_AXIS);
+ do
+ {
+ Item * b = sp->get_bound (d);
+
+ Interval coldim = (Separation_item::has_interface (b))
+ ? Separation_item::relative_width (b, common)
+ : b->extent (common, X_AXIS);
+
+ sp_iv[d] = coldim.is_empty () ? b->relative_coordinate (common, X_AXIS) : coldim[-d];
+ }
+ while ((flip (&d)) != LEFT);
+
+ Real space = sp_iv.length ();
+
+ Real rx = sp->get_bound (LEFT)->relative_coordinate (0, X_AXIS);
+ /*
+ we gotta stay clear of sp_iv, so move a bit to the right if
+ needed.
+ */
+ Real x_off = (sp_iv[LEFT] - rx) >? 0;
+
+
+ Stencil mol;
+ mol.add_stencil (symbol_stencil (me, space));
+
+ int measures = 0;
+ SCM m (me->get_property ("measure-count"));
+ if (ly_c_number_p (m))
+ {
+ measures = ly_scm2int (m);
+ }
+
+ mol.translate_axis (x_off, X_AXIS);
+ return mol.smobbed_copy ();
+}
+
+
+
+Stencil
+Multi_measure_rest::symbol_stencil (Grob *me, Real space)
+{
+ int measures = 0;
+ SCM m (me->get_property ("measure-count"));
+ if (ly_c_number_p (m))
+ {
+ measures = ly_scm2int (m);
+ }
+ if (measures <= 0)
+ return Stencil ();
+
+
+ SCM limit = me->get_property ("expand-limit");
+ if (measures > ly_scm2int (limit))
+ {
+ Real padding = 0.15;
+ Stencil s = big_rest (me, (1.0 - 2*padding) * space);
+ s.translate_axis (padding * space, X_AXIS);
+ return s;
+ }
+
+ SCM alist_chain = Font_interface::music_font_alist_chain (me);
+
+ Real staff_space = Staff_symbol_referencer::staff_space (me);
+ Font_metric *musfont
+ = select_font (me->get_paper (), alist_chain);
+
+ SCM sml = me->get_property ("use-breve-rest");
+ if (measures == 1)
+ {
+ if (to_boolean (sml))
+ {
+ Stencil s = musfont->find_by_name (Rest::glyph_name (me, -1, "", false));
+
+ s.translate_axis ((space - s.extent (X_AXIS).length ())/2, X_AXIS);
+
+ return s ;
+ }
+ else
+ {
+ Stencil s = musfont->find_by_name (Rest::glyph_name (me, 0, "", true));
+
+ /*
+ ugh.
+ */
+ if (Staff_symbol_referencer::get_position (me) == 0.0)
+ s.translate_axis (staff_space, Y_AXIS);