+#include "font-interface.hh"
+#include "international.hh"
+#include "output-def.hh"
+#include "paper-score.hh"
+#include "staff-symbol-referencer.hh"
+#include "stencil.hh"
+
+// -> offset callback
+MAKE_SCHEME_CALLBACK (Rest, y_offset_callback, 1);
+SCM
+Rest::y_offset_callback (SCM smob)
+{
+ Grob *me = unsmob_grob (smob);
+ int duration_log = scm_to_int (me->get_property ("duration-log"));
+ int line_count = Staff_symbol_referencer::line_count (me);
+ Real ss = Staff_symbol_referencer::staff_space (me);
+
+ Real amount = robust_scm2double (me->get_property ("staff-position"), 0)
+ * 0.5 * ss;
+ bool position_override = amount;
+
+ if (line_count % 2)
+ {
+ if (duration_log == 0 && line_count > 1)
+ amount += ss;
+ }
+ else
+ amount += ss / 2;
+
+ Grob *dot = unsmob_grob (me->get_object ("dot"));
+ if (dot && duration_log > 4) // UGH.
+ {
+ dot->set_property ("staff-position",
+ scm_from_int ((duration_log == 7) ? 4 : 3));
+ }
+ if (dot && duration_log >= -1 && duration_log <= 1) // UGH again.
+ {
+ dot->set_property ("staff-position",
+ scm_from_int ((duration_log == 0) ? -1 : 1));
+ }