[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lilypond-user
Subject:    Re: Force TextScript to staff-padding / optional \textLengthOn
From:       Urs Liska <lists () openlilylib ! org>
Date:       2019-01-29 11:52:35
Message-ID: d2c96190-4e95-07a5-6d5b-5eff1ada9b5c () openlilylib ! org
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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

[Attachment #5 (text/html)]

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hm,</p>
    <p>after sending this request for help I (hopefully) found a
      solution myself. But I don't pretend to understand it ...<br>
    </p>
    <div class="moz-cite-prefix">Am 29.01.19 um 10:55 schrieb Urs Liska:<br>
    </div>
    <blockquote type="cite"
      cite="mid:ce831cea-bc11-0fa1-f143-370cd1d3c6fe@openlilylib.org">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <p>Hi,</p>
      <p>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 :-(</p>
      <p>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.</p>
      <p>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.</p>
      ...<br>
      <br>
      <p>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:<br>
      </p>
      <pre>...

#(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
   #})

...
</pre>
      <p>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?</p>
    </blockquote>
    <p><br>
    </p>
    <p>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.</p>
    <pre>#(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
</pre>
    <p>Any clarification?</p>
    <p>Thanks<br>
      Urs<br>
    </p>
    <p><br>
    </p>
    <blockquote type="cite"
      cite="mid:ce831cea-bc11-0fa1-f143-370cd1d3c6fe@openlilylib.org">
      <p>Thanks<br>
        Urs<br>
      </p>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" \
wrap="">_______________________________________________ lilypond-user mailing list
<a class="moz-txt-link-abbreviated" \
href="mailto:lilypond-user@gnu.org">lilypond-user@gnu.org</a> <a \
class="moz-txt-link-freetext" \
href="https://lists.gnu.org/mailman/listinfo/lilypond-user">https://lists.gnu.org/mailman/listinfo/lilypond-user</a>
 </pre>
    </blockquote>
  </body>
</html>



_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic