[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Integrating a markup in a music-function
From: |
Thomas Morley-2 |
Subject: |
Re: Integrating a markup in a music-function |
Date: |
Thu, 10 Jul 2014 01:54:01 -0700 (PDT) |
Schneidy wrote
> Hi List,
>
> On the French forum Remy and I (see:
> http://lilypond-french-users.1298960.n2.nabble.com/instrumentName-sur-plusieurs-lignes-dans-une-fonction-tt7581499.html)
> are stucked with a markup function.
>
> Here we are so far :
>
> \version "2.18.2"
>
> #(define (general-column align-dir baseline mols)
> (let* ((aligned-mols (map (lambda (x) (ly:stencil-aligned-to x X
> align-dir)) mols)))
> (stack-lines -1 0.0 baseline aligned-mols)))
>
> #(define-markup-command (textCenter layout props args)(markup-list?)
> #:properties ((baseline-skip))
> (general-column CENTER baseline-skip (wordwrap-internal-markup-list
> layout props #f args)))
>
> shortIncipit =
> #(define-music-function (parser location InstrName ) (markup?)
> #{
> \set Staff.instrumentName = \markup {
> \override #'(line-width . 12)
> #InstrName
> }
> #})
>
> myInst = \markup\textCenter { Cantus primi chori }
>
> \layout {
> indent = 30
> }
>
> { \shortIncipit\myInst c' }
>
> What we would like is to integrate \textCenter in the shortIncipit
> function
> in order to be able to write :
>
> { \shortIncipit #"Cantus primi chori" c' }
>
> Anyone ?
>
> Cheers,
> Pierre
Hi Pierre,
try:
\version "2.18.2"
#(define (general-column align-dir baseline mols)
(let* ((aligned-mols
(map (lambda (x) (ly:stencil-aligned-to x X align-dir)) mols)))
(stack-lines -1 0.0 baseline aligned-mols)))
#(define-markup-command (center-text-string layout props arg)
(string?)
#:properties ((baseline-skip)
wordwrap-string-internal-markup-list)
(general-column CENTER baseline-skip
(wordwrap-string-internal-markup-list layout props #f arg)))
shortIncipit =
#(define-music-function (parser location instr-name ) (markup?)
#{
\set Staff.instrumentName =
\markup {
\override #'(line-width . 12)
\center-text-string #instr-name
}
#})
\layout { indent = 30 }
{ \shortIncipit "Cantus primi chori" c' }
OT: I'm replying via the nabble-interface, because your post didn't appear
in my mails til now. Currently it seems I miss several mails.
Some of them I notice, when they are quoted.
Others with the same experience?
Cheers,
Harm
--
View this message in context:
http://lilypond.1069038.n5.nabble.com/Integrating-a-markup-in-a-music-function-tp164214p164234.html
Sent from the User mailing list archive at Nabble.com.