Harm,
On Sun, Apr 9, 2017 at 5:30 PM, Thomas Morley <[email protected]> wrote:
> Hi Malte,
>
> this is offtopic:
>
> 2017-04-09 22:48 GMT+02:00 Malte Meyn <[email protected]>:
>>
>>
>> Am 09.04.2017 um 20:53 schrieb Thomas Morley:
>>> I would have expected the whole bracket to be (much) smaller, instead
>>> only the part of the bracket left from TupletNumber is affected.
>>
>> How do you expect any sensible output from that? 10 is so much that the
>> “left” end of the bracket is right from the right e
>
> Well, this happens while trying some heavy overrides, shanghaiing other grobs.
> Sometimes, doing extreme things leads to detecting some weakness...
>
> I'm attempting to solve the request at
> http://lilypond.1069038.n5.nabble.com/Drawing-wavy-line-across-the-bars-tt201843.html
> in an automagical manner.
>
> Look at the attached picture.
> The text is the TupletNumber, the wavy line the TupletBracket. ;)
> Though, it gives wrong output, if the TupletBracket is not long
> enough. Moving the left end via shorten-pair to make room for the text
> gives the strange result then.
> Probably another property to use? It's still work in progress and it's
> still possible I don't get to stable state...
> Maybe TupletBracket is the wrong grob anyway and I should try
> HorizontalBracket or another Bracket. Looks I can't go for real
> spanners, because there ending gives a warning, when I try to let them
> print to the real end of a bar _and_ this bar is the last in the
> piece.
> Which may be a bug of its own:
>
> {
> c'1\startTextSpan
> \break
> c'1 <>\stopTextSpan
> }
>
> returns:
>
> atest-53.ly:1095:12: programming error: bounds of this piece aren't breakable.
> c'1
> \startTextSpan
> atest-53.ly:1095:12: continuing, cross fingers
>
> The visual output is ok, though.
TextSpanner seems like a more natural grob to co-opt!
The text spanner has its bounds set to NoteColumns. (Broken bounds
will be set to NonMusicalPaperColumn later.) In your example, the
engraver runs out of NoteColumns and tries to set the right bound to
PaperColumn, which apparently doesn't work I can put a patch for this
forward.
I thought it might be helpful to put the changes into
input/regression/scheme-text-spanner.ly so you might try it with your
stencil. I removed all of the grob creation stuff so this works with
ordinary TextSpanner. Strangely, it wouldn't work with the code
that's in the current regtest, but I just happened to have a rewrite
around that mimics the C++ original more closely :) Turns out that
works.
Best,
David.
\version "2.19.59"
#(define (add-bound-item spanner item)
(if (null? (ly:spanner-bound spanner LEFT))
(ly:spanner-set-bound! spanner LEFT item)
(ly:spanner-set-bound! spanner RIGHT item)))
#(define (axis-offset-symbol axis)
(if (eq? axis X) 'X-offset 'Y-offset))
#(define (set-axis! grob axis)
(if (not (number? (ly:grob-property grob 'side-axis)))
(begin
(set! (ly:grob-property grob 'side-axis) axis)
(ly:grob-chain-callback
grob
(if (eq? axis X)
ly:side-position-interface::x-aligned-side
side-position-interface::y-aligned-side)
(axis-offset-symbol axis)))))
schemeTextSpannerEngraver =
#(lambda (context)
(let ((span '())
(finished '())
(current-event '())
(event-start '())
(event-stop '()))
(make-engraver
(listeners
((text-span-event engraver event)
(if (= START (ly:event-property event 'span-direction))
(set! event-start event)
(set! event-stop event))))
(acknowledgers
((note-column-interface engraver grob source-engraver)
(if (ly:spanner? span)
(begin
(ly:pointer-group-interface::add-grob span 'note-columns grob)
(if (null? (ly:spanner-bound span LEFT))
(add-bound-item span grob)))
(if (ly:spanner? finished)
(begin
(ly:pointer-group-interface::add-grob finished 'note-columns grob)
(if (null? (ly:spanner-bound finished RIGHT))
(add-bound-item finished grob)))))))
((process-music trans)
(if (ly:stream-event? event-stop)
(if (null? span)
(ly:warning "You're trying to end a scheme text spanner
but you haven't started one.")
(begin
(set! finished span)
(ly:engraver-announce-end-grob trans finished '())
(set! span '())
(set! current-event '()))))
(if (ly:stream-event? event-start)
(if (ly:stream-event? current-event)
(ly:warning "Already have a scheme text spanner")
(begin
(set! current-event event-start)
(set! span (ly:engraver-make-grob trans 'TextSpanner event-start))
(let ((dir (ly:event-property current-event 'direction)))
(if (ly:dir? dir)
(set! (ly:grob-property span 'direction) dir)))
(set-axis! span Y)
(set! event-start '())))))
((stop-translation-timestep trans)
(if (and (ly:spanner? span)
(null? (ly:spanner-bound span LEFT)))
(ly:spanner-set-bound! span LEFT
(ly:context-property context 'currentMusicalColumn)))
(typeset-all finished context)
(set! event-start '())
(set! event-stop '()))
((finalize trans)
(typeset-all finished context)
(if (ly:spanner? span)
(begin
(ly:warning "I think there's a dangling scheme text spanner :-(")
(ly:grob-suicide! span)
(set! span '())))))))
#(define typeset-all
(lambda (finished ctx)
(if (ly:spanner? finished)
(if (null? (ly:spanner-bound finished RIGHT))
(let ((e (ly:context-property ctx 'currentMusicalColumn)))
(ly:spanner-set-bound!
finished
RIGHT
(if (grob::has-interface e 'paper-column-interface)
(ly:context-property ctx 'currentCommandColumn)
e))))
(set! finished '()))))
\layout {
\context {
\Voice
\remove "Text_spanner_engraver"
\consists \schemeTextSpannerEngraver
}
}
{
c1\startTextSpan
c1
\break
c1 <>\stopTextSpan
}
_______________________________________________
bug-lilypond mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-lilypond