The default positioning of staccato dots in combination with other articulations
is poor, because the dot is positioned midway between the center of the note head
and the stem, while all other scripts are centered on the note head.
A mechanism is needed to allow a staccato dot to be positioned differently when alone
and when in combination with other articulations. This patch introduces a new property,
called 'toward-stem-shift-in-column, which works alongside 'toward-stem-shift to control
a script's position relative to the stem. If set for a script appearing within a column,
the new property overrides any setting in 'toward-stem-shift. The new property has
been set only for staccato and staccatissimo.
The previous default of 0.5 for staccato has been changed to 1.0, in accordance with
Gould's recommendation that a staccato dot be centered on the stem.
In order to allow a script to recognize the column organizing it, a pointer to
ScriptColumn, called 'script-column, has been added to script-interface.
Other changes:
--The regtest script-shift.ly has been modified to use scripts other than
staccato.
--A new regtest, script-shift-staccato.ly, illustrates the idiosyncratic
behavior of staccato dots.
--Documentation of the property 'toward-stem-shift has been made more
accurate.
--- /dev/null
+
+\header {
+ texidoc = "The horizontal placement of staccato dots above an
+upstem or below a downstem note differs from the placement of
+other scripts in that different positioning is used when the dot is
+alone and when it is part of a compound articulation. The
+property @code{toward-stem-shift-in-column} ensures good default
+positioning of the staccato (see first measure below), and allows
+precise horizontal control of a column containing a staccato and
+of the staccato within it (second measure). (@code{0.0} means
+centered on the note head, @code{1.0} means centered on the stem.)
+"
+}
+
+\version "2.19.16"
+
+\relative c''
+{
+ % default
+ a4^. c_.
+ a^.^- c_._-
+
+ \override Script.toward-stem-shift-in-column = 1.0
+ a4^.^- c_._-
+ \revert Script.toward-stem-shift-in-column
+
+ a4-\tweak toward-stem-shift-in-column 1.0 ^. ^-
+ c4-\tweak toward-stem-shift-in-column 1.0 _. _-
+}
"
}
-\version "2.17.6"
+\version "2.19.16"
\relative c''
{
- \override Script.toward-stem-shift = #0.0
- a4^. c_.
-
\override Script.toward-stem-shift = #1.0
- a4^. c_.
+ a4^> c_>
+
+ \override Script.toward-stem-shift = #0.0
+ a4^> c_>
}
return;
Pointer_group_interface::add_grob (me, ly_symbol2scm ("scripts"), script);
+ script->set_object ("script-column", me->self_scm ());
}
LY_DEFINE (ly_grob_script_priority_less, "ly:grob-script-priority-less",
"avoid-slur "
"direction-source "
"positioning-done "
+ "script-column "
"script-priority "
"script-stencil "
"side-relative-direction "
"slur "
"slur-padding "
"toward-stem-shift "
+ "toward-stem-shift-in-column "
);
line just before it would otherwise stop.")
(toward-stem-shift ,number? "Amount by which scripts are shifted
toward the stem if their direction coincides with the stem direction.
-@code{0.0} means keep the default position (centered on the note
-head), @code{1.0} means centered on the stem. Interpolated values are
-possible.")
+@code{0.0} means centered on the note head (the default position of
+most scripts); @code{1.0} means centered on the stem. Interpolated
+values are possible.")
+ (toward-stem-shift-in-column ,number? "Amount by which a script
+is shifted toward the stem if its direction coincides with the stem
+direction and it is associated with a @code{ScriptColumn} object.
+@code{0.0} means centered on the note head (the default position of
+most scripts); @code{1.0} means centered on the stem. Interpolated
+values are possible.")
(transparent ,boolean? "This makes the grob invisible.")
(quantized-positions ,number-pair? "The beam positions after
quanting.")
-
+ (script-column ,ly:grob? "A @code{ScriptColumn} associated with a
+@code{Script} object.")
(script-stencil ,pair? "A pair @code{(@var{type} . @var{arg})} which
acts as an index for looking up a @code{Stencil} object.")
(shorten ,ly:dimension? "The amount of space that a stem is shortened.
(define-public (script-interface::calc-x-offset grob)
(ly:grob-property grob 'positioning-done)
- (let* ((shift (ly:grob-property grob 'toward-stem-shift 0.0))
+ (let* ((shift-when-alone (ly:grob-property grob 'toward-stem-shift 0.0))
+ (shift-in-column (ly:grob-property grob 'toward-stem-shift-in-column))
+ (script-column (ly:grob-object grob 'script-column))
+ (shift (if (and (ly:grob? script-column) (number? shift-in-column))
+ shift-in-column shift-when-alone))
(note-head-location
(ly:self-alignment-interface::aligned-on-x-parent grob))
(note-head-grob (ly:grob-parent grob X))
(stem-grob (ly:grob-object note-head-grob 'stem)))
(+ note-head-location
- ;; If the property 'toward-stem-shift is defined and the script
- ;; has the same direction as the stem, move the script accordingly.
- ;; Since scripts can also be over skips, we need to check whether
- ;; the grob has a stem at all.
+ ;; If the script has the same direction as the stem, move the script
+ ;; in accordance with the value of 'shift'. Since scripts can also be
+ ;; over skips, we need to check whether the grob has a stem at all.
(if (ly:grob? stem-grob)
(let ((dir1 (ly:grob-property grob 'direction))
(dir2 (ly:grob-property stem-grob 'direction)))
(script-stencil . (feta . ("dstaccatissimo" . "ustaccatissimo")))
(padding . 0.20)
(skyline-horizontal-padding . 0.10)
- (side-relative-direction . ,DOWN)))
+ (side-relative-direction . ,DOWN)
+ (toward-stem-shift . 1.0)
+ (toward-stem-shift-in-column . 0.0)))
("staccato"
. (
(script-stencil . (feta . ("staccato" . "staccato")))
(side-relative-direction . ,DOWN)
(quantize-position . #t)
(avoid-slur . inside)
- (toward-stem-shift . 0.5)
+ (toward-stem-shift . 1.0)
+ (toward-stem-shift-in-column . 0.0)
(padding . 0.20)
(skyline-horizontal-padding . 0.10)
(script-priority . -100)))