Jump to content

How to bottom-align texts with different vertical extents

From LilyPond wiki

Some letters imply smaller vertical extents than the others; if you have, below your staff, two markups with different vertical extents (e.g. one text with letters t,h,l and/or UPPER CASE and one text with a, c, e, n or m), LilyPond will align them to the top by default, thus making it look a bit messy. Therefore, you need to add invisible ascender letters using the \transparent command to make it right.

\version "2.24.0"

%% http://lsr.di.unimi.it/LSR/Item?id=652

\new Staff {
  \override TextScript.staff-padding = #4
  \override TextScript.self-alignment-X = #CENTER
  \textLengthOn
  \time 2/4
  c'4_\markup { \combine \transparent f WRONG }
  c'4_\markup { case }
  c'4_\markup { \combine \transparent f RIGHT }
  c'4_\markup { \combine \transparent f case }
}