Marc Hohl <m...@hohlart.de> writes:

> I wanted to write a little callback to remove all occurrencies
> of "0" fingerings. This is what I got so far:
>
>
> \version "2.19.63"
>
> music = {
>   c'4-3 d'-0 e'-2 f'-3 | g'1-0
> }
>
> \score {
>   \new Staff \with {
>     \override Fingering.stencil =
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>       #(lambda (grob)
[...]
>                              (ly:grob-property grob 'stencil))))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

> Compiling this nearly MWE, I get:
>
> Warning: Fingering has empty extent and non-empty stencil.
> Warning: Fingering has empty extent and non-empty stencil.
>
> And *no* fingering at all is shown in the resulting score.
> What am I doing wrong?

Recursion: see Recursion.

You can do this by using

\version "2.19.63"

music = {
  c'4-3 d'-0 e'-2 f'-3 | g'1-0
}

\score {
  \new Staff \with {
    \override Fingering.text =
    #(grob-transformer 'text
      (lambda (grob default)
       (if (string= "0" default)
	""
	default)))
  { \music }
}
assuming that text is indeed just a string.  The warning actually still
occurs.  However, that is a rather glaring bug (the stencil _is_ empty
and the respective code checks for _existence_ of a stencil (which is
guaranteed at that code point) rather than its non-emptiness).  I'll be
providing a patch presently.

-- 
David Kastrup
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to