[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: BarNumber instead of shortInstrumentName
From: |
Thomas Morley |
Subject: |
Re: BarNumber instead of shortInstrumentName |
Date: |
Wed, 24 Feb 2016 12:03:25 +0100 |
2016-02-24 10:05 GMT+01:00 Remy CLAVERIE <address@hidden>:
> 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
- BarNumber instead of shortInstrumentName, Remy CLAVERIE, 2016/02/24
- Message not available
- Re: BarNumber instead of shortInstrumentName,
Thomas Morley <=
- Re: BarNumber instead of shortInstrumentName, Remy CLAVERIE, 2016/02/24
- Re: BarNumber instead of shortInstrumentName, David Kastrup, 2016/02/24
- Re: BarNumber instead of shortInstrumentName, Remy CLAVERIE, 2016/02/24
- Re: BarNumber instead of shortInstrumentName, Phil Holmes, 2016/02/24
- Re: BarNumber instead of shortInstrumentName, Remy CLAVERIE, 2016/02/24
- Re: BarNumber instead of shortInstrumentName, Richard Shann, 2016/02/24
- Re: BarNumber instead of shortInstrumentName, Remy CLAVERIE, 2016/02/24
- Re: BarNumber instead of shortInstrumentName, David Kastrup, 2016/02/24
- Re: BarNumber instead of shortInstrumentName, David Nalesnik, 2016/02/24
- Re: BarNumber instead of shortInstrumentName, Remy CLAVERIE, 2016/02/24