Re: defineBarLine truncates bartype when span is #f

Jean Abou Samra <[email protected]>
Newsgroups gmane.comp.gnu.lilypond.bugs
Message-ID <[email protected]>
[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)
>
> directly.




Thanks, added as https://gitlab.com/lilypond/lilypond/-/issues/6521
By the way, would you be willing to submit the fix yourself? Read
https://lilypond.org/doc/v2.25/Documentation/contributor/working-with-source-code 

on how to proceed.
OpenPGP_signature (application/pgp-signature, 236 B) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.