lilypond-user
[Top][All Lists]
Advanced

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

Re: Custom Barline


From: Thomas Morley
Subject: Re: Custom Barline
Date: Sun, 22 Aug 2021 18:16:48 +0200

Am So., 22. Aug. 2021 um 13:42 Uhr schrieb Paul Hodges <pwh@cassland.org>:
>
> Encouraged by the fantastic responses to my first problem, I now offer my 
> other issue.
>
> The composer uses a special barline to mark the phrase pattern of a piece.  
> The form of this barline is like this:
> (MS) https://cassland.org/images/PhraseBarMS.jpg
> (Printed elsewhere) https://cassland.org/images/PhraseBarSet.jpg
>
> In this case I can't even think where to start...
>
> Thanks,
> Paul

How about:

%% Define a new bar-line drawing-procedure
#(define (make-thick-phrase-bar-line grob extent)
  "Draw a smaller thick bar line."
  (let* ((line-thickness (layout-line-thickness grob))
         (thick-thickness (* (ly:grob-property grob 'thick-thickness 1)
                       line-thickness))
         (inner-extent
           (interval-widen extent (- (ly:staff-symbol-staff-space grob))))
         (final-extent-thick
           (bar-line::widen-bar-extent-on-span grob inner-extent)))

        (bar-line::draw-filled-box
          (cons 0 thick-thickness)
          final-extent-thick
          thick-thickness
          final-extent-thick
          grob)))

%% Assign "p" to the new bar-line drawing-procedure
#(add-bar-glyph-print-procedure "p" make-thick-phrase-bar-line)

%% Define a ready to use new BarLine
#(define-bar-line "p|" "p|" #f " |")

\layout {
  \context {
      \Score
      %% Actually not really needed:
      \override BarNumber.break-visibility = ##(#t #t #t)
      \override BarNumber.self-alignment-X = 0
  }
  \context {
      \Staff
      %% Needed:
      %% If "p|"-BarLine is used, set 'kern to zero.
      \override BarLine.before-line-breaking =
        #(lambda (grob)
          (if (equal? (ly:grob-property grob 'glyph) "p|")
              (ly:grob-set-property! grob 'kern 0)))
  }
}

\new StaffGroup
  <<
    \new Staff { b1 \mark \default \bar "p|" b \break \bar "p|" b }
    \new Staff { b1 b b }
  >>



HTH,
  Harm



reply via email to

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