[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [issue 1482] \caps \fromproperty and markup->string
From: |
Vaughan McAlley |
Subject: |
Re: [issue 1482] \caps \fromproperty and markup->string |
Date: |
Fri, 7 Oct 2011 00:54:30 +1100 |
On 7 October 2011 00:12, Jan-Peter Voigt <address@hidden> wrote:
> Hi Vaughan,
>
> I introduced the define-lyric-markup method a few mails ago, so it is no
> lilypond standard.
> Here I added methods to your file and used the recaps command, I introduced
> in a revious mail, to capsify markups recursively whatching out for
> \fromproperty.
> This way it compiles fine on my machine:
> --snip--
> \version "2.14.2"
>
> % to define a lyric-function
> #(define-public (define-lyric-markup mup)
> (define-music-function (parser location lyrics) (ly:music?)
> (music-map
> (lambda (m)
> (begin
> (if (equal? (ly:music-property m 'name) 'LyricEvent)
> (let ((syl (ly:music-property m 'text)))
> (ly:music-set-property! m 'text (markup #:override
> (cons 'lyric:text syl) mup))))
> m))
> lyrics)))
>
> % apply caps to all strings found in m
> #(define-public (rcaps m . mprops)
> (let ((layout (if (> (length mprops) 0) (car mprops) #f))
> (props (if (> (length mprops) 1) (cadr mprops) '()))
> (mup? (lambda (m)(or (string? m)(list? m)(markup? m))))
> (ret (markup)))
> (set! ret
> (cond
> ((string? m) (markup #:caps m))
> ((null? m) "")
> ((and (pair? m)(equal? (car m) fromproperty-markup))
> (rcaps (chain-assoc-get (cadr m) props "???")))
> ((and (pair? m)(markup-function? (car m))) (cons (car m)
> (map (lambda (mup)(if (mup? mup) (rcaps mup layout props)
> mup)) (cdr m))))
> ((list? m)
> (map (lambda (mup)(rcaps mup layout props)) m))
> (else "ERROR, unable to caps markup"))
> )
> ret)
> )
> % recursive caps markup command
> #(define-markup-command (recaps layout props mup)(markup?)
> (interpret-markup layout props (rcaps mup layout props)))
>
>
> lyrcaps = #(define-lyric-markup (markup #:recaps #:fromproperty
> 'lyric:text))
>
> staffOne = "Soprano"
>
> staffOneMusic = \relative c' {
> \clef "treble" \key f \minor \time 2/2
>
> c'1 \melisma ees \melismaEnd ees2 c c ees ees ees f f |
> ees1 c2 c2 c \melisma bes \melismaEnd aes aes des1 c|
> \bar "||"
> c1~ \melisma c2 bes~ bes aes bes1 aes \melismaEnd |
> r2 des \melisma ees1 f~ f2 ees f \melismaEnd des \melisma c1~ c
> \melismaEnd |
> \bar "||"
> }
>
> staffOneLyrics = \lyricmode {
> De __ la -- men -- ta -- ti -- o -- ne Je -- re -- mi -- æ pro --
> phe -- tæ,
> pro -- phe -- tæ.
>
> \lyrcaps { Mem, __ Mem, __ Mem. __ }
>
> }
>
> \score {
>
> \new Staff
> <<
> \new Voice = \staffOne {
> \set Staff.instrumentName=\staffOne
> \staffOneMusic
> }
> \new Lyrics \lyricsto \staffOne { \staffOneLyrics }
>>>
> }
> --snip--
>
> Cheers, Jan-Peter
>
>> Hi Jan-Peter,
>>
>> Thank you very much for your help with small-caps. I have been trying
>> to use the functions you listed but I am getting an unbound variable
>> error. Could you work out what is wrong with the code please? I’ve
>> made it as short as possible!
>>
>> --snip--
>> home:lilypond vaughan$ lilypond test6.ly
>> GNU LilyPond 2.14.2
>> Processing `test6.ly'
>> Parsing...
>> test6.ly:21:11: error: GUILE signaled an error for the expression
>> beginning here
>> lyrcaps = #
>> (define-lyric-markup (markup #:frompropertysmallcaps
>> 'lyric:text))
>> Unbound variable: define-lyric-markup
>>
>> --snip-- test6.ly
>>
>> \version "2.14.2"
>>
>> #(define-markup-command (fromproperty layout props symbol)
>> (symbol?)
>> (let ((m (chain-assoc-get symbol props))
>> (caps? (chain-assoc-get 'caps props)))
>> (if (markup? m)
>> (interpret-markup layout props
>> (if caps?
>> (make-smallCaps-markup m)
>> m))
>> empty-stencil)))
>>
>>
>>
>> #(define-markup-command (caps layout props arg) (markup?)
>> (interpret-markup layout (prepend-alist-chain 'caps #t props)
>> (make-smallCaps-markup arg)))
>>
>>
>> lyrcaps = #(define-lyric-markup (markup #:frompropertysmallcaps
>> 'lyric:text))
>>
>> staffOne = "Soprano"
>>
>> staffOneMusic = \relative c' {
>> \clef "treble" \key f \minor \time 2/2
>>
>> c'1 \melisma ees \melismaEnd ees2 c c ees ees ees f f |
>> ees1 c2 c2 c \melisma bes \melismaEnd aes aes des1 c|
>> \bar "||"
>> c1~ \melisma c2 bes~ bes aes bes1 aes \melismaEnd |
>> r2 des \melisma ees1 f~ f2 ees f \melismaEnd des \melisma c1~ c
>> \melismaEnd |
>> \bar "||"
>> }
>>
>> staffOneLyrics = \lyricmode {
>> De __ la -- men -- ta -- ti -- o -- ne Je -- re -- mi -- æ pro --
>> phe -- tæ,
>> pro -- phe -- tæ.
>>
>> \lyrcaps { Mem, __ Mem, __ Mem. __ }
>>
>> }
>>
>> \score {
>>
>> \new Staff
>> <<
>> \new Voice = \staffOne {
>> \set Staff.instrumentName=\staffOne
>> \staffOneMusic
>> }
>> \new Lyrics \lyricsto \staffOne { \staffOneLyrics }
>> >>
>> }
>>
>>
>> -- snip --
>>
>> Cheers,
>> Vaughan
>>
>
>
>
>
Thank you! It worked first time! I hope it becomes part of standard Lilypond...
Cheers,
Vaughan
- [issue 1482] \caps \fromproperty and markup->string, Jan-Peter Voigt, 2011/10/06
- Message not available
- Re: [issue 1482] \caps \fromproperty and markup->string, Jan-Peter Voigt, 2011/10/06
- Re: [issue 1482] \caps \fromproperty and markup->string,
Vaughan McAlley <=
- Re: [issue 1482] \caps \fromproperty and markup->string, David Kastrup, 2011/10/06
- Re: [issue 1482] \caps \fromproperty and markup->string, Jan-Peter Voigt, 2011/10/06
- Re: [issue 1482] \caps \fromproperty and markup->string, David Kastrup, 2011/10/06
- Re: [issue 1482] \caps \fromproperty and markup->string, Vaughan McAlley, 2011/10/06
- Re: [issue 1482] \caps \fromproperty and markup->string, Jan-Peter Voigt, 2011/10/07
- Re: [issue 1482] \caps \fromproperty and markup->string, David Kastrup, 2011/10/07
- Re: lyricmarkup (was [issue 1482] \caps \fromproperty and markup->string, came from lyricmarkup), Jan-Peter Voigt, 2011/10/07
- Re: lyricmarkup (was [issue 1482] \caps \fromproperty and markup->string, came from lyricmarkup), David Kastrup, 2011/10/07