[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
drum notes in parentheses?
From: |
Han-Wen Nienhuys |
Subject: |
drum notes in parentheses? |
Date: |
Thu, 5 Sep 2002 00:46:27 +0200 |
address@hidden writes:
> Hello,
>
>
> I want to put some notes in a drum piece in parentheses. I've looked at
> the example in molecule-hacking.ly, but that method doesn't seem to work
> with drum notes.
can you check whether this function works for you?
#(define (parenthesize-callback callback)
"Construct a function that will do CALLBACK and add parentheses.
Example usage:
\property Voice.NoteHead \\override #'molecule-callback
=
#(parenthesize-callback Note_head::brew_molecule)
"
(define (parenthesize-molecule grob)
"This function adds parentheses to the original callback for
GROB. The dimensions of the molecule is not affected.
"
(let* (
(fn (ly-get-default-font grob))
(pclose (ly-find-glyph-by-name fn "accidentals-rightparen"))
(popen (ly-find-glyph-by-name fn "accidentals-leftparen"))
(subject (callback grob))
; remember old size
(subject-dim-x (ly-get-molecule-extent subject 0))
(subject-dim-y (ly-get-molecule-extent subject 1))
)
; add parens
(set! subject
(ly-combine-molecule-at-edge
(ly-combine-molecule-at-edge subject 0 1 pclose 0.2)
0 -1 popen 0.2))
; revert old size.
(ly-set-molecule-extent! subject 0 subject-dim-x)
(ly-set-molecule-extent! subject 1 subject-dim-y)
subject
)
)
parenthesize-molecule
)
--
Han-Wen Nienhuys | address@hidden | http://www.cs.uu.nl/~hanwen