Hi,
On Thu, Apr 6, 2017 at 8:18 AM, Klaus Blum <[email protected]> wrote:
> 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
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user