bug-lilypond
[Top][All Lists]
Advanced

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

defineBarLine truncates bartype when span is #f


From: David Zelinsky
Subject: defineBarLine truncates bartype when span is #f
Date: Fri, 13 Jan 2023 18:52:02 -0500

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.


-David



reply via email to

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