On Tue, 28 Mar 2006 03:43, Werner LEMBERG wrote: > > It seems this issue doesn't bother anyone else? In any case, now > > that 2.8 is out there, I thought I'd start pushing this point again. > > I attach a patch that gives the behaviour that I think is correct. > > I also attach 2 examples of the differences between the existing and > > the proposed behaviours. > > Hmm, the Tchaikovsky solution is still incorrect -- some stems are too > short, causing a collision with the note heads... It's a different > bug, but it would be nice if it could be solved at the same time. I've tweaked it by adding a little more to the minimum length of the stem. The Franck output is unchanged, I've attached the new Tchaikovsky output.
Oh, and I remembered a ChangeLog entry this time :) > > > Werner > > > _______________________________________________ > lilypond-devel mailing list > [email protected] > http://lists.gnu.org/mailman/listinfo/lilypond-devel
Index: ChangeLog
===================================================================
RCS file: /sources/lilypond/lilypond/ChangeLog,v
retrieving revision 1.4802
diff -u -r1.4802 ChangeLog
--- ChangeLog 24 Mar 2006 21:33:35 -0000 1.4802
+++ ChangeLog 28 Mar 2006 06:44:59 -0000
@@ -1,3 +1,13 @@
+2006-03-28 Joe Neeman <[EMAIL PROTECTED]>
+
+ * lily/stem-tremolo.cc (raw_stencil): position
+ the tremolo depending only on the end of the stem
+ and not on the notehead
+ (print) idem
+
+ * lily/stem.cc (calc_stem_info): make sure the stem
+ is long enough to fit the tremolo
+
2006-03-24 Graham Percival <[EMAIL PROTECTED]>
* Documentation/topdocs/NEWS.tely: add @end itemize
Index: lily/stem.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/stem.cc,v
retrieving revision 1.304
diff -u -r1.304 stem.cc
--- lily/stem.cc 2 Mar 2006 10:50:40 -0000 1.304
+++ lily/stem.cc 28 Mar 2006 06:44:59 -0000
@@ -798,7 +798,6 @@
return si;
}
-/* TODO: add extra space for tremolos! */
MAKE_SCHEME_CALLBACK(Stem, calc_stem_info, 1);
SCM
Stem::calc_stem_info (SCM smob)
@@ -847,6 +846,13 @@
* staff_space
* length_fraction;
+ Real height_of_my_trem = 0.0;
+ Grob *trem = unsmob_grob (me->get_object ("tremolo-flag"));
+ if (trem)
+ height_of_my_trem = ly_scm2interval (trem->get_property ("Y-extent")).length ()
+ /* hack a bit of space around the trem. */
+ + beam_translation;
+
/* UGH
It seems that also for ideal minimum length, we must use
the maximum beam count (for this direction):
@@ -859,6 +865,7 @@
Real ideal_minimum_length = ideal_minimum_free
+ height_of_my_beams
+ + height_of_my_trem
/* stem only extends to center of beam */
- 0.5 * beam_thickness;
@@ -908,18 +915,11 @@
* staff_space
* length_fraction;
- Real minimum_length = minimum_free
+ Real minimum_length = max (minimum_free, height_of_my_trem)
+ height_of_my_beams
/* stem only extends to center of beam */
- 0.5 * beam_thickness;
- if (Grob *tremolo = unsmob_grob (me->get_object ("tremolo-flag")))
- {
- Interval y_ext = tremolo->extent (tremolo, Y_AXIS);
- y_ext.widen (0.5); // FIXME. Should be tunable?
- minimum_length = max (minimum_length, y_ext.length ());
- }
-
ideal_y *= my_dir;
Real minimum_y = note_start + minimum_length;
Real shortest_y = minimum_y * my_dir;
Index: lily/stem-tremolo.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/stem-tremolo.cc,v
retrieving revision 1.99
diff -u -r1.99 stem-tremolo.cc
--- lily/stem-tremolo.cc 10 Feb 2006 01:05:05 -0000 1.99
+++ lily/stem-tremolo.cc 28 Mar 2006 06:44:59 -0000
@@ -82,7 +82,8 @@
thick *= ss;
Stencil a (Lookup::beam (slope, width, thick, blot));
- a.translate (Offset (-width * 0.5, width * 0.5 * slope));
+ Interval a_ext = a.extent (Y_AXIS);
+ a.translate (Offset (-width * 0.5, a_ext.length () / 2 - a_ext[UP]));
int tremolo_flags = robust_scm2int (me->get_property ("flag-count"), 0);
if (!tremolo_flags)
@@ -147,6 +148,7 @@
Stencil mol = raw_stencil (me, robust_scm2double (me->get_property ("slope"),
0.25));
+
Interval mol_ext = mol.extent (Y_AXIS);
Real ss = Staff_symbol_referencer::staff_space (me);
@@ -160,29 +162,18 @@
Real end_y
= Stem::stem_end_position (stem) * ss / 2
- - stemdir * (beam_count * beamthickness
- + (max (beam_count -1, 0) * beam_translation));
-
- /* FIXME: the 0.33 ss is to compensate for the size of the note head. */
- Real chord_start_y = Stem::chord_start_y (stem) + 0.33 * ss * stemdir;
-
- Real padding = beam_translation;
+ - stemdir * max (beam_count, 1) * beam_translation;
- /* if there is a flag, just above/below the notehead.
- if there is not enough space, center on remaining space,
- else one beamspace away from stem end. */
- if (!beam && Stem::duration_log (stem) >= 3)
+ /* the bottom flag is now centred on the middle of the staff. Centre the
+ closest flag to the beam instead. (Move this to raw_stencil?)*/
+ if (stemdir == UP)
{
- mol.align_to (Y_AXIS, -stemdir);
- mol.translate_axis (chord_start_y + 0.5 * stemdir, Y_AXIS);
+ Real down_off = mol_ext.length () / 2 + mol_ext[DOWN];
+ mol.translate_axis (-down_off * 2, Y_AXIS);
}
- else if (stemdir * (end_y - chord_start_y) - 2 * padding - mol_ext.length ()
- < 0.0)
- mol.translate_axis (0.5 * (end_y + chord_start_y) - mol_ext.center (),
- Y_AXIS);
- else
- mol.translate_axis (end_y - stemdir * beam_translation -mol_ext [stemdir],
- Y_AXIS);
+ if (!beam && Stem::duration_log (stem) >= 3)
+ end_y -= (stemdir * (Stem::duration_log (stem) - 2)) * beam_translation;
+ mol.translate_axis (end_y, Y_AXIS);
return mol.smobbed_copy ();
}
<<attachment: tchaik_try2.jpeg>>
_______________________________________________ lilypond-devel mailing list [email protected] http://lists.gnu.org/mailman/listinfo/lilypond-devel
