Re: Grob callback: query position (unbroken, end-of-line, start-of-line)
Am 06.04.2017 um 16:24 schrieb David Nalesnik: Nevertheless, I think this should do it: Yes it does, many thanks! :-) Best, Simon ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Grob callback: query position (unbroken, end-of-line, start-of-line)
Hi, On Thu, Apr 6, 2017 at 8:18 AM, Klaus Blumwrote: > Hi Simon, > > > Simon Albrecht-2 wrote >> I would like to override RehearsalMark’s self-alignment-X to -1 only if >> it’s at start-of-line. How would I find that out in a grob callback? > > > I'm really no expert on this topic, but I once got some help from David > Nalesnik for snippet 1000: > > \override HorizontalBracket.stencil = > $(lambda (grob) >(let* ( >(open-on-left (= 1 (ly:item-break-dir (ly:spanner-bound grob > LEFT >(open-on-right (= -1 (ly:item-break-dir (ly:spanner-bound grob > RIGHT >) > ; ...do some more stuff... > )) > > The NR tells about those to functions: > > Function: ly:item-break-dir it > The break status direction of item it. -1 means end of line, 0 unbroken, > and 1 beginning of line. > > Function: ly:spanner-bound spanner dir > Get one of the bounds of spanner. dir is -1 for left, and 1 for right. > > Those direction numbers applied to breaks are always so confusing to me :( Nevertheless, I think this should do it: \version "2.19.56" #(define (at-line-beginning? grob) (let ((col (ly:item-get-column grob))) (and (eq? #t (ly:grob-property col 'non-musical)) (= 1 (ly:item-break-dir col) { \override Score.RehearsalMark.self-alignment-X = #(lambda (grob) (let ((beginning? (at-line-beginning? grob))) (if beginning? -1 0))) %R1 \mark \default R1 \mark \default R1 \break \mark \default R1 } %%% Hope this helps-- David ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Grob callback: query position (unbroken, end-of-line, start-of-line)
Hi Simon, Simon Albrecht-2 wrote > I would like to override RehearsalMark’s self-alignment-X to -1 only if > it’s at start-of-line. How would I find that out in a grob callback? I'm really no expert on this topic, but I once got some help from David Nalesnik for snippet 1000: \override HorizontalBracket.stencil = $(lambda (grob) (let* ( (open-on-left (= 1 (ly:item-break-dir (ly:spanner-bound grob LEFT (open-on-right (= -1 (ly:item-break-dir (ly:spanner-bound grob RIGHT ) ; ...do some more stuff... )) The NR tells about those to functions: Function: ly:item-break-dir it The break status direction of item it. -1 means end of line, 0 unbroken, and 1 beginning of line. Function: ly:spanner-bound spanner dir Get one of the bounds of spanner. dir is -1 for left, and 1 for right. Hope that helps. Cheers, Klaus -- View this message in context: http://lilypond.1069038.n5.nabble.com/Grob-callback-query-position-unbroken-end-of-line-start-of-line-tp201994p201995.html Sent from the User mailing list archive at Nabble.com. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Grob callback: query position (unbroken, end-of-line, start-of-line)
Hello everybody, I would like to override RehearsalMark’s self-alignment-X to -1 only if it’s at start-of-line. How would I find that out in a grob callback? Best, Simon ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user