On 2020-04-08 1:26 pm, Kevin Barry wrote:
Hi Lilypond users,
I am trying to get something to work by setting the X-offset of a grob
using ly:grob-set-property but I must be doing something wrong,
because it seems to have no effect. Can anyone explain what I'm doing
wrong? Below is a minimal example showing what I mean.
%%%
\version "2.19.84"
{
\override TextScript.X-offset = 10
c' ^"this is offset"
}
{
\override TextScript.after-line-breaking =
#(lambda (grob)
(ly:grob-set-property! grob 'X-offset 10))
c' ^"this isn't offset"
}
%%%
If you use before-line-breaking, the change in position applies. For
after-line-breaking, I believe you need to use ly:grob-translate-axis!,
which would have the same effect as using extra-offset. But note that
the staff lines do not extend all the way to the right because they are
calculated with the untranslated extents. Also see below an example of
\offset for reference:
%%%%
\version "2.20.0"
{
c' \offset X-offset 10 ^"this is offset"
}
{
\override TextScript.before-line-breaking =
#(lambda (grob)
(ly:grob-set-property! grob 'X-offset 10))
c' ^"this is offset"
}
{
\override TextScript.after-line-breaking =
#(lambda (grob)
(ly:grob-translate-axis! grob 10 X))
c' ^"this is offset"
}
%%%%
-- Aaron Hill