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: Thomas Morley
Subject: Re: note head extents and event procedures (tabstaff)
Date: Wed, 23 Dec 2015 00:13:19 +0100

2015-12-22 20:24 GMT+01:00 Steve Fullerton <address@hidden>:
>  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.


Hi Steve,

I never worked with bendAfter before, so it took some time to get a
bit familiar with it _and_ because it's so weird:

(1) BendAfter is ignored by the spacing-engine! Is this really intended?
Switch to `test-stil' in the code at the end of this mail to test.
(2) It's behaviour is buggy if ledger-lines come into play, see the
attached untweaked png

code for it:

\version "2.19.32"

{
  e''4..\2\bendAfter #1
  a''4..\2\bendAfter #1
}

Thus, cc-ing bug-list.


Nevertheless in most cases translating the newly created stencil by
the car of the original-X-extent will work:

\version "2.18.2"

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
  "

stil =
#(lambda (grob) (grob-interpret-markup grob (markup #:postscript psBendArrow)))

test-stil =
#(lambda (grob) (grob-interpret-markup grob "xxxxxx"))

foo =
\override BendAfter.after-line-breaking =
  #(lambda (grob)
     (ly:grob-set-property! grob 'stencil
       (ly:stencil-translate-axis
          ;; nb, settings for BendAfter doesn't affect spacing!
          ;; switch to `test-stil' to watch this
          (stil grob)
          ;(test-stil grob)
          (car (ly:grob-property grob 'X-extent))
          X)))

mus = {
  e''4\2\bendAfter #1
  a''4\2\bendAfter #1
}

\score {
  <<
    \new Staff \mus
    \new TabStaff \mus
  >>
  \layout {
    \foo
    \context {
      \TabStaff
      \tabFullNotation
    }
  }
}


Cheers,
  Harm

Attachment: atest-28-untweaked-bend.png
Description: PNG image

Attachment: atest-28-tweaked-bend.png
Description: PNG image


reply via email to

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