Am 08.03.2017 um 11:00 schrieb David Kastrup: > Urs Liska <[email protected]> writes: > >> Hi, >> >> I have a hard time understanding ly:grob-original and whether I need it. >> I'm working on a custom slur stencil and now have to support broken slurs. >> >> I looked into the implementation of \shape (which is only partially >> appropriate because it doesn't create a stencil but property overrides) >> and found that it splits the grob into its siblings using this code: >> >> (let* ((orig (ly:grob-original grob)) >> (siblings (if (ly:spanner? grob) > Looks like (if (ly:spanner? orig) ... would make more sense here. >> (ly:spanner-broken-into orig) '())) >> I don't really see why "orig" is created here. What's the difference >> between the last line of the example and using (ly:spanner-broken into >> grob) here? As usual the documentation on the Scheme-functions page >> isn't helpful ... > Apparently grob is assumed to possibly already be a broken piece of slur > here. So its unbroken original is looked up, and the pieces are taken > from there.
I think I begin to understand what happens. Obviously I had created an extra (code/concept) loop in my attempt. When I create a callback function to override a stencil the grob that is passed into it actually *is* the broken part as a single grob. Only with ly:grob-original I can access the original full grob and through that its child grobs (from which the "current" grob is one). I think in my case I won't actually need that at all. I thought the callback would be called once and it would be my responsibility to iterate over the child slurs and create a combined stencil for all of them. But actually I get the broken fragment and have to deal with that alone. What I did was pretty embarrasing (and not interesting enough to share) and I'm happy to see that I can make it much simpler again. I think each sibling doesn't really have to know about the others because they are visually completely independent. And it's easy to tell a broken slur/tie apart from a complete one through the bounds. A complete curve has a NoteHead or a NoteColumn at both ends while a broken one has a NonMusicalPaperColumn on one or both sides. > All these are pure read-only functions: nothing is "split" or "broken" > in these lines themselves. I know. They return split copies, which is what I thought I'd need. Urs -- [email protected] https://openlilylib.org http://lilypondblog.org _______________________________________________ lilypond-user mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-user
