Joe Neeman escreveu:
> diff --git a/lily/grob.cc b/lily/grob.cc
> index 139a387..91f8ce5 100644
> --- a/lily/grob.cc
> +++ b/lily/grob.cc
> @@ -420,11 +420,21 @@ Grob::extent (Grob *refp, Axis a) const
> Interval
> Grob::pure_height (Grob *refp, int start, int end)
> {
> - SCM proc = get_property_data ( ly_symbol2scm ("Y-extent"));
> - Interval iv = robust_scm2interval (call_pure_function (proc,
> - scm_list_1 (self_scm ()),
> - start, end),
> - Interval (0, 0));
> + SCM proc = get_property_data (ly_symbol2scm ("Y-extent"));
> + SCM pure_proc = get_property_data (ly_symbol2scm ("pure-Y-extent"));
> + SCM iv_scm;
> +
> + if (ly_is_procedure (pure_proc))
> + iv_scm = scm_apply_3 (pure_proc,
> + self_scm (),
> + scm_from_int (start),
> + scm_from_int (end), SCM_EOL);
> + else
> + iv_scm = call_pure_function (proc,
> + scm_list_1 (self_scm ()),
> + start, end);
> +
> + Interval iv = robust_scm2interval (iv_scm, Interval (0, 0));
> Real offset = pure_relative_y_coordinate (refp, start, end);
>
> SCM min_ext = get_property ("minimum-Y-extent");
> @@ -626,6 +636,7 @@ ADD_INTERFACE (Grob,
> "outside-staff-horizontal-padding "
> "outside-staff-padding "
> "outside-staff-priority "
> + "pure-Y-extent "
I don't understand why this is necessary. I thought you did all
the substitutions in Scheme.
I did, but I can't in this case. The previous substitutions are either of the form
callback "a" ->
pure callback "b"
or
callback "a" is pure, just re-use it
But the various accidental grobs use grob::stencil-height for their height callback. Since this is used in so many other grobs too, I can't set up a
pure equivalent that will affect only accidental grobs.
One other solution would be to handle the accidental case explicitly in pure-stencil-height but if there are other grobs that require exceptional handling like this then it will get messy.