Showing posts with label text alignment. Show all posts
Showing posts with label text alignment. Show all posts

Wednesday, June 24, 2009

TextSpanner alignment, TextScript alignment



The 2, 3 and 4 in the image all center directly above the first chord in the measures they govern.

The 2 and 3 are LilyPond TextScript grobs. The 4 is the left text of a LilyPond TextSpanner grob.

Center alignment for TextScript and TextSpanne grobs differ.

To (horizontally) center a TextScript relative to the note to which it refers, use \once \override TextScript #'self-alignment-X = #center together with \once \override TextScript #'X-offset = #center. This pair of settings is easy enough to stumble across in the LilyPond docs.

To horizontally center the left text of a TextSpanner, use \once \override TextSpanner #'bound-details #'left #'text = \markup { \halign #0 "FOO" } together with \once \override TextSpanner #'bound-details #'left #'attach-dir = #center. The 'attach-dir is easy enough to find, but knowing to use \halign *internal to the markup* takes some real doing.

Thursday, May 22, 2008

LilyPond baseline alignment

Baseline alignment of TextSpanner text takes some work in LilyPond.



The primary tricks to get that bit there are the \transparent and \combine markup commands, together with faking the right ascender- and descender-heights with an "f". All parts of that come from Markus, and thank God because I spent a good amount of time on the problem this weekend and only got partway there.

Tuesday, April 22, 2008

LilyPond text spanner text with \halign

Text spanner text can align directly in markup. Use \halign



\new Staff {
c'4
\override TextSpanner #'bound-details #'left #'stencil-align-dir-y =
#center
\override TextSpanner #'bound-details #'left #'text =
\markup { \halign #-1 \italic "vif" \hspace #2 }
c'4 \startTextSpan
c'4
c'4 \stopTextSpan
}


\new Staff {
c'4
\override TextSpanner #'bound-details #'left #'stencil-align-dir-y =
#center
\override TextSpanner #'bound-details #'left #'text =
\markup { \halign #0 \italic "vif" \hspace #2 }
c'4 \startTextSpan
c'4
c'4 \stopTextSpan
}


\new Staff {
c'4
\override TextSpanner #'bound-details #'left #'stencil-align-dir-y =
#center
\override TextSpanner #'bound-details #'left #'text =
\markup { \halign #1 \italic "vif" \hspace #2 }
c'4 \startTextSpan
c'4
c'4 \stopTextSpan
}

The reference point is, in each case, the left edge of the attachment note.