lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug? getting the stencil of the stem removes the beam


From: Lucas Werkmeister
Subject: Bug? getting the stencil of the stem removes the beam
Date: Thu, 15 Mar 2018 18:38:48 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

Hi everyone,

I was trying to use the \displaceHeads function from snippet 861 [1] [2] on an eight-note chord, but found that it completely removes the beam for some reason. I reduced it down to the following code:

\version "2.18.2"

{
  \tweak before-line-breaking #(lambda (grob)
                                 (ly:grob-property (ly:grob-object grob 'stem) 'stencil))
  c'8[ c']
}

You can find a screenshot of the result at [3]. The function here doesn’t mutate anything, but apparently just accessing the stem is enough to render the associated beam invisible (at a guess, I’d say the beam’s stencil is being unset somehow – it still influences the layout otherwise). Is that a bug in LilyPond?

The \displaceHeads problem was previously reported at [4] (and I’ve added the author to CC for this email), but as far as I can see the thread didn’t go anywhere. (To answer the question in the reply [5] – changing before-line-breaking to after-line-breaking fixes the beam, but also removes the displacement effect, so as far as I can tell you might as well just get rid of the \displaceHeads completely.) I hope the reduced example above will help to get this bug (if it is one) fixed :)

An ugly workaround (back at the \displaceHeads level) is to remove all the stem-related code and instead hard-code a value for the stem width – the default seems to be 0.065. For convenience, you can find the result at [6]. (If your stem width is different, take the original function, replace the ly:grob-translate-axis! call with (display x-corr) in order to print the correct value, and then substitute that.)

Cheers,
Lucas

[1]: http://lsr.di.unimi.it/LSR/Item?id=861
[2]: http://lsr.di.unimi.it/LSR/Snippet?id=861
[3]: https://i.imgur.com/hslsBDG.png
[4]: https://lists.gnu.org/archive/html/lilypond-user/2017-01/msg00214.html
[5]: https://lists.gnu.org/archive/html/lilypond-user/2017-01/msg00220.html
[6]: https://gist.github.com/lucaswerkmeister/5ae87eaa3695b8a39f5d1e05bc9b077c


reply via email to

[Prev in Thread] Current Thread [Next in Thread]