+MAKE_SCHEME_CALLBACK (Hairpin, broken_bound_padding, 1);
+SCM
+Hairpin::broken_bound_padding (SCM smob)
+{
+ Spanner *me = unsmob<Spanner> (smob);
+ Item *r_bound = me->get_bound (RIGHT);
+ if (r_bound->break_status_dir () != -1)
+ {
+ me->warning (_ ("Asking for broken bound padding at a non-broken bound."));
+ return scm_from_double (0.0);
+ }
+
+ System *sys = dynamic_cast<System *> (me->get_system ());
+ Direction dir = get_grob_direction (me->get_parent (Y_AXIS));
+ if (!dir)
+ return scm_from_double (0.0);
+
+ Grob *my_vertical_axis_group = Grob::get_vertical_axis_group (me);
+ Drul_array<Grob *> vertical_axis_groups;
+ for (DOWN_and_UP (d))
+ vertical_axis_groups[d] = d == dir
+ ? sys->get_neighboring_staff (d, my_vertical_axis_group, Interval_t<int> (me->spanned_rank_interval ()))
+ : my_vertical_axis_group;
+
+ if (!vertical_axis_groups[dir])
+ return scm_from_double (0.0);
+
+ Drul_array<Grob *> span_bars (0, 0);
+ for (DOWN_and_UP (d))
+ {
+ extract_grob_set (vertical_axis_groups[d], "elements", elts);
+ for (vsize i = elts.size (); i--;)
+ if (elts[i]->internal_has_interface (ly_symbol2scm ("bar-line-interface"))
+ && dynamic_cast<Item *> (elts[i])->break_status_dir () == -1)
+ {
+ SCM hsb = elts[i]->get_property ("has-span-bar");
+ if (!scm_is_pair (hsb))
+ break;
+
+ span_bars[d] = unsmob<Grob> ((d == UP ? scm_car : scm_cdr) (hsb));
+ break;
+ }
+
+ if (!span_bars[d])
+ return scm_from_double (0.0);
+ }
+
+ if (span_bars[DOWN] != span_bars[UP])
+ return scm_from_double (0.0);
+
+ return scm_from_double (robust_scm2double (me->get_property ("bound-padding"), 0.5)
+ / 2.0);
+}
+