Text spanner padding

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Text spanner padding

Andrew Bernard
I am attempting to use a text spanner as an indicator for a repeated section. I need it to stop at the barline, and not on the next note. Shortening it by using padding on the right affects the first line as well, which is not wanted. How does one do this properly?

And my usual question, is there a proper way to do this rather than trying to bend a text spanner into it?

Sometimes I may want 17x or 5x, etc, not just twice, or 3x. And I want the dashed line effect.

Andrew

%====
\version "2.19.82"

leftBracketPath =
#'((moveto 0 -1)
   (lineto 0 0)
   (lineto 2 0)
   )

rightBracketPath =
#'((lineto 2 0)
   (lineto 2 -1)
   )

treble = {
  \time 2/4

  \once \override TextSpanner.dash-period = #1
  \once \override TextSpanner.bound-details.left.text =
  \markup {
    \path #0.25 #leftBracketPath \general-align #Y #CENTER \sans \upright " x3"
  }
  \once \override TextSpanner.bound-details.right.text =
  \markup {
    \general-align #Y #CENTER \sans \upright " x3" \path #0.25 #rightBracketPath
  }
  \once \override TextSpanner.bound-details.left-broken.text = ##f
  \once \override TextSpanner.bound-details.right-broken.text = ##f
  \override TextSpanner.bound-details.right.padding = #11

  f'''1\startTextSpan f''' f'''
  \break
  f'''
  \bar "."
  f'''\stopTextSpan
  \bar "||"
}

\score {
  \new Staff { \treble }
  \layout {}
}

%====


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Text spanner padding

Andrew Bernard
Is the proper answer to this LSR 954? If so, how could one put the text at the start and the end, not in the middle? And change the line style to dashed or different?

Andrew


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Text spanner padding

Andrew Bernard
Solved. It's right-broken-padding set to false that does the trick.

  \override TextSpanner.bound-details.right-broken.padding = ##f
  \override TextSpanner.bound-details.right.padding = #11

Andrew


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Text spanner padding

Trevor Bača-2


On Fri, Feb 22, 2019 at 2:58 AM Andrew Bernard <[hidden email]> wrote:
Solved. It's right-broken-padding set to false that does the trick.

  \override TextSpanner.bound-details.right-broken.padding = ##f
  \override TextSpanner.bound-details.right.padding = #11


As a note for posterity (whenever the time comes to finally equip text spanners with their remaining missing features), it would be fantastic to allow text spanners to start (and stop) nonmusical items, like bar lines.

Then magic numbers (like 11, in the example here) can be replaced by something semantic that says "stop text span on bar line", which seems to be what Andrew is actually engraving in this excerpt.

Trevor.

--

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Text spanner padding

David Kastrup
Trevor Bača <[hidden email]> writes:

> On Fri, Feb 22, 2019 at 2:58 AM Andrew Bernard <[hidden email]>
> wrote:
>
>> Solved. It's right-broken-padding set to false that does the trick.
>>
>>   \override TextSpanner.bound-details.right-broken.padding = ##f
>>   \override TextSpanner.bound-details.right.padding = #11
>>
>
>
> As a note for posterity (whenever the time comes to finally equip text
> spanners with their remaining missing features), it would be fantastic to
> allow text spanners to start (and stop) nonmusical items, like bar lines.
>
> Then magic numbers (like 11, in the example here) can be replaced by
> something semantic that says "stop text span on bar line", which seems to
> be what Andrew is actually engraving in this excerpt.
So?  There is the to-barline property.


\version "2.19.82"

leftBracketPath =
#'((moveto 0 -1)
   (lineto 0 0)
   (lineto 2 0)
   )

rightBracketPath =
#'((lineto 2 0)
   (lineto 2 -1)
   )

treble = {
  \time 2/4

  \once \override TextSpanner.dash-period = #1
  \once \override TextSpanner.bound-details.left.text =
  \markup {
    \path #0.25 #leftBracketPath \general-align #Y #CENTER \sans \upright "
x3"
  }
  \once \override TextSpanner.bound-details.right.text =
  \markup {
    \general-align #X #RIGHT
    \general-align #Y #CENTER \line { \sans \upright " x3" \path #0.25
#rightBracketPath }
  }
  \once \override TextSpanner.bound-details.left-broken.text = ##f
  \once \override TextSpanner.bound-details.right-broken.text = ##f
  \once \override TextSpanner.to-barline = ##t
  \override TextSpanner.bound-details.right.padding = #0

  f'''1\startTextSpan f''' f'''
  \break
  f'''
  \bar "."
  f'''\stopTextSpan
  \bar "||"
}

