On Thu, Feb 28, 2019 at 4:10 PM David Kastrup <[email protected]> wrote:

> Trevor Bača <[email protected]> writes:
>
> > On Fri, Feb 22, 2019 at 2:58 AM Andrew Bernard <[email protected]
> >
> > 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 %%%

[image: 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 %%%

[image: 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.

-- 
Trevor Bača
www.trevorbaca.com
soundcloud.com/trevorbaca
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to