Finetuning TextSpanner beginning and end positions?

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Finetuning TextSpanner beginning and end positions?

Stefano Troncaro
Hello again everyone,

I was expecting to be able to use shorten-pair for this in the same way that is used with Hairpins, but it doesn't seem to work and I can't seem to find what property I need to tweak.

Any pointers?
Thanks for your help,
Stéfano

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Finetuning TextSpanner beginning and end positions?

Rick Kimpel-2
Stefano,
Have you tried bound-details? I use this for glissandi, and it works well.
Rick


From: lilypond-user <lilypond-user-bounces+rick.kimpel=[hidden email]> on behalf of Stefano Troncaro <[hidden email]>
Sent: Monday, May 6, 2019 11:50 AM
To: lilypond-user Mailinglist
Subject: Finetuning TextSpanner beginning and end positions?
 
Hello again everyone,

I was expecting to be able to use shorten-pair for this in the same way that is used with Hairpins, but it doesn't seem to work and I can't seem to find what property I need to tweak.

Any pointers?
Thanks for your help,
Stéfano

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Finetuning TextSpanner beginning and end positions?

Stefano Troncaro
Hi Rick,

Thank you for your answer. I didn't know that 'bound-details had an X property. It does what I need but it can get tedious to use because I need to specify a number from the start of the spanner (or the system if the spanner is broken into many systems). It takes some trial and error to find the right number and all that work is undone if the spacing changes.

That however led me to writing this function that offsets the 'X value of the 'right-bound-info property, which is the procedure that calculates where the spanner ends. I'm copying it here so it can be used if someone finds it useful or is searching for a similar question in the future.

\version "2.19.83"