\score {
  \new Staff { \treble }
  \layout {}
}



--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Text spanner padding

Trevor Bača-2


On Thu, Feb 28, 2019 at 4:10 PM David Kastrup <[hidden email]> wrote:
Trevor Bača <[hidden email]> writes:

> On Fri, Feb 22, 2019 at 2:58 AM Andrew Bernard <[hidden email]>
> wrote:
>
>> Solved. It's right-broken-padding set to false that does the trick.
>>
>>   \override TextSpanner.bound-details.right-broken.padding = ##f
>>   \override TextSpanner.bound-details.right.padding = #11
>>
>
>
> As a note for posterity (whenever the time comes to finally equip text
> spanners with their remaining missing features), it would be fantastic to
> allow text spanners to start (and stop) nonmusical items, like bar lines.
>
> Then magic numbers (like 11, in the example here) can be replaced by
> something semantic that says "stop text span on bar line", which seems to
> be what Andrew is actually engraving in this excerpt.

So?  There is the to-barline property.

Hi David,

This is extremely useful. Thank you so much for sending over the example; I had no idea to-barline was implemented on TextSpanner.

A cleaned up the example for future archive-searchers:

%%% TEXT SPANNER TO BARLINE (MID-SYSTEM) %%%

\version "2.19.82"

left-bracket-path = #'(
    (moveto 0 -1)
    (lineto 0 0)
    (lineto 2 0)
    )

right-bracket-path = #'(
    (lineto 2 0)
    (lineto 2 -1)
    )

repeat-spanner-start-markup = \markup {
    \path #0.25 #left-bracket-path
    \general-align #Y #CENTER
    \sans \upright " x3"
    }

repeat-spanner-stop-markup = \markup {
    \general-align #X #RIGHT
    \line {
        \general-align #Y #CENTER
        \sans \upright " x3"
        \path #0.25 #right-bracket-path
        }
    }

\new Staff
{

    c'1
    - \tweak bound-details.left.text \repeat-spanner-start-markup
    - \tweak bound-details.left-broken.text ##f
    - \tweak bound-details.right.padding 0
    - \tweak bound-details.right.text \repeat-spanner-stop-markup
    - \tweak bound-details.right-broken.text ##f
    - \tweak dash-period 1
    - \tweak staff-padding 4
    - \tweak to-barline ##t
    \startTextSpan

    c'1
    \break

    c'1

    c'1
    \stopTextSpan

}

\paper {
    indent = 0
    system-system-spacing = #'((minimum-distance . 20))
}

%%% END %%%

text-spanner-to-barline.png


IMPORTANT NOTE: the likely-to-be-overlooked key here is "\general-align #X #RIGHT" included in the definition of the markup used *at the right end* of the spanner. (In this example, repeat-spanner-stop-markup.)

Equally astonishingly, the example can be made to work at line breaks:

%%% TEXT SPANNER TO BARLINE (END-OF-SYSTEM) %%%

\version "2.19.82"

left-bracket-path = #'(
    (moveto 0 -1)
    (lineto 0 0)
    (lineto 2 0)
    )

right-bracket-path = #'(
    (lineto 2 0)
    (lineto 2 -1)
    )

repeat-spanner-start-markup = \markup {
    \path #0.25 #left-bracket-path
    \general-align #Y #CENTER
    \sans \upright " x3"
    }

repeat-spanner-stop-markup = \markup {
    \general-align #X #RIGHT
    \line {
        \general-align #Y #CENTER
        \sans \upright " x3"
        \path #0.25 #right-bracket-path
        }
    }

\new Staff
{

    c'1
    - \tweak bound-details.left.text \repeat-spanner-start-markup
    - \tweak bound-details.left-broken.text ##f
    - \tweak bound-details.right.padding 0
    - \tweak bound-details.right.text \repeat-spanner-stop-markup
    %%%- \tweak bound-details.right-broken.text ##f
    - \tweak dash-period 1
    - \tweak staff-padding 4
    - \tweak to-barline ##t
    \startTextSpan

    c'1
    \break

    c'1
    \stopTextSpan

    c'1

}

\paper {
    indent = 0
    system-system-spacing = #'((minimum-distance . 20))
}

%%% END %%%
 
text-spanner-to-barline-at-line-break.png

These examples are hugely important if you are engraving extensively with text spanners.

I had assumed that these were gaps in Lily's functionality; good to see I was wrong.


Trevor.

--

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user