Am 14.03.2017 um 12:50 schrieb David Kastrup:
> Urs Liska <u...@openlilylib.org> 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. 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).

-- 
u...@openlilylib.org
https://openlilylib.org
http://lilypondblog.org
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to