Hi Urs,
I've been learning a lot watching you work through these
text alignment problems over the last months. Thanks for
these, and for the clarity of the writing as you've been
developing the Lily code as you work!
I have no answer to the question at the end of your
previous mail ("why does the combination of these three tweaks
work?"). However, I wanted to mention that I've found --
finally -- a solution for baseline-aligned textual annotations
that's been working for me in my own scores now for about a
year: sticking all the text in a text spanner with invisible
line segments between each element in the spanner.
I remember reading through a thread where this text spanner
approach for vertical alignment came up, and I remember you
had good reasons for continuing to work with individual
TextScript objects instead. But I just wanted to pipe up and
add that after years of going the
text-script-with-staff-padding route (and never getting 100%
"stable" results in the vertical positioning), that switching
last year to the text-spanner-with-invisible-segments route
has finally yielded a solution that seems genuinely stable.
For years, the missing piece had been that Lily didn't
allow multiple overlapping text spanners in a single voice;
that's a nonstarter in much (probably most) recent music, of
course. But then David Nalesnik provided a solution, all the
way back in 2015:
I now have a bunch of custom spanner definitions using
David's alternateTextSpannerEngraver, which implements
spanner-id, allowing for layered spanners. David's
alternateTextSpannerEngraver should *absolutely* be included
by default in Lily; I'll write that to the appropriate thread
in a bit. At any rate, output like this now works consistently
for me, for the first time in 13 years of using Lily:
(The fractions show "bow contact points": 0 for talon; 1
for point; 1/2 for midway up the bow; etc. The T and P are
tasto and ponticello, as you'd expect.)
So, even though that example draws the text spanner line
segments in a visible way (dashed or solid), you can easily
imagine setting dash-fraction to 0 to make segments invisible,
leaving markup aligned in the correct way.
Ok, that's it; I know you're elaborating the
text-script-with-staff-padding way of working. But just wanted
to attest that the text spanner way does seem to be a viable
alternative if you later become interested in that way of
working, too.
Trevor.