[Top][All Lists]

[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 {
    \tweak #'before-line-breaking
      #(lambda (grob) (change-accidental grob -3 #f)) e!>
    \tweak #'before-line-breaking
      #(lambda (grob) (change-accidental grob #f red)) e!>
    \tweak #'before-line-breaking
      #(lambda (grob) (change-accidental grob -3 red)) e!>
} test.png 
View this message in context:
Sent from the Gnu - Lilypond - Dev mailing list archive at

reply via email to

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