lilypond-user
[Top][All Lists]
Advanced

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

Re: [issue 1482] \caps \fromproperty and markup->string


From: David Kastrup
Subject: Re: [issue 1482] \caps \fromproperty and markup->string
Date: Thu, 06 Oct 2011 19:39:11 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Jan-Peter Voigt <address@hidden> writes:

> Am 06.10.2011 um 16:12 schrieb:
>
>> Vaughan McAlley <address@hidden> writes:
>> 
>>> 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.
>> 
>>> Thank you! It worked first time! I hope it becomes part of standard
>>> Lilypond...
>> 
>> Personally, I think this is far too hackish for a user interface.  It
>> would make more sense to create a music function that just converts a
>> markup list into lyric events, then use \lyricsto or \addlyrics for
>> tacking the rhythm on.
>
> why do you think it is too hackish? If it gets lily-standard, all
> visible to the user is something like this:
> If he wants a non-pre-defined lyric-markup:
> lyrcaps = #(define-lyric-markup (markup #:recaps #:fromproperty 'lyric:text))
>
> and then \addlyrics/\lyricmode { sing \lyrcaps { sing sing sing }  }

First he needs a special markup function recaps that recursively calls
\caps and does nothing else.  This is rather hard to define for a user.
What if he wants italics instead?  Then he needs to jiggle this together
with some magic #:fromproperty markup, then it mixes with something
else.  I mean, get real: how would he ever manage to italize lyrics that
way?

> Most of the scheme stuff is to overcome the issue with caps and
> fromproperty. It is a workaround to get the desired result in the
> current stable version.

"overcome the issue", "workaround".  If that is not the definition of a
hack...

Now let's take a look at my approach.

lyricize =
#(define-music-function (parser location mlist) (markup?)
  (define (sig m) (if (string? m) m
                   (and (proper-list? m) (= (length m) 2) (sig (cadr m)))))
  (make-sequential-music
   (map (lambda (m)
         (let ((s (sig m)))
          (cond
           ((equal? s "--") (make-music 'HyphenEvent 'origin location))
           ((equal? s "__") (make-music 'ExtenderEvent 'origin location))
           (else (make-music 'LyricEvent 'text (list (car mlist) (list m))
                  'origin location
                  'duration (ly:make-duration 0 0))))))
    (cadr mlist))))

\new Staff <<
  \new Voice { c'2. d'4 e'2 c'2}
  \addlyrics \notemode {\lyricize \markup \italic {A- ve Ma- ter! }}
  \addlyrics \notemode {\lyricize \markup \caps {Et Pa- tr- ia! }}
  \addlyrics \notemode {\lyricize \markup \caps \fontsize #3 {A- "" men __ }}
>>

The user interface is still clunky due to deficiencies in the parser (I
have not yet looked at lyricsmode), so the \notemode is a nuisance, and
a few other ughs.

But it requires far less specialized macros and stuff.  Personally, I'd
prefer it if lyricsmode just accepted \markuplines and spliced all its
elements individually into a music list.  But I can't do everything at
once.

-- 
David Kastrup



reply via email to

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