[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Remove all occurrencies of "0" fingerings
From: |
Thomas Morley |
Subject: |
Re: Remove all occurrencies of "0" fingerings |
Date: |
Tue, 8 Aug 2017 12:35:50 +0200 |
2017-08-08 11:46 GMT+02:00 Marc Hohl <address@hidden>:
> Hi Malte,
>
> Am 08.08.2017 um 10:30 schrieb Malte Meyn:
>>
>>
>>
>> Am 08.08.2017 um 10:23 schrieb Marc Hohl:
>>>
>>>
>>> I wanted to write a little callback to remove all occurrencies
>>> of "0" fingerings.
>>
>>
>> This doesn’t empty the stencil but removes the Fingering grobs completely
>> (by suicide):
>
>
> thanks for this solution!
>
> In my real-life example, I got
>
> lilypond: ../flower/include/drul-array.hh:35: T&
> Drul_array<T>::at(Direction) [with T = scm_unused_struct*]: Zusicherung >>d
> == 1 || d == -1<< nicht erf?llt.music = {
\set fingeringOrientations = #'(left)
c'4-333333333333 d'-0 e'-2 <f'-333333333333> | g'1_0 a'^0
}
\score {
\new Staff
\with {
\override Fingering.after-line-breaking =
#(lambda (grob)
(if (equal? (ly:grob-property grob 'text) "333333333333")
(ly:grob-suicide! grob)))
}
{ \music }
}
> Aborted (core dumped)
>
> but changing before-line-breaking to after-line-breaking did the trick.
>
> I do not fully understand why, but it works.
>
> Thanks,
>
> Marc
>
>>
>> \override Fingering.before-line-breaking =
>> #(lambda (grob)
>> (if (equal? (ly:grob-property grob 'text) "0")
>> (ly:grob-suicide! grob)))
Hi Marc,
your initial code had two problems, comments inline:
\override Fingering.stencil =
#(lambda (grob)
(let* ((text (ly:grob-property grob 'text))
(stencil (if (equal? text "0")
;; to avoid the warning go for point-stencil
;; not empty-stencil
point-stencil
;; return a stencil yourself, don't call the
;; property which is created by the stencil-prop
;; it's a cycle and I'm somewhat surprised it failed
;; not more spectaculary
(ly:text-interface::print grob))))
stencil))
In certain cases going for after-line-break will be too late and
leaves you with bad spacing:
music = {
\set fingeringOrientations = #'(left)
c'4-333333333333 d'-0 e'-2 <f'-333333333333> | g'1_0 a'^0
}
\score {
\new Staff
\with {
\override Fingering.after-line-breaking =
#(lambda (grob)
(if (equal? (ly:grob-property grob 'text) "333333333333")
(ly:grob-suicide! grob)))
}
{ \music }
}
Ofcourse it's far less likely that a single-digit like will cause such badness.
Nevertheless I'd research why/where your real-life code gives that
assertion failure.
Cheers,
Harm
Re: Remove all occurrencies of "0" fingerings, David Kastrup, 2017/08/08
Re: Remove all occurrencies of "0" fingerings, Marc Hohl, 2017/08/08