lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: flip clef, key and time signature [Re: flip clef at end of line only


From: Thomas Morley
Subject: Re: flip clef, key and time signature [Re: flip clef at end of line only]
Date: Sun, 16 Apr 2017 21:25:46 +0200

2017-04-16 17:54 GMT+02:00 Marc Hohl <address@hidden>:
> Am 15.04.2017 um 18:02 schrieb Malte Meyn:
>>
>>
>>
>> Am 15.04.2017 um 17:32 schrieb Marc Hohl:
>>>
>>> Hi list,
>>>
>>> I am working on a little piece that's played as written; after
>>> that, the musician has to turn the page upside down and play the
>>> resulting notes.
>>>
>>> I managed to get the clef displayed at the beginning and the end of
>>> each line, and I can flip the clef ;-)
>>>
>>> Unfortunately, overriding the Clef.stencil at the end of the line
>>> changes the apperance for the clef in the next line, too.
>>
>>
>> You need before-line-breaking here so you can use the function
>> ly:item-break-dir:
>>
>>
>> \override Clef.before-line-breaking = #(lambda (grob) (if (equal?
>> (ly:item-break-dir grob) LEFT) (ly:grob-set-property! grob 'stencil
>> (lambda (grobb) (grob-interpret-markup grobb #{ \markup \translate
>> #'(0 . 2) \flip \musicglyph #"clefs.G" #})))))
>
>
> I tried to go one step further and include the key signature and time
> signature in my example, see the attached code.
>
> It works and looks quite ok (the spacing between the flipped sharp and
> the 3/4 is a little too wide), but I get a lot of errors:
>
> Programmierfehler: No spacing entry from Item to `clef'
> Fortsetzung, die Daumen drücken
>
> and one line like this:
>
> Programmierfehler: No spacing entry from TimeSignature to `key-signature'
> Fortsetzung, die Daumen drücken
>
> I searched in the sources and assume that I have to enhance the
> space-alist entries in the concerning grobs, but I do not have a clue
> about the first error message, so any help is highly apprechiated.
>
> Happy Easter!
>
> Marc



Hi Marc,

how about below?

retrogradeItem = {
  \override Score.SystemStartBar.collapse-height = 1

  \override Staff.Clef.before-line-breaking =
    #(lambda (grob)
      (if (equal? (ly:item-break-dir grob) LEFT)
          (begin
            (ly:grob-set-property! grob 'stencil
              (ly:stencil-rotate
                (ly:grob-property grob 'stencil) 180 0 -0.04))
            (ly:grob-set-property! grob 'space-alist
              '((staff-bar extra-space . 1))))))

  \override Staff.TimeSignature.before-line-breaking =
    #(lambda (grob)
      (if (equal? (ly:item-break-dir grob) LEFT)
          (begin
            (ly:grob-set-property! grob 'space-alist
              '((key-signature extra-space . 1)))
            (ly:grob-set-property! grob 'stencil
              (ly:stencil-rotate
                (ly:grob-property grob 'stencil) 180 0 0)))))

  \override Staff.KeySignature.before-line-breaking =
    #(lambda (grob)
      (if (equal? (ly:item-break-dir grob) LEFT)
          (begin
            (ly:grob-set-property! grob 'space-alist '((clef extra-space . 1)))
            (ly:grob-set-property! grob 'stencil
              ;; -0.51 found by trial and error, needs to be always adjusted :(
              (ly:stencil-rotate
                (ly:grob-property grob 'stencil) 180 0 -0.51)))))

  %% TODO same for KeyCancellation

  \override Score.BreakAlignment.break-align-orders =
     #(vector
        '(left-edge
          cue-end-clef
          ambitus
          breathing-sign
          time-signature
          key-signature
          key-cancellation
          clef
          cue-clef
          staff-bar
          custos)
        '(left-edge
          cue-end-clef
          ambitus
          breathing-sign
          clef
          cue-clef
          staff-bar
          key-cancellation
          key-signature
          time-signature
          custos)
        '(left-edge
          ambitus
          breathing-sign
          clef
          key-cancellation
          key-signature
          time-signature
          staff-bar
          cue-clef
          custos))
}

global = {
  \retrogradeItem
  \repeat unfold 4 {
    s1 * 4 |
    \once\override Staff.BarLine.allow-span-bar = ##t
    \break
    }
}

melody = {
  \key c \minor
  \repeat unfold 16 { c'4 4 4 4 }
  \time 4/4
}


\score {
  \new StaffGroup
  \new Staff << \global \melody >>
  \layout {
    \context {
      \Staff
      explicitKeySignatureVisibility = ##(#t #f #t)
      explicitClefVisibility = ##(#t #f #t)
      \override Clef.break-visibility = ##(#t #f #t)
      \override KeySignature.break-visibility = ##(#t #f #t)
    }
  }
}

For the BarNumbers you'll likely need an engraver ...

Happy Easter,
  Harm



reply via email to

[Prev in Thread] Current Thread [Next in Thread]