Hello James,

Yes, that is certainly a much easier solution.  For some reason when I tried
your override last night, it had no effect -- hence my experimenting.  I
suppose I must have placed it badly, because now it works just fine.

Anyway, best of luck!

On Tue, Jan 26, 2010 at 12:15 AM, James Bailey
<derhindem...@googlemail.com>wrote:

>
> On 26.01.2010, at 02:01, David Nalesnik wrote:
>
> 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'
> }
>
>
> Given that the values would probably have to be changed in different
> context, hard-coding a number to this is really not a very good solution.
> Also, since the alignment is easily achieved with \once \override
> DynamicText #'X-offset = -1. It's far easier to just use that, and always
> get the alignment I want. However, you did give me a brilliant idea. Chain
> the two together. instead of having a variable assigned to the dynamic +
> text and a variable to the shift, I can just have a variable assigned to do
> both at the same time, i.e., pcantabile = \once \override … #(
> make-dynamic-script…
>
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to