[Top][All Lists]

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

Re: defineBarLine truncates bartype when span is #f

From: Jean Abou Samra
Subject: Re: defineBarLine truncates bartype when span is #f
Date: Sat, 14 Jan 2023 00:57:15 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0

[Forgot the list, apologies!]

Le 14/01/2023 à 00:52, David Zelinsky a écrit :
In   { \defineBarLine bartype #'(end begin span) }
when `span' is `#f', only the first character of `bartype' is used.
Here is an example:

\version "2.24.0"
   \defineBarLine ";|" #'(#t #t #f)
   a'1 \bar ";|" b'1 \bar

This produces a single dotted barline, rather than a dotted-solid
combination as expected.

The explanation is in the definition of bar-line::compound-bar-line on
line 710 of bar-line.scm (the version in 2.24.0, though the current
version in git repository has the same feature).  In the initializations:

   (let* ...
          (span-glyph (get-span-glyph bar-glyph))
          (span-glyph-list (string->string-list span-glyph))

when span-glyph is #f, string->string-list returns '(""), a list of
length one.  Then further down, the for-each loops over the pair

        bar-glyph-list   span-glyph-list

and so does just one pass.

A reasonable fix seems to be to add these two lines to the definition of
get-span-glyph, right before the existing "if" statement (line 59 in
version 2.24.0):

     (if (and (boolean? span-glyph) (not span-glyph))
       (set! span-glyph ""))

[Maybe there's a better way to test if span-glyph is #f --- my knowledge
of scheme is pretty rudimentary!]

Then when span is #f, get-span-glyph will return a list of spaces of
length equal to the length of bar-glyph, which will do the right thing.

This doesn't have any effect on span-bar::compound-bar-line, which does
not use get-span-glyph, but calls

     (assoc-get bar-glyph span-bar-glyph-alist)


Thanks, added as https://gitlab.com/lilypond/lilypond/-/issues/6521
By the way, would you be willing to submit the fix yourself? Read
on how to proceed.

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

reply via email to

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