-\version "2.17.28"
+\version "2.17.29"
\header {
texidoc = "The @code{\\offset} command may be used to displace various properties
%% ARPEGGIO %%
% default
<c e g b>1\arpeggio
- <c e g b>1-\offset #'positions #'(-1 . 1) \arpeggio
+ <c e g b>1-\offset positions #'(-1 . 1) \arpeggio
\bar "||"
%% BREATHING SIGN %%
% default
c1 \breathe
c1
- \once \offset #'Y-offset #1 BreathingSign
+ \once \offset Y-offset 1 BreathingSign
\breathe
\bar "||"
%% DYNAMICS %%
% default
c1\f
- \once \offset #'X-offset #-1 DynamicText
+ \once \offset X-offset #-1 DynamicText
c1\f
% DynamicLineSpanner
- c1-\offset #'padding #1 \f
+ \once \offset padding 1 DynamicLineSpanner
+ c1\f
\bar "||"
%% BEAMS %%
% default
c'8 d e f
- \once \offset #'positions #'(-1 . -1) Voice.Beam
+ \once \offset positions #'(-1 . -1) Voice.Beam
c8 d e f
% same effect as an offset of '(-2 . -2)
- \once \offset #'positions #-2 Beam
+ \once \offset positions #-2 Beam
c8 d e f
\override Beam.breakable = ##t
- c8-\offset #'positions #'((-1 . -3) (-3 . -1)) [ d e f
+ c8-\offset positions #'((-1 . -3) (-3 . -1)) [ d e f
\break
- g8 f e d] c-\offset #'beam-thickness #0.48 [ d e f]
+ g8 f e d] c-\offset beam-thickness 0.48 [ d e f]
\bar "||"
%% TEXT SPANNERS %%
c4\startTextSpan d e f\stopTextSpan
- \once \offset #'dash-fraction #'(0.1 0.3) TextSpanner
- \once \offset #'staff-padding #'(1.0 2.0) TextSpanner
+ \once \offset dash-fraction #'(0.1 0.3) TextSpanner
+ \once \offset staff-padding #'(1.0 2.0) TextSpanner
c4\startTextSpan d e f
\break
c4 d e f\stopTextSpan
%% SLURS %%
% this duplicates the effect of the \shape command
- \offset #'control-points #'(
+ \offset control-points #'(
((0 . 0) (0 . 1) (0 . 2) (0 . 1))
((1 . 0) (0 . 4) (0 . 4) (0 . 0))
) Slur
- c4-\offset #'line-thickness #'(0 10) ( d e f
+ c4-\offset line-thickness #'(0 10) ( d e f
\break
c4 d e f)
+ \bar "||"
+
+ %% ACCIDENTAL, STEM %%
+ % this illustrates use of \offset as a directed tweak
+ cis2
+ \offset AccidentalPlacement.right-padding 0.5
+ \offset Stem.thickness 4.0
+ cis!2
}
a music expression, the result is the same music expression with an
appropriate tweak applied.")
(if (ly:music? item)
- #{ \tweak #property #(offsetter property offsets) #item #}
- (if (check-grob-path item parser location
- #:default 'Bottom
- #:min 2
- #:max 2)
- #{
- \override #item . #property =
- #(offsetter property offsets)
- #}
- (make-music 'Music))))
-
+ ; In case of a tweak, grob property path is Grob.property
+ (let ((prop-path (check-grob-path
+ (if (symbol? property)
+ (list property)
+ property)
+ parser location
+ #:start 1 #:default #t #:min 2 #:max 2)))
+ (if prop-path
+ ; If the head of the grob property path is a symbol--i.e.,
+ ; a grob name, produce a directed tweak. Otherwise, create
+ ; an ordinary tweak.
+ (if (symbol? (car prop-path))
+ #{
+ \tweak #prop-path #(offsetter (second prop-path) offsets) #item
+ #}
+ #{
+ \tweak #(second prop-path) #(offsetter (second prop-path) offsets) #item
+ #})
+ item))
+ ; In case of an override, grob property path is Context.Grob.property.
+ (let ((prop-path (check-grob-path
+ (append item
+ (if (symbol? property)
+ (list property)
+ property))
+ parser location
+ #:default 'Bottom #:min 3 #:max 3)))
+ (if prop-path
+ #{
+ \override #prop-path = #(offsetter (third prop-path) offsets)
+ #}
+ (make-music 'Music)))))
+
omit =
#(define-music-function (parser location item) (symbol-list-or-music?)
(_i "Set @var{item}'s @samp{stencil} property to @code{#f},
;; The following are used by the \offset function
(define (find-value-to-offset prop self alist)
- "Return the first value of the property @var{prop} in the property alist
-@var{alist} @em{after} having found @var{self}."
+ "Return the first value of the property @var{prop} in the property
+alist @var{alist} -- after having found @var{self}. If @var{self} is
+not found, return the first value of @var{prop}."
(let ((segment (member (cons prop self) alist)))
(if (not segment)
(assoc-get prop alist)