lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: accessing accidentals with \tweak


From: TaoCG
Subject: Re: accessing accidentals with \tweak
Date: Wed, 15 Jul 2009 16:27:58 -0700 (PDT)


Mark Polesky 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 just came up with something similar. It still requires a lot of typing
though, but maybe it'll help you anyway.

#(define-macro when
   (lambda (test . branch)
     (list 'if test
       (cons 'begin branch))))

#(define (change-accidental note-grob fontsize color)
  ;; notehead before-line-breaking callback
  (let ((accidental (ly:grob-object note-grob 'accidental-grob)))
    (when (not (null? accidental))
      (if (integer? fontsize)
        (ly:grob-set-property! accidental 'font-size fontsize))
      (if (and (list? color) (= (length color) 3))
        (ly:grob-set-property! accidental 'color color)))))

\relative {
  <c!
    \tweak #'before-line-breaking
      #(lambda (grob) (change-accidental grob -3 #f)) e!>
  <c!
    \tweak #'before-line-breaking
      #(lambda (grob) (change-accidental grob #f red)) e!>
  <c!
    \tweak #'before-line-breaking
      #(lambda (grob) (change-accidental grob -3 red)) e!>
} http://www.nabble.com/file/p24507733/test.png test.png 
-- 
View this message in context: 
http://www.nabble.com/accessing-accidentals-with-%5Ctweak-tp24487012p24507733.html
Sent from the Gnu - Lilypond - Dev mailing list archive at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]