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:08:02 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0

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

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




reply via email to

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