Hm,
after sending this request for help I (hopefully) found a solution
myself. But I don't pretend to understand it ...
Am 29.01.19 um 10:55 schrieb Urs Liska:
Hi,
I was struggling with this earlier, but suggestions from the list
didn't help me and I had to postpone the issue. Now I've got to
resolve it and while I make progress I don't seem to be able to get to
the goal line :-(
I am trying to create a text command that prints items at a specific
distance from the staff (in order to have multiple items on the same
baseline). The behaviour of staff-padding is good enough for me, that
is if one of the items is forced to be farther away to prevent
collisions with the music I'm OK with adjusting the staff-padding for
*all* items.
My problem is that the created markup should push other items to the
right rather have them stack vertically as is the standard behaviour
of TextScript - but only if there actually *is* such an item. Using
\textLengthOn always pushes the next note column to the right, even
when that doesn't have a text attached.
...
However, I don't actually use a literal value for staff-padding but a
callback function that modifies the staff-padding according to the
direction. And as soon as staff-padding is set to that (any) callback
function the behaviour is again like using \textLengthOn, as can be
seen in the attached 'wrong.png' where the second note is wrongly
pushed to the right:
...
#(define (create-foo text)
#{
-\tweak extra-spacing-width #(cons -0.0 .8)
-\tweak outside-staff-priority ##f
-\tweak staff-padding #calc-staff-padding
-\markup #text
#})
...
Can anyone explain why the TextScript is behaving differently when
staff-padding is tweaked to a literal or to a callback? And - more
importantly - how I can achieve my goal?
Well, as said I seem to have achieved my goal, but I would be happy to
understand it better. As said tweaking 'staff-padding to a callback
function makes the spacing behave like with \textLengthOn (i.e.
extra-spacing-width and -height set). If on the other hand I tweak
before-line-breaking to a callback, and within that callback set the
staff-padding property of the grob to the calculated value there doesn't
seem to be such a side effect.
#(define (apply-staff-padding grob)
(ly:grob-set-property! grob 'staff-padding (calc-staff-padding grob)))
...
-\tweak before-line-breaking #apply-staff-padding
-\markup #text
Any clarification?
Thanks
Urs
Thanks
Urs
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user