ALB-OffsetRBNfo-X =
#(define-scheme-function (n) (number?)
   "Offset the X position at the end of a breakable object that determines its X position
    through the 'right-bound-info procedure."
   (lambda (grob)
     (let* ((bound-right (ly:spanner-bound grob RIGHT))
            (broken-right (= (ly:item-break-dir bound-right) CENTER)))
       (if broken-right
           (let* ((rbnfo (ly:grob-property grob 'right-bound-info #f))
                  (rbnfo (map (lambda (pair)
                                (if (eq? 'X (car pair))
                                    (cons 'X (+ (cdr pair) n))
                                    pair))
                           rbnfo)))
             (ly:grob-set-property! grob 'right-bound-info rbnfo))))))

\relative {
  \override TextSpanner.bound-details.left.text = "sample spanner"
  \override TextSpanner.after-line-breaking = \ALB-OffsetRBNfo-X 15
  c'\startTextSpan d e f | g a g f \break | e f e d | c1\stopTextSpan
}



El lun., 6 may. 2019 a las 17:27, Rick Kimpel (<[hidden email]>) escribió:
Stefano,
Have you tried bound-details? I use this for glissandi, and it works well.
Rick


From: lilypond-user <lilypond-user-bounces+rick.kimpel=[hidden email]> on behalf of Stefano Troncaro <[hidden email]>
Sent: Monday, May 6, 2019 11:50 AM
To: lilypond-user Mailinglist
Subject: Finetuning TextSpanner beginning and end positions?
 
Hello again everyone,

I was expecting to be able to use shorten-pair for this in the same way that is used with Hairpins, but it doesn't seem to work and I can't seem to find what property I need to tweak.

Any pointers?
Thanks for your help,
Stéfano

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Finetuning TextSpanner beginning and end positions?

Thomas Morley-2
Am Di., 7. Mai 2019 um 00:23 Uhr schrieb Stefano Troncaro
<[hidden email]>:

>
> Hi Rick,
>
> Thank you for your answer. I didn't know that 'bound-details had an X property. It does what I need but it can get tedious to use because I need to specify a number from the start of the spanner (or the system if the spanner is broken into many systems). It takes some trial and error to find the right number and all that work is undone if the spacing changes.
>
> That however led me to writing this function that offsets the 'X value of the 'right-bound-info property, which is the procedure that calculates where the spanner ends. I'm copying it here so it can be used if someone finds it useful or is searching for a similar question in the future.
>
>> \version "2.19.83"
>>
>> ALB-OffsetRBNfo-X =
>> #(define-scheme-function (n) (number?)
>>    "Offset the X position at the end of a breakable object that determines its X position
>>     through the 'right-bound-info procedure."
>>    (lambda (grob)
>>      (let* ((bound-right (ly:spanner-bound grob RIGHT))
>>             (broken-right (= (ly:item-break-dir bound-right) CENTER)))
>>        (if broken-right
>>            (let* ((rbnfo (ly:grob-property grob 'right-bound-info #f))
>>                   (rbnfo (map (lambda (pair)
>>                                 (if (eq? 'X (car pair))
>>                                     (cons 'X (+ (cdr pair) n))
>>                                     pair))
>>                            rbnfo)))
>>              (ly:grob-set-property! grob 'right-bound-info rbnfo))))))
>>
>> \relative {
>>   \override TextSpanner.bound-details.left.text = "sample spanner"
>>   \override TextSpanner.after-line-breaking = \ALB-OffsetRBNfo-X 15
>>   c'\startTextSpan d e f | g a g f \break | e f e d | c1\stopTextSpan
>> }

Why not:

  \override TextSpanner.bound-details.right-broken.padding = 0.25
  \override TextSpanner.bound-details.right.padding = -15

The first to keep the default for right-broken TextSpanner.
(Per default bound-details.right-broken is unset for TextSpanners and
thus copies bound-details.right)
The second to affect bound-details.right.padding as wished.


Cheers,
  Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Finetuning TextSpanner beginning and end positions?

Stefano Troncaro
Hi Harm, honestly because I generally understand "padding" as the amount of whitespace that should be reserved between objects. I never even noticed that property since in my mind I was looking for something that could in no way have something to do with it. Anyways, it's not the first time I find some of the Lilypond naming misleading, it's probably not going to be the last, but after you explained I can *kind of* see why it was named like that.

As always, thank you for your input!


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Finetuning TextSpanner beginning and end positions?

Andrew Bernard
Hi Stefano,

There are many threads in the archives about this inconsistency with text spanners. It's very confusing for users, nad ends up wasting lots of time. It would be great if this could be unified with the 'shorten' commands of other objects, but I realise the developers are hugely constrained for time and resources. Maybe one day.

Andrew


On Tue, 7 May 2019 at 09:53, Stefano Troncaro <[hidden email]> wrote:
Hi Harm, honestly because I generally understand "padding" as the amount of whitespace that should be reserved between objects. I never even noticed that property since in my mind I was looking for something that could in no way have something to do with it. Anyways, it's not the first time I find some of the Lilypond naming misleading, it's probably not going to be the last, but after you explained I can *kind of* see why it was named like that.


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Finetuning TextSpanner beginning and end positions?

Werner LEMBERG
In reply to this post by Stefano Troncaro

> [...] I generally understand "padding" as the amount of whitespace
> that should be reserved between objects.  I never even noticed that
> property since in my mind I was looking for something that could in
> no way have something to do with it.  Anyways, it's not the first
> time I find some of the Lilypond naming misleading, it's probably
> not going to be the last, but after you explained I can *kind of*
> see why it was named like that.

Can you accordingly make suggestions to improve the documentation?


    Werner

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Finetuning TextSpanner beginning and end positions?

Thomas Morley-2
In reply to this post by Stefano Troncaro
Am Di., 7. Mai 2019 um 01:53 Uhr schrieb Stefano Troncaro
<[hidden email]>:
>
> Hi Harm, honestly because I generally understand "padding" as the amount of whitespace that should be reserved between objects.

Well, that's exactly what happens here.
bound-details.right.padding is the amount of white-space between the
end of the TextSpanner and its right-bound.
Thus the negative value, as opposed to your code going for 'X.
Admittedly, as opposed to other Grob.padding settings no object is
moved, instead the TextSpanner itself changes its appearance.

I _guess_ (without having researched) it's also due to historical reasons:
Going for 'shorten-pair for TextSpanner would have needed additional
code to limit it to certain parts of a broken spanner, whereas
bound-details.left/right/left-broken/right-broken.padding
offers the user a direct method to set whats wished for each end of a
broken TextSpanner.
Thus, replacing the values of
bound-details.left/right/left-broken/right-broken.padding by those
from shorten-pair is not that straight-forward.
Probably the name of the padding-_sub_-property is unfortunate.
Though, I think this ship sailed long time ago.

Btw
\override TextSpanner.padding = 10
_moves_ the TextSpanner, nothing else, as everyone would expect.


Cheers,
  Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Finetuning TextSpanner beginning and end positions?

Stefano Troncaro

Admittedly, as opposed to other Grob.padding settings no object is
moved, instead the TextSpanner itself changes its appearance.
I think you nailed the root of why I think the naming is confusing. Funnily enough I do think that the name "padding" is appropriate for Glissandos, where it is a measure of how much white-space there is between the end of the glissando and it's notehead. I just don't find it intuitive for TextSpanners in particular. I agree however that this ship has sailed.

Werner, I looked at the documentation trying to see what I would have needed to be different in order to be able to find this knowledge on my own. For me personally it would have been to have the Internals Reference offer a very concise yet detailed description of the sub-properties of the bound-details property of the line-spanner-interface.
This is because my workflow in these scenarios is to go to the description of the object which is giving me trouble, see what interfaces and properties it has, and from there work out what I need to do. This is also what the Lilypond manuals suggest. So, if the purpose of the Internals Reference is "to present information precisely and concisely", for me a precise description would be at the very least to have a list of it's sub-properties.

I think someone explained to me some time ago (in a similar situation with an alist of properties although I don't remember specifically with what) that this is not possible because of the way the documentation is automatically generated. If this is not possible then a visual example <a href="http://lilypond.org/doc/v2.19/Documentation/notation/spanners#using-the-line_002dspanner_002dinterfacehttp://lilypond.org/doc/v2.19/Documentation/notation/spanners#using-the-line_002dspanner_002dinterface">in this verbose description of the line-spanner-interface would be my next bet: a short snippet that shows it's effect in a few different grobs would probably be enough to be able to find it when hunting for a solution.

Do any of the above seem feasible?

El mar., 7 may. 2019 a las 6:53, Thomas Morley (<[hidden email]>) escribió:
Am Di., 7. Mai 2019 um 01:53 Uhr schrieb Stefano Troncaro
<[hidden email]>:
>
> Hi Harm, honestly because I generally understand "padding" as the amount of whitespace that should be reserved between objects.

Well, that's exactly what happens here.
bound-details.right.padding is the amount of white-space between the
end of the TextSpanner and its right-bound.
Thus the negative value, as opposed to your code going for 'X.
Admittedly, as opposed to other Grob.padding settings no object is
moved, instead the TextSpanner itself changes its appearance.

I _guess_ (without having researched) it's also due to historical reasons:
Going for 'shorten-pair for TextSpanner would have needed additional
code to limit it to certain parts of a broken spanner, whereas
bound-details.left/right/left-broken/right-broken.padding
offers the user a direct method to set whats wished for each end of a
broken TextSpanner.
Thus, replacing the values of
bound-details.left/right/left-broken/right-broken.padding by those
from shorten-pair is not that straight-forward.
Probably the name of the padding-_sub_-property is unfortunate.
Though, I think this ship sailed long time ago.

Btw
\override TextSpanner.padding = 10
_moves_ the TextSpanner, nothing else, as everyone would expect.


Cheers,
  Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Finetuning TextSpanner beginning and end positions?

Thomas Morley-2
Hi Stefano,

Am Mi., 8. Mai 2019 um 05:16 Uhr schrieb Stefano Troncaro
<[hidden email]>:

> my workflow in these scenarios is to go to the description of the object which is giving me trouble, see what interfaces and properties it has, and from there work out what I need to do. This is also what the Lilypond manuals suggest. So, if the purpose of the Internals Reference is "to present information precisely and concisely", for me a precise description would be at the very least to have a list of it's sub-properties.
>
> I think someone explained to me some time ago (in a similar situation with an alist of properties although I don't remember specifically with what) that this is not possible because of the way the documentation is automatically generated.

Well, putting stuff into IR is different from usual doc-work, but not
impossible.
I created
#5518 Document bound-details (sub-)properties in line-spanner-cc for IR
https://sourceforge.net/p/testlilyissues/issues/5518/

Patch is up for review here:
https://codereview.appspot.com/560670043/

Descriptions are mostly taken from NR.
Though, I'm not a native speaker. Any suggestions for better wording,
grammar, syntax etc is welcome.

I think with your google-account you can log in there and do any
inline-comments you wish.

Attached, an excerpt from internals.pdf showing how it looks after patch.

Cheers,
  Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user

internals-excerpt.pdf (36K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Finetuning TextSpanner beginning and end positions?

Stefano Troncaro
Hi Harm, I looked at it quickly and it's an amazing change! I'm not a native speaker either but I will think about it later today and see if I can come up with any improvement of the kind you mentioned. Thank you!

El jue., 9 may. 2019 a las 20:49, Thomas Morley (<[hidden email]>) escribió:
Hi Stefano,

Am Mi., 8. Mai 2019 um 05:16 Uhr schrieb Stefano Troncaro
<[hidden email]>:

> my workflow in these scenarios is to go to the description of the object which is giving me trouble, see what interfaces and properties it has, and from there work out what I need to do. This is also what the Lilypond manuals suggest. So, if the purpose of the Internals Reference is "to present information precisely and concisely", for me a precise description would be at the very least to have a list of it's sub-properties.
>
> I think someone explained to me some time ago (in a similar situation with an alist of properties although I don't remember specifically with what) that this is not possible because of the way the documentation is automatically generated.

Well, putting stuff into IR is different from usual doc-work, but not
impossible.
I created
#5518 Document bound-details (sub-)properties in line-spanner-cc for IR
https://sourceforge.net/p/testlilyissues/issues/5518/

Patch is up for review here:
https://codereview.appspot.com/560670043/

Descriptions are mostly taken from NR.
Though, I'm not a native speaker. Any suggestions for better wording,
grammar, syntax etc is welcome.

I think with your google-account you can log in there and do any
inline-comments you wish.

Attached, an excerpt from internals.pdf showing how it looks after patch.

Cheers,
  Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user