Flipping fingering and TextScript

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

Flipping fingering and TextScript

Urs Liska-3

I'm banging my head for something that's surely completely trivial, but I don't find the incantation to flip the text and the fingering in this MWE:

\relative {
  c'' ^"a" ^1
}

If I'm not mistaken Fingering doesn't respond to outside-staff-priority, does it? I can move the fingering further away using staff-padding, but the text insists on staying *outside*, i.e. it is pushed even further from the staff.

Of course there is a solution without having to push the fingering around with extra-offset?

Looking forward to the embarrassment ;-)
Urs


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

Re: Flipping fingering and TextScript

David Kastrup
Urs Liska <[hidden email]> writes:

> I'm banging my head for something that's surely completely trivial,
> but I don't find the incantation to flip the text and the fingering in
> this MWE:
>
> \relative {
>   c'' ^"a" ^1
> }
>
> If I'm not mistaken Fingering doesn't respond to
> outside-staff-priority, does it?
It does.


\relative {
  c'' ^"a" ^\tweak outside-staff-priority 2000 ^1
}


> Of course there is a solution without having to push the fingering
> around with extra-offset?
>
> Looking forward to the embarrassment ;-)

Here you are.

--
David Kastrup

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

Re: Flipping fingering and TextScript

Urs Liska-3


Am 19.02.19 um 15:43 schrieb David Kastrup:
Urs Liska [hidden email] writes:

I'm banging my head for something that's surely completely trivial,
but I don't find the incantation to flip the text and the fingering in
this MWE:

\relative {
  c'' ^"a" ^1
}

If I'm not mistaken Fingering doesn't respond to
outside-staff-priority, does it?
It does.



      
Of course there is a solution without having to push the fingering
around with extra-offset?

Looking forward to the embarrassment ;-)
Here you are.


Hm,
then I'm all the more scratching my head why it the actual file not even

g2 -\tweak outside-staff-priority 2000 -1 -\tweak outside-staff-priority 1000 \t

works. I'm looking through all the included library files but I don't see anything that shouts "here, look at me!" ...

Best
Urs


    

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

Re: Flipping fingering and TextScript

David Kastrup
Urs Liska <[hidden email]> writes:

> Am 19.02.19 um 15:43 schrieb David Kastrup:
>> Urs Liska <[hidden email]> writes:
>>
>>> I'm banging my head for something that's surely completely trivial,
>>> but I don't find the incantation to flip the text and the fingering in
>>> this MWE:
>>>
>>> \relative {
>>>    c'' ^"a" ^1
>>> }
>>>
>>> If I'm not mistaken Fingering doesn't respond to
>>> outside-staff-priority, does it?
>> It does.
>>
>>
>>> Of course there is a solution without having to push the fingering
>>> around with extra-offset?
>>>
>>> Looking forward to the embarrassment ;-)
>> Here you are.
>
>
> Hm,
> then I'm all the more scratching my head why it the actual file not even
>
> g2 -\tweak outside-staff-priority 2000 -1 -\tweak outside-staff-priority 1000 \t
>
> works.

What is \t ?  If it is a string or markup, you cannot tweak it.  You can
only tweak text events.  If \t is a string or markup, a text event would
be -\t .

--
David Kastrup

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

Re: Flipping fingering and TextScript

Urs Liska-3


Am 19. Februar 2019 17:41:42 MEZ schrieb David Kastrup <[hidden email]>:

>Urs Liska <[hidden email]> writes:
>
>> Am 19.02.19 um 15:43 schrieb David Kastrup:
>>> Urs Liska <[hidden email]> writes:
>>>
>>>> I'm banging my head for something that's surely completely trivial,
>>>> but I don't find the incantation to flip the text and the fingering
>in
>>>> this MWE:
>>>>
>>>> \relative {
>>>>    c'' ^"a" ^1
>>>> }
>>>>
>>>> If I'm not mistaken Fingering doesn't respond to
>>>> outside-staff-priority, does it?
>>> It does.
>>>
>>>
>>>> Of course there is a solution without having to push the fingering
>>>> around with extra-offset?
>>>>
>>>> Looking forward to the embarrassment ;-)
>>> Here you are.
>>
>>
>> Hm,
>> then I'm all the more scratching my head why it the actual file not
>even
>>
>> g2 -\tweak outside-staff-priority 2000 -1 -\tweak
>outside-staff-priority 1000 \t
>>
>> works.
>
>What is \t ?  If it is a string or markup, you cannot tweak it.  You
>can
>only tweak text events.  If \t is a string or markup, a text event
>would
>be -\t .

