On Tue, 2009-03-24 at 15:35 +0000, codesite-nore...@google.com wrote: > Comment #7 on issue 415 by csny...@mvpsoft.com: Hidden accidental of tied > note still takes space > http://code.google.com/p/lilypond/issues/detail?id=415 > > I did some looking into this recently to see if I could fix it. What I > found is that > we have a circular dependency situation: the line-break code needs to know > how much > space the accidentals are taking up to know when to insert line breaks, but > tied > accidentals will be printed only if the measure is the first measure in the > line, > making accidental spacing dependent on line breaks. > > When I realized that, I decided that fixing it required more knowledge of > the > LilyPond code than I possess. A possible solution I came up with (but do > not know how > to implement) would be to have the accidentals take up space when the line > breaks are > calculated, but then re-calculate the spacing within each line after > deciding where > the line breaks are, removing tied accidentals where appropriate.
It should be possible to solve this without doing the line-breaking twice. Have a look at how we handle input/regression/accidental-tie.ly. First of all, you need to understand that every breakable column (the non-musical columns that contain barlines, etc, not notes) has 3 copies. Different copies are used depending on whether the column in question goes at the beginning, the middle or the end of a line. The accidental enters the spacing calculation in staff-spacing.cc:189. You'll see in paper-column.cc:158 that the "conditional skyline" is added to the column on the right (ie. the column with the note and the accidentals). The "normal" skyline that is retrieved in paper-column.cc:152 has no accidentals in it; the "conditional" skyline may or may not contain the accidentals depending on the "left" column. If the left column is the breakable paper column that begins a line, all the accidentals are included in the skyline; the logic that accomplishes this is accidental-placement.cc:85, which is called from separation-item.cc:103. This way, the spacing is done using only the accidentals that are relevant and it is why bug 415 is fixed. The problem is that the position of the relevant accidentals is still affected by the position of the irrelevant accidentals and that is why bug 612 is still open. One solution might be the following, which involves modifying only accidental-placement: make 2 copies of every accidental, one for the start-of-a-line case and one for the middle-of-a-line case (so the start-of-a-line accidentals would be, in the terminology of Accidental_placement::split_accidentals, the break_reminder accidentals and the real_accidentals while the middle-of-a-line accidentals would have copies of only the real_accidentals). Run the accidental layout algorithm (currently in Accidental_placement::calc_positioning_done, but you'll want to move it to a different function and make calc_positioning_done call it twice) twice, once for each set of accidentals. Then modify Accidental_placement::get_relevant_accidentals to return one of the sets of accidentals. Joe _______________________________________________ bug-lilypond mailing list bug-lilypond@gnu.org http://lists.gnu.org/mailman/listinfo/bug-lilypond