lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Find ties enclosed in slur (while overriding stencil)


From: Urs Liska
Subject: Re: Find ties enclosed in slur (while overriding stencil)
Date: Tue, 14 Mar 2017 13:11:54 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0


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. >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).
-- 
address@hidden
https://openlilylib.org
http://lilypondblog.org

reply via email to

[Prev in Thread] Current Thread [Next in Thread]