[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lilypond-devel
Subject:    Re: BarLines behave weirdly when colored
From:       Jean Abou Samra <jean () abou-samra ! fr>
Date:       2022-10-31 16:45:46
Message-ID: 34cf8dd1-4195-058f-fd29-ac32b667d171 () abou-samra ! fr
[Download RAW message or body]

Le 31/10/2022 à 17:36, Valentin Petzel a écrit :
> Hello you all,
>
> on SE I’ve encountered a weird issue: BarLine stencils in Lilypond do not have
> rounded corners, but they are shortened by half a staff line, so the rounded
> ends of the staff lines lead to some rounded effect for the last bar line. But
> when changing the color of the BarLine it will instead take the whole height.
>
> Thus I want to ask:
> 1) Does anyone have an idea why this could be happening?
> 2) Is there some intention in this happening or can this be considered a bug?
> 3) Is there a reason why this BarLine is shortened in the first place (if we
> want rounded corners we could always draw the Bar Lines with rounded corners)?
>
> Here is an example:
>
> [snipped]



Have a look at bar-line.scm.


(define-public (ly:bar-line::calc-bar-extent grob)
   (let ((staff-symbol (ly:grob-object grob 'staff-symbol)))
     (if (ly:grob? staff-symbol)
         (let ((staff-extent (ly:grob-property staff-symbol 
'widened-extent))
               (bar-line-color (ly:grob-property grob 'color))
               (staff-color (ly:grob-property staff-symbol 'color)))
           ;; FIXME: "red" not eq? to #(rgb-color 1 0 0)
           (if (eq? bar-line-color staff-color)
               ;; Due to rounding problems, bar lines extending to the 
outermost edges
               ;; of the staff lines appear wrongly in on-screen display
               ;; (and, to a lesser extent, in print) - they stick out a 
pixel.
               ;; The solution is to extend bar lines only to the middle
               ;; of the staff line - unless they have different colors,
               ;; when it would be undesirable.
               ;;
               ;; This reduction should not influence whether the bar is 
to be
               ;; expanded later, so length is not updated on purpose.
               (let ((half-staff-line-thickness
                      (* 1/2 (ly:staff-symbol-line-thickness grob))))
                 (interval-widen staff-extent (- 
half-staff-line-thickness)))
               staff-extent))
         '(0 . 0))))



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic