[prev in list] [next in list] [prev in thread] [next in thread]
List: lilypond-user
Subject: Re: Having shortInstrumentName appear at start of score (instead of instrumentName)?
From: Thomas Morley <thomasmorley65 () gmail ! com>
Date: 2015-03-31 22:54:06
Message-ID: CABsfGyWFGndyMxM4zoJ27asFdc9WGj0xN4bhgKgFC5SnCx_f4g () mail ! gmail ! com
[Download RAW message or body]
2015-03-31 22:23 GMT+02:00 Nathan Ho <when.possible@gmail.com>:
> On Tue, Mar 31, 2015 at 12:46 PM, Trevor Bača <trevorbaca@gmail.com> wrote:
>>
>> Hi,
>>
>> Let's say that I have a stylesheet that sets instrumentName values and
>> shortInstrumentName values for a bunch of contexts in the normal way:
>>
>> \context {
>> \Staff
>> ...
>> instrumentName = \markup { Flute }
>> shortInstrumentName = \markup { Fl. }
>> }
>> \context {
>> \Staff
>> ...
>> instrumentName = \markup { Oboe }
>> shortInstrumentName = \markup { Ob. }
>> }
>> ...
>>
>> QUESTION: is there a way to have the shortInstrumentName values appear at
>> the start of the score (meaning that the instrumentName values will never
>> appear)?
>>
>> The question looks pathological. (Why would you set a value for
>> instrumentName if you don't want instrumentName to appear in the score?) But
>> the motivation is as follows. I have a complex score that I've broken into
>> multiple chunks (meaning separate LilyPond files with separate score
>> blocks). All chunks \include the same stylesheet. But I want instrumentName
>> to appear at the start of only chunk 1 (because chunk 1 is the start of the
>> actual sore). For chunks 2, 3, ... I'd like shortInstrumentName to appear at
>> the start of each "score" (because each non-first "score" is actually
>> modeling subsequent parts of the one actual score).
>>
>> I can't imagine that there would be a setting for this. But is there some
>> sort of Scheme wizardry that can be put at the beginning of each of the
>> non-first score chunks to say "set instrumentName to the value of
>> shortInstrumentName"?
>
>
> This is pretty nasty but it does what you're trying to accomplish.
>
> shortInstrAsInstr = #(lambda (context)
>
> (ly:context-set-property! context
>
> 'instrumentName (ly:context-property context
> 'shortInstrumentName)) '())
>
>
> \new Staff \with {
>
> instrumentName = "Viola"
>
> shortInstrumentName = "Vla."
>
> \consists \shortInstrAsInstr
>
> } {
>
> c1 c1 \break c1 c1
>
> }
>
>
> Regards,
>
> Nathan
Less nasty:
\version "2.19.17"
\layout {
\context {
\Staff
\override InstrumentName.after-line-breaking =
#(lambda (grob)
(ly:grob-set-property! grob 'long-text
(ly:grob-property grob 'text)))
}
}
\new Staff
\with {
instrumentName = "Flute"
shortInstrumentName = "Fl."
}
{ c''1 }
\new Staff
\with {
instrumentName = "Oboe"
shortInstrumentName = "Ob."
}
{ d''1 }
HTH,
Harm
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic