Re: [tablatures] cross-style note heads in tablature

[ Thread Index | Date Index | More lilynet.net/tablatures Archives ]


Patrick Schmidt schrieb:
[...]
I didn't manage to engrave cross-style note heads inside or outside chords in tablature staves with this code. Here's my example:

[...]

sorry, I had tuned my 2.13.3 so it worked for me, but of course not anywhere else.

Please add some callbacks like this:

\version "2.13.3"

#(define-public (tab-note-head::calc-glyph-name grob)
 (let ((style (ly:grob-property grob 'style)))
  (case style
     ((cross) "2cross"))))

#(define (tab-note-head::whiteout-if-style-set grob)
 (let ((style (ly:grob-property grob 'style)))
      (if (and (symbol? style)
               (eq? style 'cross))
          (stencil-whiteout (ly:note-head::print grob))
          (ly:text-interface::print grob))))
\layout {
 \context {
   \TabVoice
   \override TabNoteHead #'glyph-name = #tab-note-head::calc-glyph-name
   \override TabNoteHead #'stencil = #tab-note-head::whiteout-if-style-set
 }
}

x =
#(define-music-function (parser location note) (ly:music?)
(if (eq? (ly:music-property note 'name) 'NoteEvent)
    ;; yes -> add a tweak
    (begin (set! (ly:music-property note 'tweaks)
                  (acons 'style 'cross (ly:music-property note 'tweaks)))
     note)
     #{
       \override TabNoteHead #'style = #'cross
       \override NoteHead #'style = #'cross
       $note
       \revert TabNoteHead #'style
       \revert NoteHead #'style
     #}))

xhead = \relative c {
 \x< c  e  g>4
 <c e \x g>

}

\score {
 <<
  \new Staff = "guitar traditional" <<
       \clef "treble_8"
       \context Voice = "xhead"  \xhead
    >>
  \new TabStaff = "guitar tab" <<
       \context TabVoice = "xhead"  \xhead
    >>
 >>
}

I installed a clean 2.13.3 and checked, it works as expected.

Marc



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/