Sorry, my bad. \t is an event function returning -\markup "t."
In the test case this worked smoothly. But still I will test what happens if I switch that with a plain markup.

Urs


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

Re: Flipping fingering and TextScript

Aaron Hill
I dug into the code a bit because I was curious why the following does
not place the TextScript below the Fingering:

%%%%
     b'1 ^1 -\tweak outside-staff-priority #-1000 ^"a"
%%%%

It turns out that Fingerings have no default value for
outside-staff-priority, as would be specified within define-grobs.scm.  
They do however have a script-priority of 100 which is lower than 200,
the value for TextScripts.  This means by default Fingerings should
appear closer to the note in a column.

Looking at script-column.cc, the behavior appears to be to first sort
all scripts in a column according to their script-priority.  Once items
are ordered by script-priority, they are then reordered according to
outside-staff-priority.  When two items share the same priority, the
latter one is incremented.  (script-priority is incremented by 1, and
outside-staff-priority is incremented by 0.1 instead.)

When an item has no outside-staff-priority, it inherits the value of the
item before it in the column.  And importantly, "before" is determined
by the ordering after sorting by script-priority.  If there is no such
item, then its value is left unset.  As such, my snippet above fails
because an unset priority always sorts to the beginning of the list.

One solution is to explicitly define a suitable default
outside-staff-priority for Fingerings.  This would prevent any unset
values from skewing the sorting.

Alternately, you could opt to \tweak the outside-staff-priority of the
Fingering instead, noting the default for TextScripts is 450.  However,
it feels a little backwards having to \tweak a different object to the
one you are trying to position.

Setting the script-priority of a Fingering to a value higher than the
one for TextScripts would change the default ordering of scripts in a
column.  Since a TextScript, which has an outside-staff-priority,
appears earlier in the column, Fingerings would have a value to inherit.

Here is a snippet showing some of this behavior:

%%%%
\version "2.19.82"

