[frogs] Stencil combination [was: Re: How can I obtain articulation informations?] |
[ Thread Index |
Date Index
| More lilynet.net/frogs Archives
]
- To: Neil Puttock <n.puttock@xxxxxxxxx>
- Subject: [frogs] Stencil combination [was: Re: How can I obtain articulation informations?]
- From: Marc Hohl <marc@xxxxxxxxxx>
- Date: Tue, 01 Jun 2010 17:32:20 +0200
- Cc: "frogs@xxxxxxxxxxx" <frogs@xxxxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1275406342; l=19640; s=domk; d=hohlart.de; h=Content-Type:In-Reply-To:References:Subject:CC:To:MIME-Version:From: Date:X-RZG-CLASS-ID:X-RZG-AUTH; bh=ql4QVYNSOg5s2lilHQlFSheNFcc=; b=JzwLWKIilmrqToDmCMPY9+Qr9kE3vZDfIQCxHZ2GpfLF6miW7GKrxhlqoWC7enDQaUE GP7iHjyWiDN+uyEFVoW3lSJJjiB/T9U7orwnWrgF/OsGQKrfFvR7JJqyFnG+oBfbIiFaw CcXFRXr+sn8nAasxzXwe5ht6zeLgJcefYlg=
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