Re: How to detect SpanBar from inside a make-bar-line definition?

2024-03-13 Thread Dan Eble

On 2024-03-13 20:09, Thomas Morley wrote:

I don't understand what you propose.


My advice was general software-design advice based on a hasty 
consideration of your post, so I'm not really surprised.



To give a different example, let's look at make-dotted-bar-line (afaik
it's your code).
There you have a `making-span-bar?'-condition, obviously you want a
span bar a little different than bar line.


Yes, I remember that there were cases where the dashes didn't meet well, 
but I don't remember the details.



a) If I implement (pretty-print grob) there, I always get BarLine,
never something else, regardless where I place that.


In that case, I think you will need to pass more information into the 
function from above or find a heuristic that works better.



c) the condition itself may fail, see
/input/regression/non-centered-bar-lines.ly for an example, or try to
set bar-extent to an interval not crossing zero.


That's why the comments call it a heuristic.


Because of b) I tried to patch make-dotted-bar-line, alas I found no
condition to apply the patched functionality to span bars only.

Thus I ask if there is such a condition at all. Or how it could be coded.


I'm not sure, and I have to be very motivated to read Scheme, which I am 
not at the moment.  Sorry.

--
Dan



Re: How to detect SpanBar from inside a make-bar-line definition?

2024-03-13 Thread Thomas Morley
Am Mi., 13. März 2024 um 23:56 Uhr schrieb Dan Eble
:
>
> On 2024-03-13 17:35, Thomas Morley wrote:
>
> > currently I'm attempting to improve dashed/dotted bar lines wrt to
> > changed staff-space and span bars.
> > We use both definitions for BarLine _and_ SpanBar, but then SpanBar is
> > frequently a little off.
> > It would be nice to have a possibility to detect whether a definition
> > is used for span bars.
>
> What specifically do you want to know?  Do you expect to code something like
>
>  if the grob is a BarLine:
>adjust ... by ...
>  if the grob is a Divisio:
>adjust ... by ...
>  if the grob is a SpanBar:
>adjust ... by ...
>
> If so, it seems that you could add a grob property for that adjustment
> and get it from the grob.
>
> > #(define (make-test-bar-line grob extent)
> >(let ((grob::make-span-bar? #f))
>
> Another possibility is for the grob's print procedure to pass more
> information down to this function.  That might be more appropriate if
> the information you require is not associated with the grob only, but is
> derived from a number of sources, like the surrounding staves, and would
> be useful for many different glyph print procedures.  Of course,
> ly:bar-line::print would provide values appropriate for bar lines and
> ly:span-bar::print would provide values appropriate for span bars.
>
> These are the opinions off the top of my head and I reserve the right to
> change them.
> --
> Dan
>
Hi Dan,

I don't understand what you propose.

To give a different example, let's look at make-dotted-bar-line (afaik
it's your code).
There you have a `making-span-bar?'-condition, obviously you want a
span bar a little different than bar line.
Though, I noticed a few things:
a) If I implement (pretty-print grob) there, I always get BarLine,
never something else, regardless where I place that.
b) Dotted span bars are not optimal. Compile my example from my
initilal post to get an example.
c) the condition itself may fail, see
/input/regression/non-centered-bar-lines.ly for an example, or try to
set bar-extent to an interval not crossing zero.

Because of b) I tried to patch make-dotted-bar-line, alas I found no
condition to apply the patched functionality to span bars only.

Thus I ask if there is such a condition at all. Or how it could be coded.
Alternatively, I could code a special `make-dotted-span-bar'-procedure
and define the dotted bar line as
(define-bar-line ";" #t #f ";-span")
or the like...

Thanks,
  Harm



PATCHES - Countdown to March 15

2024-03-13 Thread Colin Campbell

Here is the current countdown report.
The next countdown will begin on 2024-03-15
A list of all merge requests can be found here:
https://gitlab.com/lilypond/lilypond/-/merge_requests?sort=label_priority

 Push:
!2270 docs.webserver: update url for serveracim's handbook - Furkan Şimşekli
    https://gitlab.com/lilypond/lilypond/-/merge_requests/2270
!2268 Ensure backward compatibility for `hel-arabic.ly` - Werner Lemberg
    https://gitlab.com/lilypond/lilypond/-/merge_requests/2268
!2267 Various patches - Werner Lemberg
    https://gitlab.com/lilypond/lilypond/-/merge_requests/2267

 Countdown:
No patches in Countdown at this time.

 Review:
No patches in Review at this time.

 New:
No patches in New at this time.

 Waiting:
No patches in Waiting at this time.


Cheers,
Colin




Re: How to detect SpanBar from inside a make-bar-line definition?

2024-03-13 Thread Dan Eble

On 2024-03-13 17:35, Thomas Morley wrote:


currently I'm attempting to improve dashed/dotted bar lines wrt to
changed staff-space and span bars.
We use both definitions for BarLine _and_ SpanBar, but then SpanBar is
frequently a little off.
It would be nice to have a possibility to detect whether a definition
is used for span bars.


What specifically do you want to know?  Do you expect to code something like

if the grob is a BarLine:
  adjust ... by ...
if the grob is a Divisio:
  adjust ... by ...
if the grob is a SpanBar:
  adjust ... by ...

If so, it seems that you could add a grob property for that adjustment 
and get it from the grob.



#(define (make-test-bar-line grob extent)
   (let ((grob::make-span-bar? #f))


Another possibility is for the grob's print procedure to pass more 
information down to this function.  That might be more appropriate if 
the information you require is not associated with the grob only, but is 
derived from a number of sources, like the surrounding staves, and would 
be useful for many different glyph print procedures.  Of course, 
ly:bar-line::print would provide values appropriate for bar lines and 
ly:span-bar::print would provide values appropriate for span bars.


These are the opinions off the top of my head and I reserve the right to 
change them.

--
Dan



How to detect SpanBar from inside a make-bar-line definition?

2024-03-13 Thread Thomas Morley
Hi,

currently I'm attempting to improve dashed/dotted bar lines wrt to
changed staff-space and span bars.
We use both definitions for BarLine _and_ SpanBar, but then SpanBar is
frequently a little off.
It would be nice to have a possibility to detect whether a definition
is used for span bars.
But how to?

Her some code to play with, `grob::make-span-bar?' should become
something else ofcourse...

#(define (make-test-bar-line grob extent)
  (let ((grob::make-span-bar? #f))
(if grob::make-span-bar?
((@@ (lily) make-simple-bar-line) grob extent)
((@@ (lily) make-dotted-bar-line) grob extent

#(add-bar-glyph-print-procedure "t" make-test-bar-line)
#(define-bar-line "t" "t" "t" "t")

tst = { s1 \bar "t" s }

\new StaffGroup
<<
  \new Staff \tst
  \new Staff \tst
>>

Thanks,
  Harm