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

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

Reply via email to