From: Han-Wen Nienhuys Date: Fri, 13 Jun 2003 23:12:42 +0000 (+0000) Subject: * input/regression/stem-shorten.ly: new file. X-Git-Tag: release/1.7.21~1 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=e6a3fa987e9672780e003fac6655bf5d9f43acc6;p=lilypond.git * input/regression/stem-shorten.ly: new file. * lily/stem.cc (get_default_stem_end_position): revise stem shortening code. --- diff --git a/ChangeLog b/ChangeLog index 5b570f1450..922c44fdd2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2003-06-14 Han-Wen Nienhuys + * input/regression/stem-shorten.ly: new file. + + * lily/stem.cc (get_default_stem_end_position): revise stem + shortening code. + * input/regression/spacing-multi-tuplet.ly: move from input/test/ * input/test/{scripts,volta-start,sleur}.ly: remove diff --git a/input/regression/stem-shorten.ly b/input/regression/stem-shorten.ly new file mode 100644 index 0000000000..31554a6c7f --- /dev/null +++ b/input/regression/stem-shorten.ly @@ -0,0 +1,15 @@ +\version "1.7.18" + +\header { + + texidoc = "Stems in forced directions (as well as the ones + starting from the middle line) are shortened" + +} + +\score { + \notes \relative c'' { \stemDown d c b a g f e + \stemUp a b c d e f g a + } + \paper {raggedright = ##t } +} diff --git a/lily/stem.cc b/lily/stem.cc index 7a63f20b7c..51c2c58530 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -289,32 +289,32 @@ Stem::get_default_stem_end_position (Grob*me) SCM s; Array a; - Real length_f = 3.5; + Real length = 3.5; SCM scm_len = me->get_grob_property ("length"); if (gh_number_p (scm_len)) { - length_f = gh_scm2double (scm_len); + length = gh_scm2double (scm_len); } else { s = me->get_grob_property ("lengths"); if (gh_pair_p (s)) { - length_f = 2* gh_scm2double (robust_list_ref (duration_log(me) -2, s)); + length = 2* gh_scm2double (robust_list_ref (duration_log(me) -2, s)); } } - Real shorten_f = 0.0; + Real shorten = 0.0; SCM sshorten = me->get_grob_property ("stem-shorten"); - if (gh_pair_p (sshorten)) + SCM scm_shorten = gh_pair_p (sshorten) ? + robust_list_ref ((duration_log (me) - 2) >? 0, sshorten): SCM_EOL; + if (gh_number_p (scm_shorten)) { - shorten_f = 2* gh_scm2double (robust_list_ref ((duration_log (me) - 2) >? 0, sshorten)); + shorten = 2* gh_scm2double (scm_shorten); } - /* On boundary: shorten only half */ - if (abs (chord_start_y (me)) == 0.5) - shorten_f *= 0.5; + /* URGURGURG 'set-default-stemlen' sets direction too @@ -325,16 +325,19 @@ Stem::get_default_stem_end_position (Grob*me) dir = get_default_dir (me); Directional_element_interface::set (me, dir); } + + /* On boundary: shorten only half */ + if (abs (head_positions (me)[get_direction (me)]) <= 1) + shorten *= 0.5; /* stems in unnatural (forced) direction should be shortened, according to [Roush & Gourlay] */ - if (chord_start_y (me) - && (get_direction (me) != get_default_dir (me))) - length_f -= shorten_f; + if (!chord_start_y (me) + || (get_direction (me) != get_default_dir (me))) + length -= shorten; Interval hp = head_positions (me); - Real st = hp[dir] + dir * length_f; - + Real st = hp[dir] + dir * length; /* TODO: change name to extend-stems to staff/center/'() @@ -417,11 +420,9 @@ Stem::position_noteheads (Grob*me) heads.reverse (); - bool invisible = invisible_b (me); Real thick = gh_scm2double (me->get_grob_property ("thickness")) * me->get_paper ()->get_var ("linethickness"); - Grob *hed = support_head (me); Real w = Note_head::head_extent (hed,X_AXIS)[dir]; for (int i=0; i < heads.size (); i++) @@ -430,7 +431,7 @@ Stem::position_noteheads (Grob*me) X_AXIS); } - bool parity= true; // todo: make me settable. + bool parity= true; int lastpos = int (Staff_symbol_referencer::get_position (heads[0])); for (int i=1; i < heads.size (); i ++) { @@ -910,7 +911,6 @@ Stem::calc_stem_info (Grob *me) if (gh_number_p (shorten)) ideal_y -= gh_scm2double (shorten); - Real minimum_free = gh_scm2double (robust_list_ref (beam_count - 1, diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index 8e0687d00f..a6fdceef56 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -102,6 +102,7 @@ In the case of alignment grobs, this should contain only one number.") (grob-property-description 'beamed-lengths list? "list of stem lengths given beam multiplicity .") (grob-property-description 'beamed-minimum-free-lengths list? "list of normal minimum free stem lengths (chord to beams) given beam multiplicity.") (grob-property-description 'beamed-extreme-minimum-free-lengths list? "list of extreme minimum free stem lengths (chord to beams) given beam multiplicity.") + (grob-property-description 'beamed-stem-shorten list? "shorten beamed stems in forced direction.") (grob-property-description 'beaming pair? "Pair of number lists. Each number list