On Thu, Feb 16, 2012 at 5:04 PM, Thomas Morley <address@hidden>
2012/2/16 David Nalesnik <address@hidden>:
> Hi Harm,
[ ... ]
> I have another suggestion which may be helpful.
> Since there are relatively few Scheme engravers out there, why not try to
> translate a short C++ engraver into Scheme? (The regression test which
> creates a text spanner does this, as far as I can tell.) I know almost
> nothing about C++ myself, but found that I was able to "translate"
> arpeggio.cc. I can share this if you're interested, along with an engraver
> based on it
OK, I've attached my attempt at putting "arpeggio-engraver.cc" into Scheme. I did this because I thought that engraver might be a natural one to modify to create parentheses around chords. Here I mean parenthesis encompassing an entire chord, rather than each individual note as Lily does when given
\parenthesize <c e g>
Basically, the custom engraver in the second file creates an arpeggio before and after the targeted chord, while the stencil function replaces the wavy lines with parentheses. (To make this work with the most recent development versions, you will need to replace "make-parenthesis-stencil" with the latest from "stencil.scm" since 'bezier-sandwich is gone.)
I've defined a ChordParentheses grob so that you can work with the parentheses and regular arpeggios independently, though all I've done (at this point) is change the name.
Note that the engraver won't work for single-note "chords" or for cross-staff parentheses. (This would require working with the Span_arpeggio_engraver too.)
The horizontal positioning of the parentheses often needs to be adjusted somewhat, so I've included a function to modify the left and right sides independently.
Anyway, I hope this might be of use! I welcome any comments, suggestions for improvement.