lilypond-user
[Top][All Lists]
Advanced

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

re: note head extents and event procedures (tabstaff)


From: Steve Fullerton
Subject: re: note head extents and event procedures (tabstaff)
Date: Tue, 22 Dec 2015 13:24:51 -0600 (CST)

 I wasn't very clear in my first post. I've included an example this time.

I am taking over the bendAfter stencil and drawing something else in its place. However the 'width' calculation in the code below doesn't account for double digit fret numbers. I think it is returning the width of a music note, not the width of a tab note. Changing ly:note-head to ly:tab-note-head doesn't work either.

I have a couple of questions. 

1. How do you work out the position of the right side of the tab note head so I can position my markup correctly?

2. Is there a better way to do this or is taking over a stencil the right way to do this? In other words, what is the best way to draw stuff to the left or right of a tab note? 

I am only concerned about TabStaff here so if the solution doesn't work for Staff it is not a problem. 

Thanks for your help.

\version "2.18.2"

\header {
  title = "Test Choke"
}

MUSIC = {
  \key g \major
  \time 4/4
  
  e'4\2\bendAfter #1  a'4\2\bendAfter #1 s2
}

psBendArrow = #"
  0.1 setlinewidth
  0.0 -0.75 moveto
  0.0 -0.75 0.2 -0.75 0.4 0 curveto
  0.4 0.9 lineto
  stroke
  0.4 1.0 moveto
  0.1 0.5 lineto
  0.7 0.5 lineto
  closepath fill
  "

\score
{
  \new TabStaff
    \with { \omit StringNumber }
  {
    \tabFullNotation
    \numericTimeSignature
    \set TabStaff.tablatureFormat = #fret-number-tablature-format-banjo
    \set TabStaff.stringTunings = #banjo-open-g-tuning
    \override TabStaff.Clef #'stencil = ##f
\override TabStaff.BendAfter #'stencil = #(lambda (grob) 
(let* (
        (X-extent (ly:stencil-extent (ly:note-head::print grob) 0))
         (width (- (cdr X-extent) (car X-extent)))
)
     (grob-interpret-markup grob 
       #{ 
            \markup\concat { \hspace #width \postscript #psBendArrow }
       #})))

\MUSIC
  }
}

\layout
{
  indent = #0
  ragged-last = ##t
}


reply via email to

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