lilypond-user
[Top][All Lists]
Advanced

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

Re: Controlling horizontal bracket start position after a line break?


From: harm6
Subject: Re: Controlling horizontal bracket start position after a line break?
Date: Tue, 13 Sep 2011 15:50:08 -0700 (PDT)


Trevor Bača-2 wrote:
> 
> Hi,
> 
> I'm using horizontal brackets in some sketches I'm doing right now. (And
> the
> fact that the brackets nest is proving very useful indeed.)
> 
> A simplified example looks like this:
> 
> %%% BEGIN %%%
> 
> \version "2.15.11"
> 
> \layout { ragged-right = ##t }
> 
> \new Voice \with {
>     \consists Horizontal_bracket_engraver
> } {
>     c'1 \startGroup
>     d'1 \break
>     e'1
>     f'1 \stopGroup
> }
> 
> %%% END %%%
> 
> 
> This is good, with one exception:
> 
> The output attached shows that -- following a line break -- the resumption
> of the horizontal bracket begins *left of the staff*.
> 
> 
> Question: is it possible to align the resumption of the horizontal bracket
> with the left edge of the first note head of the system?
> 
> (That is, in this example, with the left edge of the e'1?)
> 
> 
> Trevor.
> 
> -- 
> Trevor Bača
> address@hidden
> 
> 

Hi Trevor,

modifying some definitions developed by Mike and David in this thread 
http://old.nabble.com/shorten-a-broken-hairpin-at-a-linebreak--td32343028.html
I hope this will do the job:

\version "2.14.2"

#(define (has-interface? grob interface)
 (member interface
         (assoc-get 'interfaces
                    (ly:grob-property grob 'meta))))

#(define (find-system grob)
 (if (has-interface? grob 'system-interface)
     grob
     (find-system (ly:grob-parent grob X))))

#(define (first-musical-column grobl)
 (if (not (eqv? #t (ly:grob-property (car grobl) 'non-musical)))
     (car grobl)
     (first-musical-column (cdr grobl))))

#(define (change-bound grob)
 (let* ((system (find-system grob))
        (cols (ly:grob-array->list (ly:grob-object system 'columns)))
        (musical-column (first-musical-column cols)))
   (ly:spanner-set-bound! grob LEFT musical-column)))

#(define (internal-my-callback grob)
  (let* (
         ;; have we been split?
         (orig (ly:grob-original grob))

         ;; if yes, get the split pieces (our siblings)
         (siblings (if (ly:grob? orig)
                       (ly:spanner-broken-into orig)
                       '())))

    (if (and (>= (length siblings) 2)
             (eq? (car (reverse siblings)) grob))
             (and
               (ly:grob-set-property! grob 'connect-to-neighbor (cons #t 
#f))
               (change-bound grob))
      )))

#(define (my-callback grob)
 (internal-my-callback grob)
 (ly:horizontal-bracket::print grob))


\new Voice \with {
    \consists Horizontal_bracket_engraver
} {
\override HorizontalBracket #'stencil = #my-callback
    c'1 \startGroup
    d'1 \break
    e'1
    f'1 \stopGroup
} 

Best,
  Harm
-- 
View this message in context: 
http://old.nabble.com/Controlling-horizontal-bracket-start-position-after-a-line-break--tp32459111p32459721.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.




reply via email to

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