lilypond-user
[Top][All Lists]
Advanced

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

Re: tablature.ly


From: Neil Puttock
Subject: Re: tablature.ly
Date: Sat, 2 May 2009 17:16:28 +0100

2009/5/2 Marc Hohl <address@hidden>:

> Ok, so I inserted the following lines in my scm/parser-clef.scm:
>
> ;; a function to add new clefs at runtime
> (define-public (add-new-clef clef-name clef-glyph clef-position octaviation
> c0-position)
>  "Append the entries for a clef symbol to supported clefs and
> c0-pitch-alist"
>  (set! supported-clefs
>       (acons clef-name (list clef-glyph clef-position octaviation)
> supported-clefs))
>  (set! c0-pitch-alist
>       (acons clef-glyph c0-position c0-pitch-alist)))
>
> [ I don't know if everything is correct, see below, but when everything
> works, I'll send patches.]

That looks fine.  I'd just suggest changing `octaviation' to `octavation'.

> I tried to follow your suggestions, and after some trial and error, I have
> rearranged my tablature.ly as follows (see attachment):
>
> #(add-new-clef "moderntab" "markup.moderntab" 0 0 0)
>
> % this function decides which clef to take
> #(define (clef::print-modern-tab-if-set grob)
>   (let* ((glyph (ly:grob-property grob 'glyph)))
>         (if (eq? glyph "markup.moderntab")

You can't compare strings using eq?; try equal? or (more idiomatic
since we know 'glyph is a string) string=?

>             (ly:modern-tab-clef::print grob)
>             (ly:clef::print grob))))
>
>
> #(define (ly:modern-tab-clef::print grob)

I don't think it's necessary to split this out of the function above.

Also, `ly:' is reserved for Scheme functions which have been exported
from the C++ source.

>  (ly:grob-property grob 'staff-space 1)
>  (let* ((staff-symbol (ly:grob-object grob 'staff-symbol))
>            (line-count   (ly:grob-property staff-symbol 'line-count))
>            (staff-space  (ly:grob-property staff-symbol 'staff-space)))
>            (grob-interpret-markup grob (make-customTabClef-markup line-count
> staff-space))))
>
>>
>> Two further points:
>>
>> Just to be on the safe side, when retrieving 'staff-space, a default
>> value should be given, since it's not normally set:
>>
>> (ly:grob-property grob 'staff-space 1)
>>
>
> Is this line placed properly? I don't understand this quite right, does this
> line
> define the default value if 'staff-space is not set at all and doesn't
> override 'staff-space
> if it s set before?

I mean add `1' to the the following line:

(staff-space (ly:grob-property staff-symbol 'staff-space 1)

If 'staff-space can't be found, i.e., it's not set, then
ly:grob-property will return the default value instead.

>> As I mentioned previously, unless you want to code a smaller clef for
>> changes, you'll want to set 'full-size-change = ##t.  This will shut
>> up any complaints about missing a glyph for "markup.moderntab_change".
>>  You can set it within the new stencil callback using
>> ly:grob-set-property!:
>>
>> (ly:grob-set-property! grob 'full-size-change #t)
>>
>
> Where have I to put this? I surely want changes to be enabled for the
> standard clefs,
> so I have to put it after the comparison for "markup.moderntab". On the
> other hand,
> when it's put too late, then 'glyph has the value "markup.moderntab_change",
> so the test for
> "markup.moderntab" will fail.

Actually, you can forget this, since it seem to work fine without
overriding 'full-size-change.

> And a final question:
> I put the override for the TabStaff.Clef #'stencil into \tabNumbersOnly
> resp.
> \tabFullNotation, so if the user doesn't call one of these commands, the
> clef
> selection mechanism won't work. Is there a workaround, or - even better -
> can \tabNumbersOnly be invoked automatically when tablature.ly is included?
> This doesn't alter the defaults for older files but would give the desired
> functionality
> (i.e. numbers only) for tablature users.

You could place all the default overrides inside a \layout block, in
the same manner as the settings for TabVoice are done in
engraver-init.ly.

> Anyway, when I put all the pieces together, lilypond still complains about
> not finding
> "markup.moderntab", so I have made some mistakes.

Only the string matching, so you've done really well all things considered.

Regards,
Neil




reply via email to

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