| Re: [tablatures] cross-style note heads in tablature | 
[ Thread Index | 
Date Index
| More lilynet.net/tablatures Archives
] 
- To: tablatures@xxxxxxxxxxx
- Subject: Re: [tablatures] cross-style note heads in tablature
- From: Marc Hohl <marc@xxxxxxxxxx>
- Date: Thu, 10 Sep 2009 09:43:08 +0200
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1252568590; l=1643;	s=domk; d=hohlart.de;	h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References:	Subject:To:MIME-Version:From:Date:X-RZG-CLASS-ID:X-RZG-AUTH;	bh=0jUvddRgcXPax1mx3a6rOkQaWpE=;	b=VE1WN4cxMhs3Hzvc1FEaHTJM1fF5oU3kW1fKR6+qoCACwxhKmzHDbcNAeOq7rQ4a1Hk	jqiWm1LqjPFOvpoS7P2VMYql7XWuSWxL0ogQX8sjdf12g/2wrhH+WepnTs3WHH9XGecI5	k7SzLP/Brs7M6ii29brk8iQcFsWtGCq3Vcw=
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