As I said earlier, I'm working on the incipit snippet to make it fit as a Lilypond command. I've spent a loooong time trying to work out how the spacing of the incipit (its length and placing) is related to the indent of the main music. In summary, it doesn't work. In the code attached, you can see 2 versions of the incipit code, both with fixed incipit length (8 cm) and left indent (2 cm). One uses \layout { $(ly:grob-layout grob) and the other a simple \layout. The attached image shows that the incipit size on the first version is wrong; on the second it's right.

Does anyone know what's happening here?

--
Phil Holmes
\pointAndClickOff

incipitA =
#(define-music-function (parser location incipit-music) (ly:music?)
  #{
    \once \override Staff.InstrumentName.self-alignment-Y = ##f
    \once \override Staff.InstrumentName.self-alignment-X = #RIGHT
    \once \override Staff.InstrumentName.stencil =
      #(lambda (grob)
        (let* ((instrument-name (ly:grob-property grob 'long-text)))
        (set! (ly:grob-property grob 'long-text)
          #{ \markup {
            \score
            {
              \new Staff
              {
                \once \override Staff.InstrumentName.self-alignment-X = #LEFT
                \set Staff.instrumentName = #instrument-name
                $incipit-music
              }
              \layout { $(ly:grob-layout grob)
                line-width = 8\cm
                indent = 2\cm
                ragged-right = ##f
                ragged-last = ##f
                \context {
                  \Score
                  \remove "Default_bar_line_engraver"
                }
              }
            }
            }
          #})
          (system-start-text::print grob)))
  #}
)

incipitB =
#(define-music-function (parser location incipit-music) (ly:music?)
  #{
    \once \override Staff.InstrumentName.self-alignment-Y = ##f
    \once \override Staff.InstrumentName.self-alignment-X = #RIGHT
    \once \override Staff.InstrumentName.stencil =
      #(lambda (grob)
        (let* ((instrument-name (ly:grob-property grob 'long-text)))
        (set! (ly:grob-property grob 'long-text)
          #{ \markup {
            \score
            {
              \new Staff
              {
                \once \override Staff.InstrumentName.self-alignment-X = #LEFT
                \set Staff.instrumentName = #instrument-name
                $incipit-music
              }
              \layout {
                line-width = 8\cm
                indent = 2\cm
                ragged-right = ##f
                ragged-last = ##f
                \context {
                  \Score
                  \remove "Default_bar_line_engraver"
                }
              }
            }
            }
          #})
          (system-start-text::print grob)))
  #}
)

\score {
  {
    \set Staff.instrumentName = #"Altus"
    \incipitA { f''1 }
    \repeat unfold 10 c''1 \break
    \repeat unfold 10 c''1
  }
  \layout { indent = 8\cm }
}

\score {
  {
    \set Staff.instrumentName = #"Altus"
    \incipitB { f''1 }
    \repeat unfold 10 c''1 \break
    \repeat unfold 10 c''1
  }
  \layout { indent = 8\cm }
}
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to