lilypond-user
[Top][All Lists]
Advanced

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

Re: Vertical placement of ottava line


From: Thomas Morley
Subject: Re: Vertical placement of ottava line
Date: Sun, 5 Oct 2014 16:13:18 +0200

2014-10-05 15:45 GMT+02:00 Peter Crighton <address@hidden>:
> Does anybody have more ideas for this (see below)? How can I move the
> beginning and end of OttavaBrackets horizontally, or rather change their
> alignment to the note head?


Maybe try the code below.
Though, read the comments. There are possible problems.

\version "2.19.13"

\layout {
  \context {
    \Staff
    \override OttavaBracket.before-line-breaking =
      #(lambda (grob)
         (let* ((txt (ly:grob-property grob 'text))
                (dir (ly:grob-property grob 'direction))
                (txt-stil (grob-interpret-markup grob txt))
                (txt-stil-y-length
                  (interval-length (ly:stencil-extent txt-stil Y)))
                (factor
                  (if (<= 1 dir)
                      ;; Mmmh, values found by try and error. They will not
                      ;; work for every thinkable text.
                      (* txt-stil-y-length 2)
                      txt-stil-y-length)))
        ;; Will cause the text centered above the note, if the octavation
        ;; is set for only this note.
        (ly:grob-set-property! grob 'minimum-length #f)
        ;; Arrgh, is there no better way to move the line, than moving the
        ;; text?
        ;; That's terrible and may cause other problems ...
        (ly:grob-set-property! grob 'text
         #{ \markup \concat { \null \raise #(* factor -1 dir) #txt } #})))
  }
}


\relative c'' {

  c1
  \ottava #1
  c c c c c c c c c
  \ottava #-1
  c c
  \ottava #0
  cisis
  \ottava #1
  c
  \ottava #-1
  c

  \break

  \ottava #0
  cisis1
  \ottava #1
  ces
  c
  \ottava #-1
  c
  c
  \ottava #0
  cisis
  \ottava #1
  c
  \ottava #-1
  c
}

HTH,
  Harm



reply via email to

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