[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: accessing accidentals with \tweak
From: |
Mark Polesky |
Subject: |
Re: accessing accidentals with \tweak |
Date: |
Wed, 15 Jul 2009 15:19:50 -0700 (PDT) |
Mark Polesky wrote:
> Unfortunately this doesn't seem to work. See attached PNG and
> console output below. When using this "indirect" tweaking method,
> only the *last* tweak affects the typeset output. The desired
> output in the example below is to have both E-naturals colored red
> and reduced in size. The first one is reduced but not colored; the
> second one is colored, but not reduced.
Okay, I figured out a way around this -- by passing an property-alist to
the 'before-line-breaking tweak, I was able to get all the accidental
modifications done in one tweak (see "modify-accidental" below). I've
also included an improved suppress-accidental callback that I think
could be added to the source.
____________________
\version "2.13.2"
#(define (modify-accidental note-grob prop-alist)
;; notehead before-line-breaking callback
(let ((accidental (ly:grob-object note-grob 'accidental-grob)))
(if (not (null? accidental))
(for-each
(lambda (x)
(ly:grob-set-property! accidental (car x) (cdr x)))
prop-alist))))
#(define (suppress-accidental note-grob)
;; notehead before-line-breaking callback
(let ((accidental (ly:grob-object note-grob 'accidental-grob)))
(if (not (null? accidental))
(ly:grob-suicide! accidental))))
\relative {
<\tweak #'before-line-breaking #suppress-accidental c!
\tweak #'before-line-breaking
#(lambda (grob)
(modify-accidental grob `((font-size . -3)
(color . ,red)))) e!>
}
____________________
So, I guess I can't complain, because all of the functionality I need is
now accessible. My only gripe is that this is a lot of typing. Could a
special property be devised that would automate this? Something like:
\relative {
<c!
\tweak #'tweak-accidental #`((font-size . -3) (color . ,red)))) e!>
}
Or is there some other way of reducing all that code?
Thanks.
- Mark
accidental-tweaks_02.png
Description: PNG image