lilypond-user
[Top][All Lists]
Advanced

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

Re: Text alignment


From: Thomas Morley
Subject: Re: Text alignment
Date: Wed, 15 Oct 2014 00:06:43 +0200

Hi Marco,

please always reply to all.

2014-10-13 5:40 GMT+02:00 Marco Bagolin <address@hidden>:
> Oh, ok!
> the code of MySample1.png is the following:
>
> \version "2.18.2"
>
> \relative c''
>
> {e1 \trill \p \< |
>      b'1 \trill|
>      <e b>1
>       \trill
>       ^\markup {\tiny \italic \halign #2 \raise #1.5 div.}
>       ^\markup {\tiny "(both trill)"}
>    <<
>      {b1 \trill}
>      \\
>      {\set Staff.ottavation = #"Half 8va (opt.)"
>       \hideNotes
>         b4 b b b
>       \unset Staff.ottavation
>      }
>    >>
> R1\!
> }
>
> I'd like to reproduce exactly what you can see in Sample1.png.

Sorry to come back to you that late.

Maybe the following code does what you want:

\version "2.19.13"

\paper {
    ragged-right = ##f
    indent = 0
}

#(define ((add-right-to-default-script mrkp) grob)
  (let* ((stil (ly:script-interface::print grob))
         (X-offset (ly:grob-property grob 'X-offset))
         (layout (ly:grob-layout grob))
         (defs (ly:output-def-lookup layout 'text-font-defaults))
         (word-space (assoc-get 'word-space defs))
         ;(props (ly:grob-alist-chain grob defs))
         (addition
           (grob-interpret-markup
             grob
             (markup #:normal-text mrkp)))
         (combined-stil
           (ly:stencil-combine-at-edge
             stil
             X
             RIGHT
             addition
             word-space)))

    combined-stil))


add-right-to-script =
#(define-event-function (parser location mrkp music)(markup? ly:music?)
  #{
    \tweak #'stencil #(add-right-to-default-script mrkp)
    $music
  #})

\relative c'' {
     e1 \trill \p \< |
     b'1*7/8 \trill
     s8-\tweak #'padding #1.5 ^\markup { \tiny \italic div. }
     <e b>1
       -\tweak #'padding #0.8
       \add-right-to-script
       \markup {
                  %{\italic %}
                  %{ \hspace #1 %}
                  \fontsize #-1
                  "(both trill)"
       }
       \trill
     \override Staff.OttavaBracket.style = #'solid
     \set Staff.ottavation =
       \markup
         \halign #0
         \fontsize #-1
         "Half 8va (opt.)"
     b1*7/8
     \trill
     s16. \once \hideNotes b32 |
     R1\!
     \unset Staff.ottavation
}


HTH,
  Harm



reply via email to

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