[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Finetuning TextSpanner beginning and end positions?
From: |
Thomas Morley |
Subject: |
Re: Finetuning TextSpanner beginning and end positions? |
Date: |
Tue, 7 May 2019 00:54:14 +0200 |
Am Di., 7. Mai 2019 um 00:23 Uhr schrieb Stefano Troncaro
<address@hidden>:
>
> 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
- Finetuning TextSpanner beginning and end positions?, Stefano Troncaro, 2019/05/06
- Re: Finetuning TextSpanner beginning and end positions?, Rick Kimpel, 2019/05/06
- Re: Finetuning TextSpanner beginning and end positions?, Stefano Troncaro, 2019/05/06
- Re: Finetuning TextSpanner beginning and end positions?,
Thomas Morley <=
- Re: Finetuning TextSpanner beginning and end positions?, Stefano Troncaro, 2019/05/06
- Re: Finetuning TextSpanner beginning and end positions?, Andrew Bernard, 2019/05/06
- Re: Finetuning TextSpanner beginning and end positions?, Werner LEMBERG, 2019/05/07
- Re: Finetuning TextSpanner beginning and end positions?, Thomas Morley, 2019/05/07
- Re: Finetuning TextSpanner beginning and end positions?, Stefano Troncaro, 2019/05/07
- Re: Finetuning TextSpanner beginning and end positions?, Thomas Morley, 2019/05/09
- Re: Finetuning TextSpanner beginning and end positions?, Stefano Troncaro, 2019/05/10