* input/regression/spacing-end-of-line.ly: new file.
* lily/note-spacing.cc (get_spacing): take into account breakable
stuff sticking out at the left (time sig change at line break).
* lily/spacing-spanner.cc (breakable_column_spacing): junk weird
raggedright code.
* scm/music-functions.scm (make-voice-props-set): add
staff-position for mm rests.
* lily/spacing-spanner.cc (musical_column_spacing): shrink space
before grace notes a little.
2002-10-12 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ * input/regression/spacing-to-grace.ly: new file.
+
+ * input/regression/spacing-end-of-line.ly: new file.
+
+ * lily/note-spacing.cc (get_spacing): take into account breakable
+ stuff sticking out at the left (time sig change at line break).
+
+ * lily/spacing-spanner.cc (breakable_column_spacing): junk weird
+ raggedright code.
+
+ * scm/music-functions.scm (make-voice-props-set): add
+ staff-position for mm rests.
+
+ * lily/spacing-spanner.cc (musical_column_spacing): shrink space
+ before grace notes a little.
+
* lily/parser.yy (sup_quotes): use '\'' for sup_quotes.
* lily/break-align-interface.cc (do_alignment): right-edge spacing
--- /dev/null
+\header {
+
+ texidoc ="Broken matter at the end of line does not upset the
+ space following rests and notes." }
+
+\score
+{
+\notes \relative c' {
+ c2.. r8
+ c2.. r8
+ \time 3/4 \break
+ e2 e4 | e2 e4 \time 4/4 \break
+}
+\paper {
+ raggedright = ##t }
+}
--- /dev/null
+\header {
+
+ texidoc ="space from a normal note /barline to a grace note is
+ smaller than to a normal note."
+
+}
+
+\score {
+ \context Voice \notes
+ { \time 2/4
+ \relative c'' {
+ e8 e \grace d8 e e \grace f8 e es, d' d
+ e8 e e e \grace { \stemDown f8 \stemBoth } e es, d'
+
+ }
+
+ }
+ \paper { linewidth = -1.0 }
+ }
*space = (base_space - increment) + *fixed +
(extents[LEFT][RIGHT]
- (left_head_wid.empty_b () ? 0.0 : left_head_wid[RIGHT]))/ 2;
- ;
- if (*space - *fixed < 2 * ((- extents[RIGHT][LEFT]) >? 0))
+ if (Item::breakable_b (right_col)
+ || right_col->original_)
+ {
+ /*
+ This is for the situation
+
+ rest | 3/4 (eol)
+
+ */
+ *space += -extents[RIGHT][LEFT];
+ *fixed += -extents[RIGHT][LEFT];
+ }
+ else if (*space - *fixed < 2 * ((- extents[RIGHT][LEFT]) >? 0))
{
/*
me->get_grob_property ("right-items"));
Drul_array<Grob*> beams_drul(0,0);
- Real correction = 0.0;
stem_dirs[LEFT] = stem_dirs[RIGHT] = CENTER;
Interval intersect;
Interval bar_xextent;
Interval bar_yextent;
- bool correct = true;
+ bool correct_stem_dirs = true;
Direction d = LEFT;
bool acc_right = false;
if(Stem::invisible_b (stem))
{
- return ;
+ correct_stem_dirs = false;
+ continue;
}
beams_drul[d] = Stem::get_beam (stem);
Direction sd = Stem::get_direction (stem);
if (stem_dirs[d] && stem_dirs[d] != sd)
{
- return ;
+ correct_stem_dirs = false;
+ continue;
}
stem_dirs[d] = sd;
if (d == LEFT
&& Stem::duration_log (stem) > 2 && !Stem::get_beam (stem))
{
-
- return;
+ correct_stem_dirs = false;
}
/*
don't correct if accidentals are sticking out of the right side.
-
*/
if (acc_right)
return ;
+ Real correction = 0.0;
+
if (!bar_yextent.empty_b())
{
stem_dirs[RIGHT] = - stem_dirs[LEFT];
stem_posns[RIGHT] = bar_yextent;
}
- if (correct &&stem_dirs[LEFT] *stem_dirs[RIGHT] == -1)
+ if (correct_stem_dirs && stem_dirs[LEFT] *stem_dirs[RIGHT] == -1)
{
if (beams_drul[LEFT] && beams_drul[LEFT] == beams_drul[RIGHT])
{
{
intersect = stem_posns[LEFT];
intersect.intersect(stem_posns[RIGHT]);
- correct = correct && !intersect.empty_b ();
+ correct_stem_dirs = correct_stem_dirs && !intersect.empty_b ();
- if (!correct)
- return;
-
- correction = abs (intersect.length ());
+ if (correct_stem_dirs)
+ {
+ correction =abs (intersect.length ());
- /*
- Ugh. 7 is hardcoded.
- */
- correction = (correction/7) <? 1.0;
- correction *= stem_dirs[LEFT] ;
- correction *= gh_scm2double (me->get_grob_property ("stem-spacing-correction"));
-
+ /*
+ Ugh. 7 is hardcoded.
+ */
+ correction = (correction/7) <? 1.0;
+ correction *= stem_dirs[LEFT] ;
+ correction *=
+ gh_scm2double (me->get_grob_property ("stem-spacing-correction"));
+ }
+
if (!bar_yextent.empty_b())
{
correction *= 0.5;
}
}
}
- else if (correct && stem_dirs[LEFT] *stem_dirs[RIGHT] == UP)
+ else if (correct_stem_dirs && stem_dirs[LEFT] *stem_dirs[RIGHT] == UP)
{
/*
Correct for the following situation:
correction= -lowest * corr ;
}
- if (!bar_xextent.empty_b())
- correction += - bar_xextent[LEFT];
-
*space += correction;
+
+#if 0
+ /* there used to be a correction for bar_xextent() here, but
+ it's unclear what that was good for ?
+ */
+#endif
+
}
}
}
+ if (Paper_column::when_mom (rc).grace_part_ &&
+ !Paper_column::when_mom (lc).grace_part_)
+ {
+ /*
+ Ugh. 0.8 is arbitrary.
+ */
+ max_note_space *= 0.8;
+ }
+
if (max_note_space < 0)
{
max_note_space = base_note_space;
Maybe it should be continuous?
*/
max_fixed_note_space = max_fixed_note_space <? max_note_space;
+
+
#if 0
/*
This doesn't make sense. For ragged right we want to have the same
assert (spacing_grob-> get_column () == l);
Staff_spacing::get_spacing_params (spacing_grob,
- &space, &fixed_space);
+ &space, &fixed_space);
+
+ if (Paper_column::when_mom (r).grace_part_)
+ {
+ /*
+ Correct for grace notes.
+
+ Ugh. The 0.8 is arbitrary.
+ */
+ space *= 0.8;
+ }
if (space > max_space)
{
max_space = space;
Hmm. we do 1/0 in the next thing. Perhaps we should check if this
works on all architectures.
*/
-
- bool ragged = to_boolean (me->get_paper ()->get_scmvar ("raggedright"));
- Real strength = (ragged) ? 1.0 : 1 / (max_space - max_fixed);
- Real distance = (ragged) ? max_fixed : max_space;
+
+ /*
+ There used to be code that changed spacing depending on
+ raggedright setting. Ugh.
+
+ Do it more cleanly, or rename the property.
+
+ */
+ Real strength = 1 / (max_space - max_fixed);
+ Real distance = max_space;
Spaceable_grob::add_spring (l, r, distance, strength, false);
}
ADD_INTERFACE (Spacing_spanner,"spacing-spanner-interface",
- "
-The space taken by a note is dependent on its duration. Doubling a
-duration adds spacing-increment to the space. The most common shortest
-note gets shortest-duration-space. Notes that are even shorter are
-spaced proportonial to their duration.
-
-Typically, the increment is the width of a black note head. In a
-piece with lots of 8th notes, and some 16th notes, the eighth note
-gets 2 note heads width (i.e. the space following a note is 1 note
-head width) A 16th note is followed by 0.5 note head width. The
-quarter note is followed by 3 NHW, the half by 4 NHW, etc.
-",
+"The space taken by a note is dependent on its duration. Doubling a\n"
+"duration adds spacing-increment to the space. The most common shortest\n"
+"note gets shortest-duration-space. Notes that are even shorter are\n"
+"spaced proportonial to their duration.\n"
+"\n"
+"Typically, the increment is the width of a black note head. In a\n"
+"piece with lots of 8th notes, and some 16th notes, the eighth note\n"
+"gets 2 note heads width (i.e. the space following a note is 1 note\n"
+"head width) A 16th note is followed by 0.5 note head width. The\n"
+"quarter note is followed by 3 NHW, the half by 4 NHW, etc.\n",
"grace-space-factor spacing-increment base-shortest-duration shortest-duration-space common-shortest-duration");
{
Interval bar_size = bar_y_positions (last_grob);
Real max_corr =0.0;
+
for (SCM s = me->get_grob_property ("right-items");
gh_pair_p (s); s = gh_cdr (s))
{
Grob * g = unsmob_grob (gh_car (s));
+
max_corr = max_corr >? next_note_correction (me, g, bar_size);
for (SCM t = g->get_grob_property ("elements");
gh_pair_p (t); t = gh_cdr (t))
max_corr = max_corr >? next_note_correction (me, unsmob_grob (gh_car (t)), bar_size);
}
+
return max_corr;
}
*/
Grob*
Staff_spacing::extremal_break_aligned_grob (Grob *separation_item, Direction d,
- Interval * last_ext)
+ Interval * last_ext)
{
- Grob *left_col = dynamic_cast<Item*> (separation_item)->get_column ();
+ Grob *col = dynamic_cast<Item*> (separation_item)->get_column ();
last_ext->set_empty ();
Grob *last_grob = 0;
for (SCM s = separation_item->get_grob_property ("elements");
if (!gh_symbol_p (break_item->get_grob_property ("break-align-symbol")))
continue;
- Interval ext = break_item->extent (left_col, X_AXIS);
+ Interval ext = break_item->extent (col, X_AXIS);
if (ext.empty_b ())
continue;
if (gh_pair_p (nndef ))
space_def = nndef;
}
-
+
+
if (!gh_pair_p (space_def))
{
programming_error ("Unknown prefatory spacing. ");
else if (type == ly_symbol2scm("minimum-space"))
*space = last_ext[LEFT] + (last_ext.length () >? distance);
-
*space += next_notes_correction (me, last_grob);
}
\property Voice.Stem \override #'no-stem-extend = ##t
\property Voice.Stem \override #'stroke-style = #"grace"
\property Voice.Beam \override #'thickness = #0.384
-
+
%% Instead of calling Beam::space_function, we should invoke
%% the previously active beam function...
\property Voice.Beam \override #'space-function =
(map (lambda (x) (make-grob-property-set x 'direction
(if (odd? n) -1 1)))
'(Tie Slur Stem Dots))
- (list (make-grob-property-set 'NoteColumn 'horizontal-shift (quotient n 2)))
+ (list
+ (make-grob-property-set 'NoteColumn 'horizontal-shift (quotient n 2))
+ (make-grob-property-set 'MultiMeasureRest 'staff-position
+ (if (odd? n) -4 4)
+ )
+
+ )
)
))