lilypond-user
[Top][All Lists]
Advanced

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

Re: ly:make-stencil arguments question


From: Urs Liska
Subject: Re: ly:make-stencil arguments question
Date: Thu, 19 Jan 2017 09:48:49 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0

Hi Harm,

thank you very much!


Am 18.01.2017 um 21:18 schrieb Thomas Morley:
> 2017-01-18 11:15 GMT+01:00 Urs Liska <address@hidden>:
>>
>> Am 18.01.2017 um 11:13 schrieb Urs Liska:
>>> See attached file which is derived from
>>> http://lsr.di.unimi.it/LSR/Snippet?id=623.
>>>
>> Sorry, please *ignore* the attachment of the previous post, here's the
>> correct one.
>>
> In
>
> customClefStencil =
>   #(ly:make-stencil
>     `(path 0.2
>       `(rmoveto 0 0
>      ...
>
> the second ` is unneeded ' would work as well.

OK, I had realized that already (the ` came from the LSR snippet), but
that didn't help me further because ...
>
>
> To insert a function, unquote the function-call, and quote the result:
>
> func =
> #(define-scheme-function (val)(number?)
>   (list
>     'rmoveto 0 0
>     'rcurveto 0 (+ 0.75 val) 1 (+ 0.75 val) 1 0
>     'rcurveto 0 (- -0.75 val) -1 (- -0.75 val) -1 0))
>
>
> customClefStencilOne =
>   #(ly:make-stencil `(path 0.2 ',(func 1))

... I wouldn't have ever thought of that ', combination.

I had yet another complication because in my actual case "func" would
return an arbitrary number of path segments (i.e. lists) that had to be
flattened with

(apply append (map l-arc (make-list l-count dir)))

with l-arc being the function and l-count being an argument how often
this arc has to be generated.

Thanks a lot, *this* topic is solved now (more to come ;-) )

Best
Urs

>      (cons -0.5 1)
>      (cons -3 5))
>
> customClefOne = \override Staff.Clef.stencil = \customClefStencilOne
>
> \relative c' {
>   \customClefOne
>   \clef "alto"
>   c1
> }
>
>
> HTH,
>   Harm

-- 
address@hidden
https://openlilylib.org
http://lilypondblog.org




reply via email to

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