lilypond-user
[Top][All Lists]
Advanced

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

Re: Combining custom bar line with standard elements


From: Thomas Morley
Subject: Re: Combining custom bar line with standard elements
Date: Sun, 6 Dec 2020 12:39:16 +0100

Am Sa., 5. Dez. 2020 um 17:45 Uhr schrieb Fr. Samuel Springuel
<rpspringuel@gmail.com>:
>
> I have a couple of customized bar lines defined and have come across an 
> instance where I want to combine them with a standard bar line element.  
> However, my naive attempts aren’t working as expected.  My first attempt 
> resulted in the bar line simple disappearing; in the second the customization 
> disappeared.  How can I make the combination while still preserving my 
> customization?
>
> \version "2.20.0"
> \language "english"
>
> \layout {
>     \context {
>         \Staff
>         \override BarLine.before-line-breaking =
>         #(lambda (grob)
>              (let ((glyph-name (ly:grob-property grob 'glyph-name)))
>                  (if (member glyph-name '("[" "]"))
>                      (begin
>                       (ly:grob-set-property! grob 'thick-thickness 2)
>                       (ly:grob-set-property! grob 'font-size -4)
>                       )
>                      )
>                  )
>              )
>     }
> }
>
> \defineBarLine "[" #'("" "[" "")
> \defineBarLine "]" #'("]" "" "")
> \defineBarLine "]." #'("]." "" "")
>
> global = { \key f \major }
>
> music = {
>     g' f' e' d' \bar "["
>     f' g' a' g' \bar "|"
>     f' e' c' d' \bar "]."
> }
>
> \new Staff
> <<
>     \new Voice = "mel" { \global \music }
> >>
>
>
> ✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝✝
> Fr. Samuel, OSB
> (R. Padraic Springuel)
> St. Anselm’s Abbey
> 4501 South Dakota Ave, NE
> Washington, DC, 20017
> 202-269-2300
> (c) 202-853-7036
>
> PAX ☧ ΧΡΙΣΤΟΣ
>
>

Iiuc, you want to change thick-thickness and font-size for barlines
containing "[" or "]".

Then try:

\layout {
  \context {
    \Staff
    \override BarLine.before-line-breaking =
    #(lambda (grob)
      (let ((glyph (ly:grob-property grob 'glyph)))
        (if (and (string? glyph)
                 (or (string-contains glyph "[")
                     (string-contains glyph "]")))
            (begin
             (ly:grob-set-property! grob 'thick-thickness 2)
             (ly:grob-set-property! grob 'font-size -4)))))
  }
}

\defineBarLine "[" #'("" "[" "")
\defineBarLine "]" #'("]" "" "")
\defineBarLine "]." #'("]." "" "")

global = { \key f \major }

music = {
  g' f' e' d' \bar "["
  f' g' a' g' \bar "|"
  f' e' c' d' \bar "]."
}

\new Staff
<<
    \new Voice = "mel" { \global \music }
>>


HTH,
  Harm



reply via email to

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