lilypond-devel
[Top][All Lists]

## Re: alternatives not taken into account in automatic accidentals

 From: Dan Eble Subject: Re: alternatives not taken into account in automatic accidentals Date: Sun, 9 Aug 2009 17:40:11 -0400


On 9 Aug 2009, at 15:46, Trevor Daniels wrote:



Mark Polesky wrote Sunday, August 09, 2009 7:31 PM


Well, that's not a functional barline, it's just printed.


Mark,


I appreciate your reply. Applying this statement to certain other figures (e.g. key signature or clef) would indicate a bug. Does a non- functional bar line differ from those?


Note that manual bar lines are purely visual. They do not affect
any of the properties that a normal bar line would affect, such as
measure numbers, accidentals, line breaks, etc.


I thought that all bar lines affect line breaking, even invisible ones.


They do not affect
the calculation and placement of subsequent automatic bar lines.
When a manual bar line is placed where a normal bar line already
exists, the effects of the original bar line are not altered.

If anyone likes this change, feel free to make it;


Thanks Mark - pushed.



Should the manual explain that a feature doesn't work as expected, but stop short of citing a work around?


I am aware of "!" which could be used in this situation, but is there anything better? Is there something I could wrap in a variable to insert a bar line and reset the accidental state as if it were a new measure?

stanzaBar = { \bar "||" ... }


Even that would not necessarily satisfy me, because I routinely use the following function for line breaking in hymn tunes, and I would want the accidental behavior to depend on the visibility of the bar line (or presence of a line break, even if the bar line is invisible).

% At a place where there would normally be a bar line, print "|".
% At a mid-measure line break, print "||".
% Otherwise, do not print a bar.
meterBar =
{
\bar "meter"
\applyOutput #'Timing #handle-meter-bar-line
}


In case it is relevant, here is the applied function. (I know it's not perfect. For one thing, the double bar lines still consume space when they are invisible.)

#(define (handle-meter-bar-line grob orig-ctx context)
(let ((grob-name (cdr (assoc 'name (ly:grob-property grob 'meta)))))
(if (and (equal? grob-name 'BarLine)
(equal? (ly:grob-property grob 'glyph) "meter"))
(let* ((measurePos (ly:context-property context 'measurePosition))
(measureLen (ly:context-property context 'measureLength))
(mid-measure (and (ly:moment<? ZERO-MOMENT measurePos)
(ly:moment<? measurePos measureLen))))
(if mid-measure
(begin
(set! (ly:grob-property grob 'break-visibility) #(#t #f #f))
(set! (ly:grob-property grob 'glyph) "||"))
(set! (ly:grob-property grob 'glyph) "|"))))))

Thanks,
--
Dan