- Real lt = me->paper_l ()->get_var ("stafflinethickness");
-
- SCM thick = me->get_grob_property ("thick");
- SCM gap = me->get_grob_property ("number-gap");
-
- SCM at =scm_list_n (ly_symbol2scm ("tuplet"),
- gh_double2scm (1.0),
- gap,
- gh_double2scm (w),
- gh_double2scm (dy),
- gh_double2scm (gh_scm2double (thick)* lt),
- gh_int2scm (dir),
- SCM_UNDEFINED);
-
- Box b;
- mol.add_molecule (Molecule (b, at));
+ Drul_array<Real> zero (0, 0);
+ Real ss = Staff_symbol_referencer::staff_space (me);
+ Drul_array<Real> height
+ = robust_scm2drul (me->get_property ("edge-height"), zero);
+ Drul_array<Real> flare
+ = robust_scm2drul (me->get_property ("bracket-flare"), zero);
+ Drul_array<Real> shorten
+ = robust_scm2drul (me->get_property ("shorten-pair"), zero);
+ Drul_array<Stencil> edge_stencils;
+
+ Direction dir = get_grob_direction (me);
+
+ scale_drul (&height, -ss * dir);
+ scale_drul (&flare, ss);
+ scale_drul (&shorten, ss);
+
+ Drul_array<bool> connect_to_other
+ = robust_scm2booldrul (me->get_property ("connect-to-neighbor"),
+ Drul_array<bool> (false, false));
+
+ for (LEFT_and_RIGHT (d))
+ {
+ if (connect_to_other[d])
+ {
+ height[d] = 0.0;
+ flare[d] = 0.0;
+ shorten[d] = 0.0;
+
+ SCM edge_text = me->get_property ("edge-text");
+
+ if (scm_is_pair (edge_text))
+ {
+ SCM properties = Font_interface::text_font_alist_chain (me);
+ SCM text = index_get_cell (edge_text, d);
+ if (Text_interface::is_markup (text))
+ {
+ SCM t
+ = Text_interface::interpret_markup (pap->self_scm (),
+ properties, text);
+
+ Stencil *edge_text = Stencil::unsmob (t);
+ edge_text->translate_axis (x_span[d] - x_span[LEFT],
+ X_AXIS);
+ edge_stencils[d] = *edge_text;
+ }
+ }
+ }
+ }
+
+ Stencil brack = make_bracket (me, Y_AXIS,
+ points[RIGHT] - points[LEFT],
+ height,
+ /*
+ 0.1 = more space at right due to italics
+ TODO: use italic correction of font.
+ */
+ Interval (-0.5, 0.5) * gap + 0.1,
+ flare, shorten);
+
+ for (LEFT_and_RIGHT (d))
+ {
+ if (!edge_stencils[d].is_empty ())
+ brack.add_stencil (edge_stencils[d]);
+ }
+
+ mol.add_stencil (brack);