Jump to content

Controlling the vertical ordering of scripts: Difference between revisions

From LilyPond wiki
mNo edit summary
Synchronize with a 'new' snippet in the LilyPond git archive
 
Line 1: Line 1:
The vertical ordering of scripts is controlled with the <code>script-priority</code> property. The lower this number, the closer it will be put to the note. In this example, the <code>TextScript</code> (the ''sharp'' symbol) first has the lowest priority, so it is put lowest in the first example. In the second, the ''prall trill'' (the <code>Script</code>) has the lowest, so it is on the inside. When two objects have the same priority, the order in which they are entered determines which one comes first.
The vertical ordering of scripts is controlled with the <code>script-priority</code> property. The lower this number, the closer it will be put to the note. In this example, the <code>TextScript</code> (the ''sharp'' symbol) first has the lowest priority, so it is put lowest in the first example. In the second, the ''prall trill'' (the <code>Script</code>) has the lowest, so it is on the inside. When two objects have the same priority, the order in which they are entered determines which one comes first.
Note that for <code>Fingering</code>, <code>StringNumber</code>, and <code>StrokeFinger</code> grobs, if used within a chord, the vertical order is also determined by the vertical position of the associated note head, which is added to (or, depending on the direction, subtracted from) the grob’s <code>script-priority</code> value. This ensures that for fingerings above a chord the lower note is associated with the lower fingering (and vice versa for the other direction); it doesn’t matter whether you input the notes in the chord from top to bottom or from bottom to top.
By default, the least technical scripts are positioned closest to the note head; the rough order is articulation, flageolet, fingering, right-hand fingering, string number, fermata, bowing, and text script.


<lilypond version="2.24">
<lilypond version="2.24">
Line 8: Line 12:
   \once \override Script.script-priority = -100
   \once \override Script.script-priority = -100
   a2^\prall^\markup { \sharp }
   a2^\prall^\markup { \sharp }
  \set fingeringOrientations = #'(up)
  <c-2 a-1>2
  <a-1 c\tweak script-priority -100 -2>2
}
}
</lilypond>
</lilypond>

Latest revision as of 12:12, 9 December 2025

The vertical ordering of scripts is controlled with the script-priority property. The lower this number, the closer it will be put to the note. In this example, the TextScript (the sharp symbol) first has the lowest priority, so it is put lowest in the first example. In the second, the prall trill (the Script) has the lowest, so it is on the inside. When two objects have the same priority, the order in which they are entered determines which one comes first.

Note that for Fingering, StringNumber, and StrokeFinger grobs, if used within a chord, the vertical order is also determined by the vertical position of the associated note head, which is added to (or, depending on the direction, subtracted from) the grob’s script-priority value. This ensures that for fingerings above a chord the lower note is associated with the lower fingering (and vice versa for the other direction); it doesn’t matter whether you input the notes in the chord from top to bottom or from bottom to top.

By default, the least technical scripts are positioned closest to the note head; the rough order is articulation, flageolet, fingering, right-hand fingering, string number, fermata, bowing, and text script.

\version "2.24"

\relative c''' {
  \once \override TextScript.script-priority = -100
  a2^\prall^\markup { \sharp }
  
  \once \override Script.script-priority = -100
  a2^\prall^\markup { \sharp }

  \set fingeringOrientations = #'(up)
  <c-2 a-1>2
  <a-1 c\tweak script-priority -100 -2>2
}