lilypond-user
[Top][All Lists]
Advanced

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

Re: aligning text in text spanner


From: Jean Abou Samra
Subject: Re: aligning text in text spanner
Date: Wed, 16 Nov 2022 20:52:29 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1



Le 16/11/2022 à 16:26, Martín Rincón Botero a écrit :
Hello, the following code produces text on both sides of the spanner that looks vertically well aligned with the upper limit of its box instead of the inferior one:

{
  f'1
  ~
  - \tweak style #'line
  - \tweak bound-details.left.stencil-align-dir-y #CENTER
  - \tweak bound-details.right.arrow ##t
  - \tweak bound-details.right.stencil-align-dir-y #CENTER
  - \tweak bound-details.left.text \markup \normal-text "ord."
  - \tweak bound-details.right.text \markup \normal-text "s.p."
  \startTextSpan
  f'1
  :32
  \stopTextSpan
}

produces

imagen.png

where the "s.p." vertically aligns well with the upper end of the "d" in "ord.". How can I achieve the opposite? Namely, that the "s.p." (or the "p") aligns with the bottom of "ord." so that it looks centered?



You need to adjust stencil-align-dir-y as needed:


\version "2.23.81"

{
  f'1
  ~
  - \tweak style #'line
  - \tweak bound-details.left.stencil-align-dir-y #-0.3
  - \tweak bound-details.right.arrow ##t
  - \tweak bound-details.right.stencil-align-dir-y #0.2
  - \tweak bound-details.left.text \markup \normal-text "ord."
  - \tweak bound-details.right.text \markup \normal-text "s.p."
  \startTextSpan
  f'1
  :32
  \stopTextSpan
}


If you want to get rid of manual tweaking, consider giving
the two texts the same vertical extents:

\version "2.23.81"

{
  f'1
  ~
  - \tweak style #'line
  - \tweak bound-details.left.stencil-align-dir-y #CENTER
  - \tweak bound-details.right.arrow ##t
  - \tweak bound-details.right.stencil-align-dir-y #CENTER
  - \tweak bound-details.left.text \markup \normal-text \with-dimension-from #Y \overlay { "ord." "s.p." } "ord."   - \tweak bound-details.right.text \markup \normal-text \with-dimension-from #Y \overlay { "ord." "s.p." } "s.p."
  \startTextSpan
  f'1
  :32
  \stopTextSpan
}


Best,
Jean

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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