[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to read out final "whichBar"
From: |
Thomas Morley |
Subject: |
Re: how to read out final "whichBar" |
Date: |
Fri, 3 Nov 2017 15:29:55 +0100 |
2017-11-03 9:42 GMT+01:00 Maurits Lamers <address@hidden>:
> Hi,
>
> I have been using scheme based engravers to capture all kinds of music
> events. Until now I have dealt with bar lines by reading out the whichBar
> property on the context of an event through
>
> (ly:context-property (ly:translator-context engraver) 'whichBar)
>
> However, this doesn't work for the final bar sign. I have also tried to read
> out the translator object given to the finalize function, but when I read out
> the whichBar property, it is invariably empty. What would be the best way to
> figure out which type of bar is used at the end of a piece?
>
> Thanks in advance!
>
> cheers
>
> Maurits
You could do:
\version "2.19.65"
\score {
{
r2 r
\break
\bar "S"
R1
\bar "|."
}
\layout {
\context {
\Staff
\consists
#(make-engraver
((stop-translation-timestep engraver)
(format #t "\nwhichBar: ~a"
(ly:context-property
(ly:translator-context engraver)
'whichBar)))
(acknowledgers
((bar-line-interface engraver grob source-engraver)
(ly:grob-set-property! grob 'after-line-breaking
(lambda (grob)
(format #t "\nglyph: ~a"
(ly:grob-property grob 'glyph))
(format #t "\nglyph-name: ~a"
(ly:grob-property grob 'glyph-name)))))))
}
}
}
Note the difference for the grob-properties, due to line-break.
Cheers,
Harm