[Top][All Lists]

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


From: Carl D. Sorensen
Subject: Re:
Date: Wed, 29 Apr 2009 05:31:32 -0600

On 4/29/09 3:12 AM, "Marc Hohl" <address@hidden> wrote:

> Neil Puttock schrieb:
>> 2009/4/27 Carl D. Sorensen <address@hidden>:
>>> Neil,
>>> Thanks for your input.  I think it's all really good.
>>> On 4/26/09 1:49 PM, "Neil Puttock" <address@hidden> wrote:
>>>> 2009/4/25 Marc Hohl <address@hidden>:
>>> Marc, there are probably at least two ways to do this.  The easiest one
>>> would be to take each of these magic numbers and divide them by the default
>>> staff-space setting, and then change to something like
>>> (base-skip (cond ((= 4 num-strings) (* staff-space 1.03))
>>> and so forth.  (1.03 = 1.55/1.5)  And you'd need to find the value of
>>> staff-space in order to be able to do this multiplication.

> Ok, as Neil has posted somewhere else in this thread, the formula works
> only with a
> fixed staff-space. But I don't know how to find the value of staff-space.
> I think it could be done similar to the proposals for the line-count
> (see below), but this is far beyond my possibilities - any help is highly
> appreciated!

See below for my comment.

>>> There are two issues that I can't address:
>>> 1) I wasn't able to figure out how to get stringTunings in a music function
>>> or a markup function.   How do we do that?
>> You don't need to know stringTunings, since it's possible to access
>> 'line-count from any grob which is placed on a StaffSymbol:
>> (let* ((staff-symbol (ly:grob-object grob 'staff-symbol))
>>        (line-count (ly:grob-property staff-symbol 'line-count)))
> This is way beyond my knowledge of the internals. I simply added these lines
> accordingly in my definition of customTabClef:
> #(define-markup-command (customTabClef layout props tuning) (pair?)
>     (define (square x) (* x x))
>     (let* ((staff-symbol (ly:grob-object 'grob 'staff-symbol))
>            (num-strings (ly:grob-property staff-symbol 'line-count))
>            (font-size (- (* num-strings 1.5) 7))
>            (base-skip (square (+ (* num-strings 0.195) 0.4))))
>        (interpret-markup layout props
>          (markup #:vcenter #:bold
>                  #:override #'(cons 'font-family 'sans)
>                  #:fontsize font-size
>                  #:override #'(cons 'baseline-skip base-skip)
>                  #:left-align
>                  #:center-column ("T" "A" "B")))))
> but this doesn't work. Lilypond complains with
> Unbound variable: grob
> How can I assign the right value to this symbolic variable?

This was meant to be applied along with Neil's earlier comment about
changing from using ly:text-interface::print for the 'stencil to using
grob-interpret-markup.  I've included his comments below:

>>> % Wrappers for the different clefs
>>> % the argument is the string-tuning, which is automatically set.
>>> sansSerifTabClef = #(define-music-function (parser location tuning) (pair?)
>>>   #{
>>>      \override TabStaff.Clef #'stencil = #ly:text-interface::print
>> Use grob-interpret-markup instead of ly:text-interface::print:
>> \override TabStaff.Clef #'stencil = $(lambda (grob)
>> (grob-interpret-markup grob (make-customTabClef-markup tuning)))
>> The docs are slightly lagging behind here, but
>> ly:text-interface::print should only be used with objects which
>> support text-interface.

When you define 'stencil to be a function of some object  (lambda(grob) is a
function with one parameter), LilyPond will call that function with the
parameter of the grob that is supposed to be printed -- in this case, the
clef.  So then, grob will exist and will have the capability of learning
about both 'line-count and 'staff-space.

If this doesn't point you in the right direction, please let me know.

Thanks again for doing this!


reply via email to

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