+
+ return z[X_AXIS] * get_line_thickness (me) + z[Y_AXIS] * staff_space (me);
+}
+
+MAKE_SCHEME_CALLBACK (Staff_symbol, height, 1);
+SCM
+Staff_symbol::height (SCM smob)
+{
+ Grob *me = unsmob<Grob> (smob);
+ Real t = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
+ t *= robust_scm2double (me->get_property ("thickness"), 1.0);
+
+ SCM line_positions = me->get_property ("line-positions");
+
+ Interval y_ext;
+ Real space = staff_space (me);
+ if (scm_is_pair (line_positions))
+ {
+ for (SCM s = line_positions; scm_is_pair (s);
+ s = scm_cdr (s))
+ y_ext.add_point (scm_to_double (scm_car (s)) * 0.5 * space);
+ }
+ else
+ {
+ int l = Staff_symbol::line_count (me);
+ Real height = (l - 1) * staff_space (me) / 2;
+ y_ext = Interval (-height, height);
+ }
+ y_ext.widen (t / 2);
+ return ly_interval2scm (y_ext);
+}
+
+bool
+Staff_symbol::on_line (Grob *me, int pos, bool allow_ledger)
+{
+ // standard staff lines (any line count) and standard ledger lines
+ if (!scm_is_pair (me->get_property ("line-positions"))
+ && !scm_is_pair (me->get_property ("ledger-positions")))
+ {
+ int const line_cnt = line_count (me);
+ bool result = abs (pos + line_cnt) % 2 == 1;
+ if (result && !allow_ledger)
+ {
+ result = -line_cnt < pos && pos < line_cnt;
+ }
+ return result;
+ }
+
+ // staff lines (custom or standard)
+ vector<Real> lines = Staff_symbol::line_positions (me);
+ for (vector<Real>::const_iterator i = lines.begin (),
+ e = lines.end ();
+ i != e;
+ ++i)
+ {
+ if (pos == *i)
+ return true;
+ }
+
+ // ledger lines (custom or standard)
+ if (allow_ledger)
+ {
+ vector<Real> ledgers = Staff_symbol::ledger_positions (me, pos);
+ if (ledgers.empty ())
+ return false;
+ for (vector<Real>::const_iterator i = ledgers.begin (),
+ e = ledgers.end ();
+ i != e;
+ ++i)
+ {
+ if (pos == *i)
+ return true;
+ }
+ }
+ return false;
+}
+
+Interval
+Staff_symbol::line_span (Grob *me)
+{
+ SCM line_positions = me->get_property ("line-positions");
+ Interval iv;
+
+ if (scm_is_pair (line_positions))
+ for (SCM s = line_positions; scm_is_pair (s); s = scm_cdr (s))
+ iv.add_point (scm_to_double (scm_car (s)));
+ else
+ {
+ int count = line_count (me);
+ return Interval (-count + 1, count - 1);
+ }
+
+ return iv;