On 7/15/09 4:19 PM, "Mark Polesky" <markpole...@yahoo.com> wrote:
> Mark Polesky wrote:
>
> 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.
>
>
> 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?
I've tried lots of ways, but couldn't figure out anything that I *really*
liked.
If the tweak is intended to be the same for most tweaks, things can be
simplified a little bit by using global variables:
\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))))
#(define tweaklist `((font-size . -3)
(color . ,green)))
#(define tweak-func #f)
#(define (modify-test grob)
(modify-accidental grob tweaklist))
\relative {
<\tweak #'before-line-breaking #suppress-accidental c!
\tweak #'before-line-breaking #modify-test e!>
}
Thanks for your creativity!
Carl
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel