+ SCM log = gh_int2scm (Note_head::get_balltype (me));
+ SCM proc = me->get_property ("glyph-name-procedure");
+ SCM scm_font_char = scm_call_2 (proc, log, style);
+ String font_char = "noteheads-" + ly_scm2string (scm_font_char);
+
+ Font_metric * fm = Font_interface::get_default_font (me);
+ Stencil out = fm->find_by_name (font_char);
+ if (out.is_empty ())
+ {
+ me->warning (_f ("note head `%s' not found", font_char.to_str0 ()));
+ }
+
+ int interspaces = Staff_symbol_referencer::line_count (me)-1;
+ int pos = (int)rint (Staff_symbol_referencer::get_position (me));
+ if (with_ledgers && interspaces >= 0
+ && abs (pos) - interspaces > 1)
+ {
+ Interval ledger_size = out.extent (X_AXIS);
+ ledger_size.widen ( ledger_size.length ()/4);
+
+ Real left_shorten =0.0;
+ if (Grob * g = unsmob_grob(me->get_property ("accidental-grob")))
+ {
+ /*
+ make a little room for accidentals.
+
+ TODO: this will look silly if a chord has ledger lines,
+ and only the bottom note has an accidental.
+ */
+
+ Grob *common = g->common_refpoint (me, X_AXIS);
+ Real d =
+ (me->extent (common, X_AXIS)[LEFT]
+ +g->extent (common, X_AXIS)[RIGHT]) /2;
+
+ left_shorten = (-ledger_size[LEFT] + d) >? 0 ;
+
+ /*
+ TODO: shorten 2 ledger lines for the case natural +
+ downstem.
+ */
+ }
+
+ out.add_stencil (Note_head::brew_ledger_lines (me, pos, interspaces,
+ ledger_size,
+ left_shorten,
+ false));
+ }
+ return out;