#(define ((print-properties props) grob)
   (define (lookup-prop prop)
     (cons prop (ly:grob-property grob prop 'unset)))
   (let ((text (object->string (map lookup-prop props))))
     (grob-interpret-markup grob #{ \markup
       \normal-text \normalsize \tiny #text #} )))

\paper { indent = 0 ragged-right = ##t }
\layout { \context { \Voice
   \override Fingering.stencil = #(print-properties
     '(text script-priority outside-staff-priority))
   \override TextScript.stencil = #(print-properties
     '(text script-priority outside-staff-priority))
   \override TextScript.self-alignment-X = #0 } }

\markup \typewriter \bold "^1 ^2"
{ b'1 ^1 ^2 }
\markup \vspace #1
\markup \typewriter \bold "-\\tweak outside-staff-priority #100 ^1 ^2"
{ b'1 -\tweak outside-staff-priority #100 ^1 ^2 }
\markup \vspace #1
\markup \typewriter \bold "^\"a\" ^\"b\""
{ b'1 ^"a" ^"b" }
\markup \vspace #1
\markup \typewriter \bold "-\\tweak outside-staff-priority #500 ^\"a\"
^\"b\""
{ b'1 -\tweak outside-staff-priority #500 ^"a" ^"b" }
\markup \vspace #1
\markup \typewriter \bold "^1 ^\"a\""
{ b'1 ^1 ^"a" }
\markup \vspace #1
\markup \typewriter \bold "-\\tweak script-priority #300 ^1 ^\"a\""
{ b'1 -\tweak script-priority #300 ^1 ^"a" }
%%%%

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

outside-staff-priority.cropped.png (192K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Flipping fingering and TextScript

Werner LEMBERG

> Looking at script-column.cc, the behavior appears to be to first
> sort all scripts in a column according to their script-priority.
> Once items are ordered by script-priority, they are then reordered
> according to outside-staff-priority.  When two items share the same
> priority, the latter one is incremented.  (script-priority is
> incremented by 1, and outside-staff-priority is incremented by 0.1
> instead.)
>
> When an item has no outside-staff-priority, it inherits the value of
> the item before it in the column.  And importantly, "before" is
> determined by the ordering after sorting by script-priority.  If
> there is no such item, then its value is left unset.  As such, my
> snippet above fails because an unset priority always sorts to the
> beginning of the list.

Thanks for the excellent description of the algorithm.  In case it is
not documented yet, this text should be added.

> One solution is to explicitly define a suitable default
> outside-staff-priority for Fingerings.  This would prevent any unset
> values from skewing the sorting.

Yes.  Is there any adverse effect of doing that?

> Alternately, you could opt to \tweak the outside-staff-priority of
> the Fingering instead, noting the default for TextScripts is 450.
> However, it feels a little backwards having to \tweak a different
> object to the one you are trying to position.

Exactly.


    Werner

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

Re: Flipping fingering and TextScript

Urs Liska-3
In reply to this post by Aaron Hill

Hi Aaron,

thank you for taking the time to investigate this. Pretty interesting results, although they don't really help me in my case. There must be something fishy buried in my libraries because (as my previous example showed) I can't even flip the elements anymore even when I'm hardcoding the \tweaks of *both* outside-staff-priority properties.

Maybe the issue "goes away" by itself if I change the implementation to a custom articulation (if I manage ...) - which is something I had considered anyway to have different alignment (center the element horizontally over the notehead).

Urs

Am 19.02.19 um 23:20 schrieb Aaron Hill:
I dug into the code a bit because I was curious why the following does not place the TextScript below the Fingering:

%%%%
    b'1 ^1 -\tweak outside-staff-priority #-1000 ^"a"
%%%%

It turns out that Fingerings have no default value for outside-staff-priority, as would be specified within define-grobs.scm.  They do however have a script-priority of 100 which is lower than 200, the value for TextScripts.  This means by default Fingerings should appear closer to the note in a column.

Looking at script-column.cc, the behavior appears to be to first sort all scripts in a column according to their script-priority.  Once items are ordered by script-priority, they are then reordered according to outside-staff-priority.  When two items share the same priority, the latter one is incremented.  (script-priority is incremented by 1, and outside-staff-priority is incremented by 0.1 instead.)

When an item has no outside-staff-priority, it inherits the value of the item before it in the column.  And importantly, "before" is determined by the ordering after sorting by script-priority.  If there is no such item, then its value is left unset.  As such, my snippet above fails because an unset priority always sorts to the beginning of the list.

One solution is to explicitly define a suitable default outside-staff-priority for Fingerings.  This would prevent any unset values from skewing the sorting.

Alternately, you could opt to \tweak the outside-staff-priority of the Fingering instead, noting the default for TextScripts is 450.  However, it feels a little backwards having to \tweak a different object to the one you are trying to position.

Setting the script-priority of a Fingering to a value higher than the one for TextScripts would change the default ordering of scripts in a column.  Since a TextScript, which has an outside-staff-priority, appears earlier in the column, Fingerings would have a value to inherit.

Here is a snippet showing some of this behavior:

%%%%
\version "2.19.82"

#(define ((print-properties props) grob)
  (define (lookup-prop prop)
    (cons prop (ly:grob-property grob prop 'unset)))
  (let ((text (object->string (map lookup-prop props))))
    (grob-interpret-markup grob #{ \markup
      \normal-text \normalsize \tiny #text #} )))

\paper { indent = 0 ragged-right = ##t }
\layout { \context { \Voice
  \override Fingering.stencil = #(print-properties
    '(text script-priority outside-staff-priority))
  \override TextScript.stencil = #(print-properties
    '(text script-priority outside-staff-priority))
  \override TextScript.self-alignment-X = #0 } }

\markup \typewriter \bold "^1 ^2"
{ b'1 ^1 ^2 }
\markup \vspace #1
\markup \typewriter \bold "-\\tweak outside-staff-priority #100 ^1 ^2"
{ b'1 -\tweak outside-staff-priority #100 ^1 ^2 }
\markup \vspace #1
\markup \typewriter \bold "^\"a\" ^\"b\""
{ b'1 ^"a" ^"b" }
\markup \vspace #1
\markup \typewriter \bold "-\\tweak outside-staff-priority #500 ^\"a\" ^\"b\""
{ b'1 -\tweak outside-staff-priority #500 ^"a" ^"b" }
\markup \vspace #1
\markup \typewriter \bold "^1 ^\"a\""
{ b'1 ^1 ^"a" }
\markup \vspace #1
\markup \typewriter \bold "-\\tweak script-priority #300 ^1 ^\"a\""
{ b'1 -\tweak script-priority #300 ^1 ^"a" }
%%%%

-- Aaron Hill

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

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