lilypond-user
[Top][All Lists]
Advanced

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

\offset Y-offset (was: Distance of a grob from its reference point)


From: Paolo Prete
Subject: \offset Y-offset (was: Distance of a grob from its reference point)
Date: Sun, 19 Jan 2020 16:15:38 +0100

Hello Aaron,

sorry for the (a bit) late reply.

I'm looking at your code and I don't understand what is it intended to do.
You write: "% Test with bracket that is positioned by Y-offset."
but from what I see, the bracket is positioned by both outside-staff-padding and y-offset inside \shiftOttavaBracket.
What do you mean, then?
In addition, please can you write at the beginning of the snippet what you are going to demonstrate? IIUC, what you are going to demonstrate is something that depends on the result of another snippet. Please, can you put all in the same example? Otherwise all becomes too hard to be understood/used.

Thanks,
P

%%%%
\version "2.19.83"

#(define (addRuler color left right)
  (grob-transformer 'stencil (lambda (grob orig)
    (ly:stencil-add
      (grob-interpret-markup grob #{
        \markup \with-dimensions-from \null
        \with-color #color \path #0.1 #`(
          (moveto ,left 0) (lineto ,right 0)
          (moveto ,left 1) (lineto ,right 1)
          (moveto ,left 2) (lineto ,right 2)
        ) #})
      orig))))

notesI = \fixed c''' { \mark "mark" \ottava 1 d8 8 4 \ottava 0 d,2 }
notesII = \fixed c''' { \mark "mark" \ottava 1 a8( 8) 4 \ottava 0 a,2 }

shiftOttavaBracket = #(define-music-function (amount) (number?)
  (let ((half (/ amount 2)))
    #{
      \offset Y-offset #half Staff.OttavaBracket
\override Staff.OttavaBracket.outside-staff-padding = #(+ 0.46 half)
      \override Staff.OttavaBracket.extra-offset = #`(0 . ,half)
    #}))

unshiftOttavaBracket = {
  \revert Staff.OttavaBracket.Y-offset
  \revert Staff.OttavaBracket.outside-staff-padding
  \revert Staff.OttavaBracket.extra-offset
}

{
  \omit Staff.Clef \omit Staff.TimeSignature
  \override Score.RehearsalMark.self-alignment-X = #LEFT

  % Test with bracket that is positioned by Y-offset.
  \override Staff.OttavaBracket.stencil = #(addRuler red -5 10)
  \notesI
  \shiftOttavaBracket 1
  \notesI
  \shiftOttavaBracket 2
  \notesI
  \unshiftOttavaBracket

  % Test with bracket that is positioned by outside-staff.
  \override Staff.OttavaBracket.stencil = #(addRuler blue -5 10)
  \notesII
  \shiftOttavaBracket 1
  \notesII
  \shiftOttavaBracket 2
  \notesII
}
%%%%

reply via email to

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