- Real staffht = paper_l ()->get_var ("staffheight");
- int staff_size = int (rint (staffht ));
-
- // URG
- Real step = 1.0;
- int minht = 2 * staff_size;
- int maxht = 7 * minht;
- int idx = int (((maxht - step) <? y - minht) / step);
- idx = idx >? 0;
-
- SCM l = scm_eval (gh_list (ly_symbol2scm ("style-to-cmr"),
- ly_str02scm ("brace"),
- SCM_UNDEFINED));
-
- String nm = "feta-braces";
- if (l != SCM_BOOL_F)
- nm = ly_scm2string (gh_cdr (l));
- nm += to_str (staff_size);
- SCM e =gh_list (ly_symbol2scm ("char"), gh_int2scm (idx), SCM_UNDEFINED);
- SCM at = (e);
-
- at = fontify_atom (find_font (nm), at);
+ Font_metric *fm = Font_interface::get_default_font (me);
+ Box b;
+ int lo = 0;
+ int hi = 255; //arg, urg == 0: fm->count () >? 2;
+
+ int big = 1;
+ SCM bigger = gh_list (me->mutable_property_alist_,
+ me->immutable_property_alist_,
+ SCM_UNDEFINED);
+
+ /* do a binary search for each Y, not very efficient, but passable? */
+ do
+ {
+ int cmp = (lo + hi) / 2;
+
+ b = fm->get_char (cmp);
+ if (b[Y_AXIS].empty_b () || b[Y_AXIS].length () > y)
+ {
+ hi = cmp;
+ }
+ else
+ {
+ /*
+ ugh: 7
+ We have four fonts: feta-braces0-3.mf
+
+ In the style-sheet, all paper relative sizes need to start
+ looking at the feta-braces0 font.
+
+ The smallest paper size, feta11 or -3, has to make 5 steps
+ to get to feta26 or +2. Only after that, from +3 to +5 are
+ the real bigger sizes, so worst case we need 8 steps to get
+ to the font we need. */
+ if (big < 8)
+ {
+ bigger = gh_cons (gh_cons (ly_symbol2scm ("font-relative-size"),
+ gh_int2scm (big++)),
+ bigger);
+ me->set_grob_property ("font", bigger);
+ fm = Font_interface::get_default_font (me);
+ lo = 0;
+ hi = 255; //fm->count () >? 2;
+ }
+ else
+ lo = cmp;
+ }
+ }
+ while (hi - lo > 1);
+
+ SCM at = gh_list (ly_symbol2scm ("char"), gh_int2scm (lo), SCM_UNDEFINED);
+ at = fontify_atom (fm, at);