2016-02-24 10:05 GMT+01:00 Remy CLAVERIE <[email protected]>:
> Dear lilypond users,
>
>
>
> I would like to place BarNumbers at the right side of a StaffGroup, but I do
> not see how to do that. I frist used the X/Y-offset properties but it was
> not a good idea because the distance between staves of a StaffGroup is
> flexible; so numbers were never really horizontally centered.
>
>
>
> My new idea is to use the shortInstrumentName of the StaffGroup context, but
> I don't know how to read/get the bar number from the stencil properties and
> then convert it into the shortInstrumentName string.
>
>
>
> Can someone help me ?
>
>
>
> Thanks a lot !
>
>
>
> Rémy
How about
\version "2.19.36"
\layout {
\hide Score.BarNumber
}
my-bar-short-instrument-name =
\with {
instrumentName = "1"
shortInstrumentName = ""
\override InstrumentName.after-line-breaking =
#(lambda (grob)
(let* ((all-sys-elts (ly:grob-object (ly:grob-system grob) 'all-elements))
(sorted-bar-nmbrs
(sort
(map
(lambda (g)
(markup->string (ly:grob-property g 'text)))
(filter
(lambda (e)
(eq? (grob::name e) 'BarNumber))
(ly:grob-array->list
(ly:grob-object (ly:grob-system grob) 'all-elements))))
string-ci<?)))
(if (and (not (null? sorted-bar-nmbrs)) (not (null? all-sys-elts)))
(ly:grob-set-property! grob 'text
(car sorted-bar-nmbrs)))))
}
\new Staff \my-bar-short-instrument-name
\repeat unfold 20 {
\time 4/4
c'1
\time 3/4 d'2 e'4
\time 2/8 f'4 g'8[ a']
}
HTH,
Harm
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user