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
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user