lilypond-user
[Top][All Lists]
Advanced

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

Re: Rather involved TextSpanner edge-text Scheme markup question


From: Trevor Bača
Subject: Re: Rather involved TextSpanner edge-text Scheme markup question
Date: Mon, 18 Sep 2006 08:32:38 -0500

On 9/18/06, Markus Schneider <address@hidden> wrote:
I forgot: more importantly, use \combine to print the markups on top of each
other. That may take care of your horizontal space problem.

Markus

"Markus Schneider" <address@hidden> schrieb im Newsbeitrag
news:address@hidden
> Hi Trevor,
>
> you may try to use the "fake" letter f. It has all the necessary ascenders
> and descenders to fake the basline. I use this with dynamics.
>
> pX     = #(make-dynamic-script (markup #:combine #:transparent #:dynamic
"f"
> #:line(#:hspace 0 #:dynamic "p"     #:hspace 0)))
>
> HTH
> Markus

Hi Markus,

Thank you so much. The \combine command was precisely what I needed,
and the fake "f" trick works, as well, resulting in cleaner input.

Here're the results.

%%% BEGIN EDGE TEXT ALIGNMENT SNIPPET 5 %%%

\version "2.9.17"

\new Staff \with {
  \override TextSpanner #'dash-fraction = #'()
  \override TextSpanner #'direction = #down
  \override TextSpanner #'bound-padding = #1
} <<
  \time 3/8
  \new Voice {
     c'8 c'8 c'8
  }
  \new Voice \with {
     \override TextSpanner #'staff-padding = #3
  } {
     \override TextSpanner #'edge-text = #(cons
        (markup #:combine #:transparent "f" "a")
        (markup #:combine #:transparent "f" " "))
     s8 \startTextSpan
     \override TextSpanner #'edge-text = #(cons
        (markup #:combine #:transparent "f" "b")
        (markup #:combine #:transparent "f" "c"))
     s8 \stopTextSpan \startTextSpan
     s8 \stopTextSpan
  }
  \new Voice \with {
     \override TextSpanner #'staff-padding = #5.5
  } {
     \override TextSpanner #'edge-text = #(cons
        (markup #:combine #:transparent "f" "d")
        (markup #:combine #:transparent "f" " "))
     s8 \startTextSpan
     \override TextSpanner #'edge-text = #(cons
        (markup #:combine #:transparent "f" "d")
        (markup #:combine #:transparent "f" "f"))
     s8 \stopTextSpan \startTextSpan
     s8 \stopTextSpan
  }
  \new Voice \with {
     \override TextSpanner #'staff-padding = #8
  } {
     \override TextSpanner #'edge-text = #(cons
        (markup #:combine #:transparent "f" "g")
        (markup #:combine #:transparent "f" " "))
     s8 \startTextSpan
     \override TextSpanner #'edge-text = #(cons
        (markup #:combine #:transparent "f" "h")
        (markup #:combine #:transparent "f" "i"))
     s8 \stopTextSpan \startTextSpan
     s8 \stopTextSpan
  }


%%% END EDGE TEXT ALIGNMENT SNIPPET 5 %%%

There's a pic attached (baseline-aligned.png) with perfectly aligned
spanners and a gamut of lowercase letters all magically
baseline-aligned (thanks again, to the ascender- and
descender-properties of the "f" glyph).


Mats's and Han-Wen's suggestion to set the dimensions of each bit of
edge text explicitly with the \with-dimensions command also works and,
out of the box, gives *bottom-aligned* rather than *baseline-aligned*
results.

%%% BEGIN EDGE TEXT ALIGNMENT SNIPPET 6 %%%

\version "2.9.17"

\new Staff \with {
  \override TextSpanner #'dash-fraction = #'()
  \override TextSpanner #'direction = #down
  \override TextSpanner #'bound-padding = #1
} <<
  \time 3/8
  \new Voice {
     c'8 c'8 c'8
  }
  \new Voice \with {
     \override TextSpanner #'staff-padding = #3
  } {
     \override TextSpanner #'edge-text = #(cons
        (markup #:with-dimensions '(0 . 0) '(-2 . 2) "a")
        (markup #:with-dimensions '(0 . 0) '(-2 . 2) " "))
     s8 \startTextSpan
     \override TextSpanner #'edge-text = #(cons
        (markup #:with-dimensions '(0 . 0) '(-2 . 2) "b")
        (markup #:with-dimensions '(0 . 0) '(-2 . 2) "c"))
     s8 \stopTextSpan \startTextSpan
     s8 \stopTextSpan
  }
  \new Voice \with {
     \override TextSpanner #'staff-padding = #5.5
  } {
     \override TextSpanner #'edge-text = #(cons
        (markup #:with-dimensions '(0 . 0) '(-2 . 2) "d")
        (markup #:with-dimensions '(0 . 0) '(-2 . 2) " "))
     s8 \startTextSpan
     \override TextSpanner #'edge-text = #(cons
        (markup #:with-dimensions '(0 . 0) '(-2 . 2) "e")
        (markup #:with-dimensions '(0 . 0) '(-2 . 2) "f"))
     s8 \stopTextSpan \startTextSpan
     s8 \stopTextSpan
  }
  \new Voice \with {
     \override TextSpanner #'staff-padding = #8
  } {
     \override TextSpanner #'edge-text = #(cons
        (markup #:with-dimensions '(0 . 0) '(-2 . 2) "g")
        (markup #:with-dimensions '(0 . 0) '(-2 . 2) " "))
     s8 \startTextSpan
     \override TextSpanner #'edge-text = #(cons
        (markup #:with-dimensions '(0 . 0) '(-2 . 2) "h")
        (markup #:with-dimensions '(0 . 0) '(-2 . 2) "i"))
     s8 \stopTextSpan \startTextSpan
     s8 \stopTextSpan
  }


%%% END EDGE TEXT ALIGNMENT SNIPPET 6 %%%

See bottom-aligned.png.

Playing with the arguments passed into \with-dimensions will probably
enable all sorts of interesting results (though I suspect that getting
the appearance of baseline alignment will almost certainly be easier
with the combined, transparent "f").

Thank you, everybody. This helps tremendously.


--
Trevor Bača
address@hidden

Attachment: baseline-alignment.png
Description: PNG image

Attachment: bottom-aligned.png
Description: PNG image


reply via email to

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