lilypond-user
[Top][All Lists]
Advanced

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

Re: columns in lyrics


From: address@hidden
Subject: Re: columns in lyrics
Date: Thu, 24 Nov 2011 15:10:01 +0100

On Nov 24, 2011, at 3:05 PM, Jan-Peter Voigt wrote:

Hey Mike,

here's one, that splits up strings to columns. So its the other way round than your bonus point part. But it should save typing, because

\markup \column { foo bar } \markup \column { who what } \markup \column { hello world }

turns to

\cols { "foo bar" "who what" "hello world" }

--snip--
\version "2.14.2"

#(define-public cols (define-music-function (parser location lyrics) (ly:music?)
    (music-map
      (lambda (m)
              (begin
                ;; catch every Lyric Event
                (if (equal? (ly:music-property m 'name) 'LyricEvent)
                    ;; set text to column markup using string-split (and markup->string for safety)
                    (let ((syl (string-split (markup->string (ly:music-property m 'text)) #\ )))
                         (ly:music-set-property! m 'text (make-center-column-markup syl)) ; you might want to use another one like make-column-markup
                ))
                m))
      lyrics)))


\relative c'' {
  c2 b a
} \addlyrics {
  \cols { "foo bar" "who what" "hello world" }
}

You still get bonus points!  It'll definitely save me time typing - many thanks!

All the best,
Mike


reply via email to

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