lilypond-user
[Top][All Lists]
Advanced

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

Re: How to change TabNoteHead


From: Thomas Morley
Subject: Re: How to change TabNoteHead
Date: Sat, 6 Jul 2013 19:51:52 +0200

2013/7/6 Rachael Thomas Carlson <address@hidden>:
> Hello:
>
> I am attempting to change the TabNoteHead through what the
> documentation calls 'Modifying stencils' (chp. 5.5.3).  I can't seem to
> get the stencil override to work.  I have been able to change the
> TabNoteHead through the use of postscript like in one of the snippets
> (http://lsr.dsi.unimi.it/LSR/Item?id=516) but I would rather use the
> musicglyphs in the Feta font than have to manually create each object.
>
> With that being said, I would love to be able to change the
> TabNoteHead by any means.  \deadNotes looks great but I need more
> options.
>
> I have attached a png of what I am attempting.
>
> Here is the code that does not work for me:
>
> \version "2.16.2"
>
> tick = {
>         \once \override TabNoteHead #'stencil = #ly:text-interface::print
>         \once \override TabNoteHead #'text = \markup { \musicglyph
> #"noteheads.s0la" }
> }
>
> \new TabStaff {
>         c8 \tick c8 c8 c8 }
>
> Thank you kindly,
> Rachael

Hi Rachael,

the TabNoteHead already supports the text-interface.
\override TabNoteHead #'stencil = #ly:text-interface::print is needless than.

\override TabNoteHead #'text = \markup {...}
doesn't work, because a new text needs to be inserted very early in
the compiling-process, afaik.

You could use:

\version "2.16.2"

tick = {
        \once \override TabNoteHead #'before-line-breaking =
        #(lambda (grob)
          (ly:grob-set-property!
            grob
            'text
            #{ \markup { \musicglyph #"noteheads.s0la" } #} ))
}

\new TabStaff {
        c8 \tick c8 c8 c8 }

Though, I'd prefer one of the following codings
(I recommend the second if you want to do more frequently)

\version "2.16.2"

%%%
% First possibility.
%%%

tick¹ = {
        \once \override TabNoteHead #'stencil =
        #(lambda (grob)
          (grob-interpret-markup grob
          #{
                  \markup { \musicglyph #"noteheads.s0la" }
          #}))
}

%%%
% Second possibility.
%%%

#(define (new-stil markup)
;; Creates a stencil
  (lambda (grob)
    (grob-interpret-markup grob markup)))

newTabNoteHead =
#(define-music-function (parser location mrkp)(markup?)
;; Uses @code{new-stil} in a music-function.
;; Ofcourse it's possible to use:
;; @samp{\\once \\override TabNoteHead #'stencil =
;;         #(new-stil #{ \\markup { \musicglyph #"noteheads.s0la" } #})}
;; directly.
#{
  \once \override TabNoteHead #'stencil = #(new-stil mrkp)
#})

% creating a variable as sort of schortcut.
tick² = \newTabNoteHead \markup { \musicglyph #"noteheads.s0la" }

\new TabStaff {
        \tabFullNotation
        c8 \tick¹ c8 c8 \tick² c8 }

HTH,
  Harm



reply via email to

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