Hello,

Fiddling around with the snippet "Centering markup on noteheads
automatically," http://lsr.dsi.unimi.it/LSR/Item?id=637 I came up with
something which might be useful (or duplicate a far easier solution!). I
realize that it doesn't address the problem of center-aligning only the
dynamic (the function seems to align the left edge of the dynamic with the
note -- hence my guess at an offset of 0.6).  Of course, this offset would
have to be adjusted for "pp" "ppp," etc.  At least this will give similar
results for "p, dolce" "p, espressivo" and so on.

\version "2.12.3"

pcantabile = #(
  make-dynamic-script (
   markup #:line (
        #:dynamic "p" #:hspace -1 #:normal-text   #:italic ", cantabile"
   )
 )
)

dynamicTextLeftAlign = \once \override DynamicText #'X-offset =
#(lambda (grob)
    (-
      (+
        (ly:self-alignment-interface::x-aligned-on-self grob)
        (interval-center
        (ly:grob-robust-relative-extent grob grob X)))
     0.6))

{
  \dynamicTextLeftAlign
  a'\pcantabile b' c' d'
}

________________
> lilypond-user mailing list
> lilypond-user@gnu.org
> http://lists.gnu.org/mailman/listinfo/lilypond-user
>
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to