Done! :-)
moreWhiteout =
#(define-music-function (parser location adds item)(pair? symbol-list-or-music?)
(define more-stencil-whiteout
(lambda (grob)
(let* ((function (assoc-get 'stencil
(reverse (ly:grob-basic-properties grob))))
(stil
(if (and (procedure? function)
(not (eq? (procedure-name function)
'more-stencil-whiteout)))
(function grob)
(begin
(ly:warning "~a has no stencil. Ignoring" grob)
#f))))
(if stil
(let*((x-ext (ly:stencil-extent stil X))
(y-ext (ly:stencil-extent stil Y))
(add-to-x-ext (if (pair? (car adds)) (car adds) adds))
(add-to-y-ext (if (pair? (cdr adds)) (cadr adds) '(0 . 0)))
;(self-alignment-X (ly:grob-property grob 'self-alignment-X))
(new-stil
(ly:make-stencil
(ly:stencil-expr stil)
(offset-add x-ext add-to-x-ext)
(offset-add y-ext add-to-y-ext))))
;(display self-alignment-X)
(if (grob::has-interface grob 'dynamic-text-interface)
(let* ((new-stencil-length
(interval-length (ly:stencil-extent new-stil X)))
(orig-stencil-length
(interval-length (ly:stencil-extent stil X))))
(ly:grob-set-property! grob 'self-alignment-X
(if (not (= 0 (- new-stencil-length orig-stencil-length)))
(/ (- (- new-stencil-length (cdr add-to-x-ext))
(+ orig-stencil-length (cdr add-to-x-ext)))
new-stencil-length)
0))))
new-stil)
#f))))
#{
\tweak layer #10
\tweak whiteout ##t
\tweak stencil #more-stencil-whiteout
#item
#})
%%%%%%%%%%%%%%%%%%%%%%%
%% EXAMPLE
%%%%%%%%%%%%%%%%%%%%%%%
\layout {
\override DynamicText.extra-spacing-width = #'(+inf.0 . -inf.0)
}
musicI = { \time 2/4 \repeat unfold 16 b8 }
musicII = {
r2
b4 -\moreWhiteout #'((-2 . 0.5)(0 . 0)) ^"XXXXXX" -\moreWhiteout #'(0 . 4) ^"YYYYYY"
b
r
r -\moreWhiteout #'((-3.2 . 4.12)(0 . 0)) ^\pppp
b4 -\moreWhiteout #'(-2 . 10.5) ^"XXXXXX" b
}
\new StaffGroup <<
\new Staff \relative c'' \musicI
\new Staff \relative c'' \musicII
>>
--Karol
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user