lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Issue 2535: Staccato on stem side alignment when other articulations are


From: david . nalesnik
Subject: Issue 2535: Staccato on stem side alignment when other articulations are present (issue 196260043 by address@hidden)
Date: Tue, 27 Jan 2015 00:03:19 +0000

Reviewers: ,

Message:
Please review.

Description:
Issue 2535: Staccato on stem side alignment when other articulations are
present

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.  The property
'toward-stem-shift
controls the alignment of scripts appearing on the side of the stem.
This patch
changes the type of 'toward-stem-shift to number-pair rather than
number.  The first
member of the pair indicates the shift when alone, the second the shift
when the
script is contained by a ScriptColumn object.  The vast majority of
articulations
default to '(0.0 . 0.0), indicating that they are always centered above
the note head
when on the stem side.  Three articulations--staccato, staccatissimo,
and stopped--are
set to '(1.0 . 0.0), either directly above the stem or centered on the
note head,
ensuring that combinations like accent-staccato will be properly aligned
by default.

The previous default of 0.5 for staccato has been modified, in
accordance with Gould's
recommendation.

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.

Please review this at https://codereview.appspot.com/196260043/

Affected files (+30, -15 lines):
  M input/regression/script-shift.ly
  M lily/script-column.cc
  M lily/script-interface.cc
  M scm/define-grob-properties.scm
  M scm/output-lib.scm
  M scm/script.scm


Index: input/regression/script-shift.ly
diff --git a/input/regression/script-shift.ly b/input/regression/script-shift.ly index 88f8f72f02524535330d94df8dc9bfa4001cc4a3..512fc9184617950dee0fe354aeb8286cfd912ac8 100644
--- a/input/regression/script-shift.ly
+++ b/input/regression/script-shift.ly
@@ -2,17 +2,24 @@
 \header {
   texidoc = "The @code{toward-stem-shift} property controls the precise
 horizontal location of scripts that are placed above an upstem or below
-a downstem note (@code{0.0} means centered on the note head, @code{1.0}
-means centered on the stem).
+a downstem note.  The first number of the pair indicates the shift
+applied when the script is alone, the second when present with other
+scripts.  (@code{0.0} means centered on the note head, @code{1.0}
+means centered on the stem.)
 "
 }

-\version "2.17.6"
+\version "2.19.16"
 \relative c''
 {
-  \override Script.toward-stem-shift = #0.0
+  \override Script.toward-stem-shift = #'(0.0 . 0.0)
   a4^. c_.

-  \override Script.toward-stem-shift = #1.0
+  \override Script.toward-stem-shift = #'(1.0 . 0.0)
   a4^. c_.
+
+  a4^.^- c_._-
+
+  a4-\tweak toward-stem-shift #'(1.0 . 1.0) ^.^-
+  c4_. -\tweak toward-stem-shift #'(1.0 . 1.0) _-
 }
Index: lily/script-column.cc
diff --git a/lily/script-column.cc b/lily/script-column.cc
index 0e797b543f2948cccd5495686ceb3895a76dd16c..2456f8b00b05d5c13e9969fce2bb5ea77fe408b5 100644
--- a/lily/script-column.cc
+++ b/lily/script-column.cc
@@ -39,6 +39,7 @@ Script_column::add_side_positioned (Grob *me, Grob *script)
     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",
Index: lily/script-interface.cc
diff --git a/lily/script-interface.cc b/lily/script-interface.cc
index 8778f5c6d316b8dbda9b4157aa81906260ac1fcf..bf0e96dacb554d0b9e4f0153936b1764f09a056f 100644
--- a/lily/script-interface.cc
+++ b/lily/script-interface.cc
@@ -153,6 +153,7 @@ ADD_INTERFACE (Script_interface,
                "avoid-slur "
                "direction-source "
                "positioning-done "
+               "script-column "
                "script-priority "
                "script-stencil "
                "side-relative-direction "
Index: scm/define-grob-properties.scm
diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm
index b850a18e8beb3c39cb0786c3b695916cae3e106f..77b392425f393cc6d5a9e5d703d8bf4da6aaf34c 100644
--- a/scm/define-grob-properties.scm
+++ b/scm/define-grob-properties.scm
@@ -1086,11 +1086,12 @@ in the list causes the corresponding tie to be formatted
 automatically.")
      (to-barline ,boolean? "If true, the spanner will stop at the bar
 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.
address@hidden means keep the default position (centered on the note
-head), @code{1.0} means centered on the stem.  Interpolated values are
-possible.")
+     (toward-stem-shift ,number-pair? "Amount by which scripts are shifted
+toward the stem if their direction coincides with the stem direction.  The
+first number in the pair describes the shift when the script is alone, the
+second when the script belongs to a @code{ScriptColumn}.  @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.")
      (transparent ,boolean? "This makes the grob invisible.")


@@ -1380,7 +1381,8 @@ to be within staff spaces.")
      (quantized-positions ,number-pair? "The beam positions after
 quanting.")

-
+     (script-column ,ly:grob? "A @code{ScriptColumn} associated with a
address@hidden 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.
Index: scm/output-lib.scm
diff --git a/scm/output-lib.scm b/scm/output-lib.scm
index 1e40e19f667293cb8ab3c9348919093fd52f5fe5..a7ce84620d66724bccbd3e9c212c46787056df65 100644
--- a/scm/output-lib.scm
+++ b/scm/output-lib.scm
@@ -1157,7 +1157,9 @@ parent or the parent has no setting."

 (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 (ly:grob-property grob 'toward-stem-shift '(0.0 . 0.0)))
+         (script-column (ly:grob-object grob 'script-column))
+         (shift (if (ly:grob? script-column) (cdr shift) (car shift)))
          (note-head-location
           (ly:self-alignment-interface::aligned-on-x-parent grob))
          (note-head-grob (ly:grob-parent grob X))
Index: scm/script.scm
diff --git a/scm/script.scm b/scm/script.scm
index ab0df9f33690271b06dfb26243197139653e7743..87ca765c7aba4a6e1adabf39ee5cb3b93c78138c 100644
--- a/scm/script.scm
+++ b/scm/script.scm
@@ -270,14 +270,15 @@
         (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 . 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 . 0.0))
         (padding . 0.20)
         (skyline-horizontal-padding . 0.10)
         (script-priority . -100)))
@@ -286,7 +287,8 @@
         (script-stencil . (feta . ("stopped" . "stopped")))
         (avoid-slur . inside)
         (padding . 0.20)
-        (direction . ,UP)))
+        (direction . ,UP)
+        (toward-stem-shift . (1.0 . 0.0))))


     ("tenuto"





reply via email to

[Prev in Thread] Current Thread [Next in Thread]