lilypond-user
[Top][All Lists]
Advanced

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

flip clef at end of line only


From: Marc Hohl
Subject: flip clef at end of line only
Date: Sat, 15 Apr 2017 17:32:10 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

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.

---

\version "2.19.0"

#(define-markup-command (flip layout props arg)
(markup?)
   (interpret-markup layout props
     (markup #:concat (#:null #:scale (cons -1 -1) #:line (arg)))))

global = {
  \repeat unfold 4 {
    s1 * 4 |
    \once\override Staff.BarLine.allow-span-bar = ##t
    \once\override Staff.Clef.stencil = #(lambda (grob)
(grob-interpret-markup grob #{ \markup\flip\musicglyph #"clefs.G" #}))
    \break
    }
}

melody = {
  \repeat unfold 16 { c'4 4 4 4 }
}

\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)
  }
}

\score {
  \new Staff << \global \melody >>
}

---


Is there an easy way to detect whether the clef is actually at the end of a line, so that I can write (in pseudo-code)

if (at-end-of-line)
   rotate the clef
else
   print the clef
fi

Thanks in advance,


Marc

Attachment: clef-at-end.ly
Description: Text Data


reply via email to

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