lilypond-user-fr
[Top][All Lists]
Advanced

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

Re: Couplet en italique


From: Jean Abou Samra
Subject: Re: Couplet en italique
Date: Wed, 9 Mar 2022 23:28:20 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

Le 09/03/2022 à 22:32, me@papilip.me a écrit :
Merci beaucoup pour ce rappel sympathique.
Si je peux abuser de ton savoir : peut-on remettre devant chaque ligne le 
numéro (stanza) du couplet ?
Merci, Philippe


C'est possible aussi, par contre pour le coup il faut travailler
un peu plus techniquement.


\version "2.22.1"

#(define (add-grob-definition grob-name grob-entry)
   (set! all-grob-descriptions
         (cons ((@@ (lily) completize-grob-entry)
                (cons grob-name grob-entry))
               all-grob-descriptions)))

#(add-grob-definition
  'StanzaNumberSpanner
  `((direction . ,LEFT)
    (font-series . bold)
    (padding . 1.0)
    (side-axis . ,X)
    (stencil . ,ly:text-interface::print)
    (X-offset . ,ly:side-position-interface::x-aligned-side)
    (Y-extent . ,grob::always-Y-extent-from-stencil)
    (meta . ((class . Spanner)
             (interfaces . (font-interface
                            side-position-interface
                            stanza-number-interface
                            text-interface))))))

\layout {
  \context {
    \Global
    \grobdescriptions #all-grob-descriptions
  }
  \context {
    \Score
    \remove Stanza_number_align_engraver
    \consists
      #(lambda (context)
         (let ((texts '())
               (syllables '()))
           (make-engraver
            (acknowledgers
             ((stanza-number-interface engraver grob source-engraver)
                (set! texts (cons grob texts)))
             ((lyric-syllable-interface engraver grob source-engraver)
                (set! syllables (cons grob syllables))))
            ((stop-translation-timestep engraver)
               (for-each
                (lambda (text)
                  (for-each
                   (lambda (syllable)
                     (ly:pointer-group-interface::add-grob text 'side-support-elements syllable))
                   syllables))
                texts)
               (set! syllables '())))))
  }
  \context {
    \Lyrics
    \remove Stanza_number_engraver
    \consists
      #(lambda (context)
         (let ((text #f))
           (make-engraver
            ((process-music engraver)
               (if (not text)
                   (let ((stanza (ly:context-property context 'stanza #f)))
                     (if stanza
                         (begin
                           (set! text (ly:engraver-make-grob engraver 'StanzaNumberSpanner '()))                            (let ((column (ly:context-property context 'currentCommandColumn)))
                             (ly:grob-set-property! text 'text stanza)
                             (ly:spanner-set-bound! text LEFT column)))))))
            ((finalize engraver)
               (if text
                   (let ((column (ly:context-property context 'currentCommandColumn)))
                     (ly:spanner-set-bound! text RIGHT column)))))))
    \override StanzaNumberSpanner.horizon-padding = 10000
    \override LyricText.font-shape = #'italic
  }
}

\relative { c'4 c c d e2 d c4 e d d c1 }
\addlyrics {
  \set stanza = "1."
  Au clair de la lu -- ne,
  \break
  mon a -- mi Pier -- rot
}
\addlyrics {
  \set stanza = "2."
  Au clair de la lu -- ne,
  Test-syllabe-longue-Pier -- rot ré -- pon -- dit
}


Cordialement,
Jean





reply via email to

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