[Top][All Lists]

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


From: Marc Hohl
Subject: Re:
Date: Sun, 03 May 2009 15:21:26 +0200
User-agent: Thunderbird (X11/20090318)

Neil Puttock schrieb:
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
 "Append the entries for a clef symbol to supported clefs and
 (set! supported-clefs
      (acons clef-name (list clef-glyph clef-position octaviation)
 (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'.
Ups, that's a "germanism". In Germay, we say "Oktavierung" and even "Tabulatur", so
I have to look more carefully in the future.
I tried to follow your suggestions, and after some trial and error, I have
rearranged my 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=?
Ok, I didn't know that.
            (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

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
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.
Ah, now this makes sense to me.
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! 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
\tabFullNotation, so if the user doesn't call one of these commands, the
selection mechanism won't work. Is there a workaround, or - even better -
can \tabNumbersOnly be invoked automatically when is included?
This doesn't alter the defaults for older files but would give the desired
(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

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.
Thank you for your help, I will write a new example file and send all patches and stuff to Carl when I'm ready for it.


reply via email to

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