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: Martín Rincón Botero
Subject: Re: aligning text in text spanner
Date: Wed, 16 Nov 2022 21:59:40 +0100

Thank you! I would've never been able to figure that out by myself! By the way, shouldn't \with-dimension(-from) be documented here https://lilypond.org/doc/v2.23/Documentation/notation/dimensions.html ? This is a good snippet for the repository, I think (I actually wonder why this is not the default behavior...).

Am Mi., 16. Nov. 2022 um 20:52 Uhr schrieb Jean Abou Samra <jean@abou-samra.fr>:


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



--
www.martinrinconbotero.com

reply via email to

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