lilypond-user
[Top][All Lists]
Advanced

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

Re: Accessing a grob from within a music function


From: Urs Liska
Subject: Re: Accessing a grob from within a music function
Date: Tue, 21 Mar 2017 17:58:32 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0


Am 21.03.2017 um 17:08 schrieb Urs Liska:
> Hey Harm,
>
>
> Am 17.03.2017 um 00:34 schrieb Thomas Morley:
>> Probably:
>>
>> {
>>     c'1( \break
>>   \override NoteColumn.after-line-breaking =
>>   #(lambda (nc)
>>      (ly:grob-translate-axis! (ly:grob-parent nc X) 5 X)
>>      ;; uncomment for viewing
>>      ;(ly:grob-set-property!
>>      ;  (ly:grob-parent nc X)
>>      ;  'stencil
>>      ;  ly:paper-column::print)
>>        )
>>
>>
>>   <cis'' dis'' fis'' gis''-1\2>2)\arpeggio ^"foo"
>> }
>>
>> Not tested beyond the above example, though.
>>
>> Cheers,
>>   Harm
> this seems to work, even when applied in an \override Tie.stencil
> I've tested in the following file, but I'm (somewhat) confident that
> I'll be able to integrate that inside my real project as well.
>
> \version "2.19.57"
>
> testoffset = 4
> done = ##f
> {
>   \override Tie.stencil =
>   #(lambda (t)
>      (let*
>       ((rb (ly:grob-parent (ly:spanner-bound t RIGHT) 1))
>        (lb (ly:grob-parent (ly:spanner-bound t LEFT) 1))
>        (accs (ly:note-column-accidentals rb)))
>       (if (not (null? accs))
>           (let*
>            ((acc-ext (ly:grob-property accs 'X-extent))
>             (acc-width (- (cdr acc-ext) (car acc-ext))))
>            (if (not done)
>                (begin
>                 (ly:grob-translate-axis! (ly:grob-parent rb X) testoffset X)
>                 (set! done #t)))
>            (ly:tie::print t)))))
>
>   <cis'' dis'' fis'' gis''>1
>   ~
>   \break
>   <cis''! dis''! fis''! gis''!>
> }
>
>
>
> Thanks a lot!
> Urs

Well, I have to take it back (although on second thought it was clear
that it wouldn't work that way).
While the note column is properly pushed to the right to accomodate the
object I want to place before it any columns further down the system are
*not*. And that's actually clear because the pushing takes place at a
moment when all the layout has already been done.

I'm afraid I won't get around some kind of two-pass system, registering
the required amount in the first pass and overriding NoteColumns
X-offset at a moment when it is still possible in a later compilation.

Urs
>

-- 
address@hidden
https://openlilylib.org
http://lilypondblog.org




reply via email to

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