[frogs] Stencil combination [was: Re: How can I obtain articulation informations?]

[ Thread Index | Date Index | More lilynet.net/frogs Archives ]


Neil Puttock schrieb:
[...]
OK, but surely you need to work with tie::handle-tab-note-head?  IIRC,
the parentheses on the tied notes come via a stencil override, not
from ParenthesesItem.
You are right. I included my "harmonic detector" now in parenthesize-tab-note-head; this seems the appropriate place to me, because this function is called several times (for ties and repeat ties), so it would be convenient if this function handles the
harmonics properly.

I have now

(define-public (parenthesize-tab-note-head grob)

 ;; helper function
 (define (is-harmonic grob)
(let* ((articulations (ly:event-property (event-cause grob) 'articulations))
          (harmonic-found #f))

     (for-each (lambda (art)
                 (if (eq? 'harmonic-event (ly:event-property art 'class))
                     (set! harmonic-found #t)))
               articulations)
     harmonic-found))

 (let* ((font (ly:grob-default-font grob))
        (open (stencil-whiteout
               (ly:font-get-glyph font "accidentals.leftparen")))
        (close (stencil-whiteout
                (ly:font-get-glyph font "accidentals.rightparen")))
        (me (ly:text-interface::print grob))
        (padding (if (is-harmonic grob) 10 0)))

   (ly:stencil-combine-at-edge
(ly:stencil-combine-at-edge me X LEFT open padding) X RIGHT close padding)))

The value of 10 for the padding is ridicously, but so I can spot the effect at first glance. Now it seems that the padding itself has a whiteout effect, because the string lines are erased and sometimes the harmonic brackets, too (I think the latter is due to the
internal order in which the grobs are placed) - see the attached pictures.

Why does the whitespace occur? Is there another possibility to combine the stencils appropriately
so that they "leave space" for the harmonic brackets?


For the articulations check, try looking at note-finger in
scm/translation-functions.scm.  Something similar to this, using
for-each instead of map, should work.

Yes, works great - thanks for the tip, I was sure that I saw some functions handling with the articulation informations before while digging through the code some time ago,
but I forgot where.

Marc
Cheers,
Neil


JPEG image

JPEG image



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/