[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Find ties enclosed in slur (while overriding stencil)
From: |
David Kastrup |
Subject: |
Re: Find ties enclosed in slur (while overriding stencil) |
Date: |
Tue, 14 Mar 2017 13:37:14 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
Urs Liska <address@hidden> writes:
> Am 14.03.2017 um 12:50 schrieb David Kastrup:
>> Urs Liska <address@hidden> writes:
>>
>>> Hi,
>>>
>>> I'm trying to determine if a slur includes ties in order to do some
>>> layout calculations.
>>>
>>> I'm overriding a stencil and have retrieved the slur's 'note-columns.
>>> Now I want to know if any of these note-columns (or enclosed note heads
>>> has a tie attached to it.
>>>
>>> I see that NoteColumn has a note-heads property. However, accessing
>>> these note heads and then asking for their ly:grob-object NAME 'ties
>>> returns empty lists only.
>> When? Where?
>
> I have some test music:
>
> {
> <<
> {
> e''1 ( ~ e'' e'' )
> }
> \\
> {
> c'1 ( \stemUp c'2 ~ c' c'1 )
> }
> >>
> }
>
>
> In the stencil callback I get all note heads through
>
> (all-note-heads
> (append-map (lambda (nc)
> (if (grob::has-interface nc 'note-column-interface)
> (ly:grob-array->list (ly:grob-object nc 'note-heads))
> (list nc))) note-cols))
>
> which is pretty much what Harm just suggested.
> If I print this all-note-heads I get
>
> All note heads: (#<Grob NoteHead > #<Grob NoteHead >)
>
> All note heads: (#<Grob NoteHead > #<Grob NoteHead >)
>
> All note heads: (#<Grob NoteHead > #<Grob NoteHead > #<Grob NoteHead >
> #<Grob NoteHead >)
>
> All note heads: (#<Grob NoteHead > #<Grob NoteHead > #<Grob NoteHead >)
>
> which tells me that I *did* access all the note head grobs. My naive
> approach would now be to reach the tie grob through
>
> (all-ties
> (map (lambda (g)
> (ly:grob-object g 'tie))
> all-note-heads))
>
> but this returns only empty lists.
'tie is only set as a grob object for accidentals as far as I can see.
> From
> https://github.com/openlilylib/openlilylib/blob/master/notation-snippets/shaping-bezier-curves/shape-tie-column/definition.ily
> I got this:
>
> (let ((ties (ly:grob-array->list (ly:grob-object grob 'ties))))
>
> but in that case "grob" is a TieColumn, and I don't know how I could
> access that (which is something I need anyway in order to do further
> formatting later).
Well, looks like you need to pursue that approach...
--
David Kastrup