Nick, this is a little less awkward, but you still have to adjust the 'length and 'extra-offset properties of Stem in some cases. But now you don't have to guess the X-offsets. The macro calculates the appropriate X-offsets based on the note-values. There are still some quirks though. It fails if the chord's first inputted note is NOT /tweak'ed. No idea why. In fact, there are some combinations that just don't seem to work. Still a little buggy I guess.
Incidentally, you can use a numeric value if you
want to do anything different:
<\tweak #'X-offset #-1.324984 d e gis>
You can also use the macro to deduce the correct
X-offsets. In caseyou're curious, here they are:
quarter-notes and shorter:
move-left = -1.324984
move-right = 1.324984
half-notes:
move-left = -1.251178
move-right = 1.251178
whole-notes:
move-left = -1.720008
move-right = 1.720008
Don't forget, this is especially *bad* notation.
Maybe it's a good thing it's so hard to implement!
Good luck.
- Mark
_________________________________________________
\version "2.13.0"
\pointAndClickOff
#(define (move-left grob)
(let* ((line-thickness (ly:staff-symbol-line-thickness grob))
(default-stem-thickness (* 1.3 line-thickness))
(X-extent (ly:stencil-extent (ly:note-head::print grob) 0))
(width (- (cdr X-extent) (car X-extent)))
(offset (if (< 0 (ly:grob-property grob 'duration-log))
(- (/ default-stem-thickness 2) width)
(- (* default-stem-thickness 2) width))))
offset))
#(define (move-right grob)
(let* ((line-thickness (ly:staff-symbol-line-thickness grob))
(default-stem-thickness (* 1.3 line-thickness))
(X-extent (ly:stencil-extent (ly:note-head::print grob) 0))
(width (- (cdr X-extent) (car X-extent)))
(offset (if (< 0 (ly:grob-property grob 'duration-log))
(- width (/ default-stem-thickness 2))
(- width (* default-stem-thickness 2)))))
offset))
\relative {
% adjust Stem 'length and 'extra-offset if
% the second is at one end of the stem:
\once \override Stem #'length = #7.85
\once \override Stem #'extra-offset = #'(0.065 . -0.45)
<\tweak #'X-offset #move-right d
\tweak #'X-offset #move-left e
gis>4
\once \override Stem #'length = #7.85
\once \override Stem #'extra-offset = #'(0.065 . -0.45)
<\tweak #'X-offset #move-right d
\tweak #'X-offset #move-left e
gis>2
% for some reason, it won't work unless you input the tweak first:
<\tweak #'X-offset #move-left b'
\tweak #'X-offset #move-right a
e>4
% ie. this doesn't work:
% <e
% \tweak #'X-offset #move-right a
% \tweak #'X-offset #move-left b>4
<\tweak #'X-offset #move-left b
\tweak #'X-offset #move-right a e>1
}<<attachment: switch-sides.png>>
_______________________________________________ lilypond-user mailing list [email protected] http://lists.gnu.org/mailman/listinfo/lilypond-user
