Re: self-alignment-X on DynamicTextSpanner?

2022-01-31 Thread Simon Albrecht
Thanks, Jean and Valentin, for the replies. I’ll certainly be able to 
achieve the result that I want.


However, I do think that DynamicTextSpanner should simply use properties

bound-details.left.self-alignment-X and
bound-details.left.parent-alignment-X

for this, by default. attach-dir doesn’t seem very descriptive and it 
deviates from the way horizontal alignment is normally specified in 
LilyPond, and likewise being able to specify self-alignment-X would seem 
to be the normal thing to expect.


I’ll submit such a request to the bug list.

Best, Simon

On 31/01/2022 11:51, Valentin Petzel wrote:

Hello Simon,

You need to use bound-details.left for these kind of things. There you have
the property attach-dir, which acts like parent-alignment-X for the endpoint.
This one defaults to LEFT, so you cannot really get any further by this. The
other way is to use the text property to add a \right-align to have the actual
markup aligned to the right (you might want to change attach-dir to CENTER, as
the fff does the same.

We can infact add some sugar for this, like here.

Cheers,
Valentin

Am Sonntag, 30. Jänner 2022, 22:20:58 CET schrieb Simon Albrecht:

Hi List,

is there an equivalent to self-alignment-X for the left bound text of a
DynamicTextSpanner? See below.

Best, Simon

\version "2.23.5"

{
1-\tweak self-alignment-X 1 \fff
1
% this causes alignment to just fail indiscriminately
% (not a surprise, because I couldn’t find out how to use this property)
%-\tweak left-bound-info.self-alignment-X 0
% this is simply an offset against the default placement (default
#'(-.75 . -.5))
%-\tweak bound-details.left.stencil-offset #'(-3 . 0)
% I’m not sure what this does at all
%-\tweak bound-details.left.attach-dir -3
\cresc
1
1
1
1\!
}




Re: self-alignment-X on DynamicTextSpanner?

2022-01-31 Thread Valentin Petzel
Hello Simon,

You need to use bound-details.left for these kind of things. There you have 
the property attach-dir, which acts like parent-alignment-X for the endpoint. 
This one defaults to LEFT, so you cannot really get any further by this. The 
other way is to use the text property to add a \right-align to have the actual 
markup aligned to the right (you might want to change attach-dir to CENTER, as 
the fff does the same.

We can infact add some sugar for this, like here.

Cheers,
Valentin

Am Sonntag, 30. Jänner 2022, 22:20:58 CET schrieb Simon Albrecht:
> Hi List,
> 
> is there an equivalent to self-alignment-X for the left bound text of a
> DynamicTextSpanner? See below.
> 
> Best, Simon
> 
> \version "2.23.5"
> 
> {
>1-\tweak self-alignment-X 1 \fff
>1
>% this causes alignment to just fail indiscriminately
>% (not a surprise, because I couldn’t find out how to use this property)
>%-\tweak left-bound-info.self-alignment-X 0
>% this is simply an offset against the default placement (default
> #'(-.75 . -.5))
>%-\tweak bound-details.left.stencil-offset #'(-3 . 0)
>% I’m not sure what this does at all
>%-\tweak bound-details.left.attach-dir -3
>\cresc
>1
>1
>1
>1\!
> }\version "2.23.5"

{
   1-\tweak self-alignment-X 1 \fff
   1
   -\tweak text \markup\right-align\italic"cresc."
   -\tweak bound-details.left.attach-dir 0
   \cresc
   1
   1
   1
   1\!
}

\score {
{
   1-\tweak self-alignment-X 1 \fff
   1
   -\tweak details.text-alignment 1
   -\tweak bound-details.left.attach-dir 0
   \cresc
   1
   1
   1
   1\!
}
\layout {
  \override Score.DynamicTextSpanner.stencil =
  #(lambda (grob)
 (let* ((det (ly:grob-property grob 'details))
(text (ly:grob-property grob 'text))
(algn (assoc-get 'text-alignment det LEFT))
(new-text (markup #:halign algn text)))
   (ly:grob-set-property! grob 'text new-text)
   (ly:line-spanner::print grob)))
}
}

signature.asc
Description: This is a digitally signed message part.


Re: self-alignment-X on DynamicTextSpanner?

2022-01-30 Thread Jean Abou Samra

Le 30/01/2022 à 22:20, Simon Albrecht a écrit :

Hi List,

is there an equivalent to self-alignment-X for the left bound text of 
a DynamicTextSpanner? See below.


Best, Simon

\version "2.23.5"

{
  1-\tweak self-alignment-X 1 \fff
  1
  % this causes alignment to just fail indiscriminately
  % (not a surprise, because I couldn’t find out how to use this 
property)

  %-\tweak left-bound-info.self-alignment-X 0
  % this is simply an offset against the default placement (default 
#'(-.75 . -.5))

  %-\tweak bound-details.left.stencil-offset #'(-3 . 0)
  % I’m not sure what this does at all
  %-\tweak bound-details.left.attach-dir -3
  \cresc
  1
  1
  1
  1\!
}



To explain the behavior with left-bound-info: this is an
internal property that gets populated with values from
bound-details and values computed automatically.  If you
override a subproperty, since callbacks aren't supported
for subproperties, you just override the calculation of
this property from bound-details and logic, and there
is nothing in it but the suboverride you have done.
Then it's not surprising that everything starts going
wrong.

To answer the question: attach-dir is the equivalent of
parent-alignment-X, controlling where on the note head
(left, center, right, intermediate values) the reference
point of the text goes.  There is no direct equivalent
for self-alignment-X, but you can do

\version "2.22.1"

{
  1-\tweak self-alignment-X 1 \fff
  1\tweak bound-details.left.text \markup \general-align #X #0 "cresc." 
\cresc

  1
  1
  1
  1\!
}


Best regards,
Jean




self-alignment-X on DynamicTextSpanner?

2022-01-30 Thread Simon Albrecht

Hi List,

is there an equivalent to self-alignment-X for the left bound text of a 
DynamicTextSpanner? See below.


Best, Simon

\version "2.23.5"

{
  1-\tweak self-alignment-X 1 \fff
  1
  % this causes alignment to just fail indiscriminately
  % (not a surprise, because I couldn’t find out how to use this property)
  %-\tweak left-bound-info.self-alignment-X 0
  % this is simply an offset against the default placement (default 
#'(-.75 . -.5))

  %-\tweak bound-details.left.stencil-offset #'(-3 . 0)
  % I’m not sure what this does at all
  %-\tweak bound-details.left.attach-dir -3
  \cresc
  1
  1
  1
  1\!
}