[Top][All Lists]

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

Re: box around notes

From: address@hidden
Subject: Re: box around notes
Date: Fri, 16 Dec 2011 09:06:11 +0100

On Dec 16, 2011, at 6:27 AM, David Nalesnik wrote:

> Hi all,
> I'm trying to write a function to add a box around notes.  I've come up with 
> the following, and I'm wondering if anyone has any ideas how to improve it or 
> perhaps a different approach.
> Basically, the function creates a box as a TextSpanner.  The height of the 
> box is based on the highest and lowest stems.
> I'd like to automate all aspects of the function, but I've had to add a 
> correction factor for height.  This compensates for my inability to determine 
> the Y-position of the spanner. I can determine Y-values "after the fact," but 
> all my attempts to determine them _within_ the function end up "killing" 
> parts of the box.  You can see this by uncommenting any of the display lines 
> in the function--you'll get values in the log . . . at the price of losing 
> the left and right "text" of the spanner--three sides of the box.  (To add to 
> the mystery for me, uncommenting single lines vs. more than one yields 
> different results.)
> The example uses a small correction, but even bigger numbers are needed when 
> articulations are added.
> Any suggestions?
> Thanks,
> David

Hey David,

It depends on what you want your box to go around.  If it's only ever notes and 
stems (i.e. not articulations, tremoli, etc.), you can add a stencil property 
to the NoteColumn grob that uses its extents for the parameters you need to 
draw your box.

Once articulations are in the game, I'd recommend creating a custom Scheme 
engraver that collects all the grobs you want, throws them into the "elements" 
grob array of a custom grob that implements the axis-group-interface (you can 
define your own grobs via the same procedure as grobs are defined in 
define-grobs.scm), and then use axis-group-interface::pure-height and 
axis-group-interface::height for the Y-extents (which will automatically search 
the "elements" grob array.


reply via email to

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