lilypond-devel
[Top][All Lists]
Advanced

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

Re: BarLines behave weirdly when colored


From: Jean Abou Samra
Subject: Re: BarLines behave weirdly when colored
Date: Mon, 31 Oct 2022 17:45:46 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1

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))))





reply via email to

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