lilypond-user
[Top][All Lists]
Advanced

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

Re: Tuning description at beginning of TabStaff


From: Jean Abou Samra
Subject: Re: Tuning description at beginning of TabStaff
Date: Tue, 31 Jan 2023 14:48:26 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0

On 30/01/2023 22:45, Stefan E. Mueller wrote:

> This works for me, but I wonder if the vertical position of the individual
> tablature lines could be accessed and used for the positioning of the
> letters instead of doing things by hand.


Yes, it's possible. Try

\version "2.25.1"

% doesn't exist?
#(define (grob-interpret-markup-list grob mkuplist)
   (let* ((layout (ly:grob-layout grob))
          (defs (ly:output-def-lookup layout 'text-font-defaults))
          (chain (ly:grob-alist-chain grob defs)))
     (interpret-markup-list layout chain mkuplist)))

displayTuning =
#(define-music-function (padding tuning) (number? markup-list?)
   (let ((tuning #{ \markuplist \fontsize #-3 \general-align #X #RIGHT 
\general-align #Y #CENTER #tuning #}))
     #{
       \override TabStaff.StaffSymbol.stencil =
         #(grob-transformer
           'stencil
           (lambda (grob original)
             (let* ((staff-space (ly:staff-symbol-staff-space grob)))
               (ly:stencil-add
                original
                (apply ly:stencil-add
                       (map (lambda (stil pos)
                              (let* ((stil (ly:stencil-translate-axis stil (- 
padding) X))
                                     (stil (ly:stencil-translate-axis stil (* 
1/2 staff-space pos) Y)))
                                stil))
                            (grob-interpret-markup-list grob tuning)
                            (ly:grob-property grob 'line-positions)))))))
     #}))


%%%


\new TabStaff \with {
  \override InstrumentName.self-alignment-X = #RIGHT
  \override InstrumentName.padding = 1.5
  \displayTuning 0.6 \markuplist { d b g D A D }
  instrumentName = \markup {
    \center-column {
      " "
      \raise #-0.4
      "Ac. Guitar"
      \override #'(font-size . -1.5)
      "(Double Drop-D)"
      " "
    }
  }
  shortInstrumentName = "git"
  stringTunings = \stringTuning <d, a, d g b d'>
} {
  d,8\6 d'\2 d\4 d'\1 d,8\6 d'\2 d4\4
}



Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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