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.

No comments: