lilypond-user
[Top][All Lists]
Advanced

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

Re: Resizing accidental in a chord


From: Robin Bannister
Subject: Re: Resizing accidental in a chord
Date: Thu, 4 Nov 2010 16:16:42 +0100

Rodolfo Zitellini wrote:
and I can't use \tweak (the notation manual states quite
clearly that accidentals can not be modified with \tweak)

You mean at the end of Notation Reference 5.3.4. Well, it used to be quite categorical on this, e.g in the 2.12.1 docs. Last year Mark Polesky found out that he could, though in a roundabout way, and so Trevor added the word "directly" [1], c.f. the 2.12.3 docs. I suppose this qualification kept the sentence correct, but hardly led readers to expect to be able to do it "indirectly" (which 5.5 Advanced tweaks will demonstrate one day). And I see that the 2.13(.38) docs have an additional sentence up front which is *seems* to make it clear that ordinary accidentals are quite inaccessible to any sort of \tweak command.
[1] http://lists.gnu.org/archive/html/lilypond-devel/2009-07/msg00353.html



But [1] shows how to do this. In your case:
%%%%%%%%%%%%%%%%%%%%
#(define (resize-accidental note-grob fontsize)
 ;; notehead before-line-breaking callback
 (let ((accidental (ly:grob-object note-grob 'accidental-grob)))
   (if (not (null? accidental))
     (ly:grob-set-property! accidental 'font-size fontsize))))

\relative c' { <fis ais \tweak #'before-line-breaking #(lambda (grob) (resize-accidental grob -5)) cis> }
%%%%%%%%%%%%%%%%%%%%


You can shorten this e.g. to <fis ais \twResizeAcc #-5 cis> if you define:
%%%%%%%%%%%%%%%%%%%%
twResizeAcc =
#(define-music-function (parser location fontsize mus) (number? ly:music?)
(set! (ly:music-property mus 'tweaks) (acons 'before-line-breaking (lambda (grob) (resize-accidental grob fontsize))
   (ly:music-property mus 'tweaks))) mus)
%%%%%%%%%%%%%%%%%%%%


Cheers,
Robin




reply via email to

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