From: Han-Wen Nienhuys Date: Sat, 11 Sep 2004 12:35:20 +0000 (+0000) Subject: * lily/translator.cc (derived_mark): new function. X-Git-Tag: release/2.3.16~5 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=ca4a47ffd343a3672c0e13b801eeb2647866ce98;p=lilypond.git * lily/translator.cc (derived_mark): new function. * lily/slur-scoring.cc (score_encompass): new penalty type: variance penalty demerits slurs where one head/stem is much closer to the slur than average. * lily/tuplet-bracket.cc (print): use robust_relative_extent iso. extent() (calc_position_and_height): use robust_relative_extent(). This fixes a couple of programming_errors --- diff --git a/ChangeLog b/ChangeLog index 03330de6f3..4e514dc084 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2004-09-11 Han-Wen Nienhuys + * lily/*-engraver.cc: remove all Protected_scm objects to fix GC + errors with GUILE 1.7 CVS. + + * lily/translator.cc (derived_mark): new function. + + * lily/slur-scoring.cc (score_encompass): new penalty type: + variance penalty demerits slurs where one head/stem is much + closer to the slur than average. + + * lily/tuplet-bracket.cc (print): use robust_relative_extent + iso. extent() + (calc_position_and_height): use robust_relative_extent(). This + fixes a couple of programming_errors + * input/regression/part-combine-mmrest-after-solo.ly (Module): new file. diff --git a/input/regression/new-slur.ly b/input/regression/new-slur.ly index 0b3d93cf42..8b62ec99c4 100644 --- a/input/regression/new-slur.ly +++ b/input/regression/new-slur.ly @@ -6,6 +6,7 @@ \version "2.3.7" \paper { raggedright = ##t +% #(define debug-slur-scoring #t) } %% help lilypond-book @@ -53,6 +54,12 @@ e4( dis4) e4( dis4) g='16( b d fis) - \clef bass a=8[ e16(f] g[ a bes d,)] | + \clef bass a=8[ e16(f] g[ a bes d,)] s4 | \break + + \clef treble + \relative c'' { + \slurDown f2( d4 f | g c a f | d c f2 | f1) | + } + } diff --git a/lily/accidental-engraver.cc b/lily/accidental-engraver.cc index d74ac87635..d4bfad593d 100644 --- a/lily/accidental-engraver.cc +++ b/lily/accidental-engraver.cc @@ -60,8 +60,9 @@ protected: virtual void process_acknowledged_grobs (); virtual void finalize (); + virtual void derived_mark () const; public: - Protected_scm last_keysig_; // ugh. + SCM last_keysig_; // ugh. /* Urgh. Since the accidentals depend on lots of variables, we have to store all information before we can really create the @@ -102,6 +103,12 @@ Accidental_engraver::Accidental_engraver () last_keysig_ = SCM_EOL; } +void +Accidental_engraver::derived_mark () const +{ + scm_gc_mark (last_keysig_); +} + void Accidental_engraver::update_local_key_signature () { diff --git a/lily/ambitus-engraver.cc b/lily/ambitus-engraver.cc index f50b651050..5946495413 100644 --- a/lily/ambitus-engraver.cc +++ b/lily/ambitus-engraver.cc @@ -28,6 +28,7 @@ TRANSLATOR_DECLARATIONS (Ambitus_engraver); virtual void acknowledge_grob (Grob_info); virtual void stop_translation_timestep (); virtual void finalize (); + virtual void derived_mark () const; private: void create_ambitus (); @@ -38,9 +39,15 @@ private: Pitch_interval pitch_interval_; bool is_typeset_; int start_c0_; - Protected_scm start_key_sig_; + SCM start_key_sig_; }; +void +Ambitus_engraver::derived_mark () const +{ + scm_gc_mark (start_key_sig_); +} + void Ambitus_engraver::create_ambitus () { @@ -72,6 +79,7 @@ Ambitus_engraver::Ambitus_engraver () accidentals_[LEFT] = accidentals_[RIGHT] = 0; group_ = 0; is_typeset_ = false; + start_key_sig_ = SCM_EOL; } void diff --git a/lily/break-align-engraver.cc b/lily/break-align-engraver.cc index da8a22e0af..a18647b0da 100644 --- a/lily/break-align-engraver.cc +++ b/lily/break-align-engraver.cc @@ -18,14 +18,14 @@ class Break_align_engraver : public Engraver { Item *align_; - Protected_scm column_alist_; +SCM column_alist_; Item *left_edge_; void add_to_group (SCM,Item*); protected: - virtual void finalize (); virtual void acknowledge_grob (Grob_info i); virtual void stop_translation_timestep (); + virtual void derived_mark () const; void add_column (SCM); public: @@ -40,12 +40,6 @@ Break_align_engraver::add_column (SCM smob) } -void -Break_align_engraver::finalize () -{ - column_alist_ = SCM_EOL; -} - void Break_align_engraver::stop_translation_timestep () { @@ -68,6 +62,12 @@ Break_align_engraver::Break_align_engraver () align_ = 0; } +void +Break_align_engraver::derived_mark () const +{ + scm_gc_mark (column_alist_); +} + void Break_align_engraver::acknowledge_grob (Grob_info inf) { diff --git a/lily/chord-name-engraver.cc b/lily/chord-name-engraver.cc index a5603207c5..0291aef631 100644 --- a/lily/chord-name-engraver.cc +++ b/lily/chord-name-engraver.cc @@ -27,19 +27,27 @@ protected: virtual void process_music (); virtual bool try_music (Music *); virtual void finalize (); + virtual void derived_mark () const; private: void add_note (Music *); Item* chord_name_; Link_array notes_; - Protected_scm last_chord_; + SCM last_chord_; }; + + void Chord_name_engraver::finalize () { - last_chord_ = SCM_EOL; +} + +void +Chord_name_engraver::derived_mark() const +{ + scm_gc_mark (last_chord_); } Chord_name_engraver::Chord_name_engraver () diff --git a/lily/context-def.cc b/lily/context-def.cc index a438341286..e2a0b8c50a 100644 --- a/lily/context-def.cc +++ b/lily/context-def.cc @@ -273,8 +273,9 @@ Context_def::instantiate (SCM ops) SCM trans_names = get_translator_names (ops); - Translator *g = get_translator (translator_group_type_); - g = g->clone (); + Translator_group *g = dynamic_cast + (get_translator (translator_group_type_)); + g = dynamic_cast (g->clone ()); SCM trans_list = SCM_EOL; diff --git a/lily/include/book-paper-def.hh b/lily/include/book-paper-def.hh index 9ae39edb6e..f807347bb6 100644 --- a/lily/include/book-paper-def.hh +++ b/lily/include/book-paper-def.hh @@ -12,6 +12,8 @@ #include "lily-proto.hh" #include "output-def.hh" +#error + class Output_def : public Output_def { public: diff --git a/lily/include/chord-name.hh b/lily/include/chord-name.hh index a775a2b79a..147722ade0 100644 --- a/lily/include/chord-name.hh +++ b/lily/include/chord-name.hh @@ -17,7 +17,7 @@ class Chord_name { public: DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM )); - static bool has_interface (Grob*); + static bool has_interface (Grob*); }; #endif // CHORD_NAME_HH diff --git a/lily/include/music-iterator.hh b/lily/include/music-iterator.hh index 2dad3c9b2b..8d10fe5bf7 100644 --- a/lily/include/music-iterator.hh +++ b/lily/include/music-iterator.hh @@ -91,7 +91,7 @@ public: virtual bool run_always () const; virtual void process (Moment until); - virtual void derived_mark ()const; + virtual void derived_mark () const; virtual void construct_children (); /** diff --git a/lily/include/output-def.hh b/lily/include/output-def.hh index 4b2bf9c3e4..0f60d9b557 100644 --- a/lily/include/output-def.hh +++ b/lily/include/output-def.hh @@ -49,7 +49,6 @@ public: Output_def (Output_def const&); Output_def (); - virtual void derived_mark (); /* variables. diff --git a/lily/include/translator-group.hh b/lily/include/translator-group.hh index cb8f00570f..17a6163659 100644 --- a/lily/include/translator-group.hh +++ b/lily/include/translator-group.hh @@ -27,8 +27,13 @@ public: virtual SCM get_simple_trans_list (); virtual bool try_music (Music* req); virtual void initialize (); -}; + Translator_group (); +protected: + SCM simple_trans_list_; + friend class Context_def; + virtual void derived_mark () const; +}; SCM names_to_translators (SCM namelist, Context*tg); void recurse_over_translators (Context * c, Translator_method ptr, Direction); diff --git a/lily/include/translator.hh b/lily/include/translator.hh index 4b40032ba8..3babb758c9 100644 --- a/lily/include/translator.hh +++ b/lily/include/translator.hh @@ -69,7 +69,8 @@ public: DECLARE_SMOBS (Translator, dummy); protected: // should be private. Context * daddy_context_ ; - SCM simple_trans_list_; + virtual void derived_mark () const; + friend class Context_def; friend class Context; }; diff --git a/lily/ottava-engraver.cc b/lily/ottava-engraver.cc index 99fbe7e3c6..e7778a8d4c 100644 --- a/lily/ottava-engraver.cc +++ b/lily/ottava-engraver.cc @@ -21,15 +21,21 @@ protected: virtual void acknowledge_grob (Grob_info); virtual void process_music (); virtual void stop_translation_timestep (); + virtual void derived_mark () const; private: Spanner *span_; Spanner *finished_; - Protected_scm last_ottavation_; + SCM last_ottavation_; void typeset_all (); }; +void +Ottava_spanner_engraver::derived_mark () const +{ + scm_gc_mark (last_ottavation_ ); +} Ottava_spanner_engraver::Ottava_spanner_engraver () { diff --git a/lily/output-def.cc b/lily/output-def.cc index 4a1e496363..21139546c9 100644 --- a/lily/output-def.cc +++ b/lily/output-def.cc @@ -57,15 +57,9 @@ Output_def::mark_smob (SCM m) if (mo->parent_) scm_gc_mark (mo->parent_->self_scm ()); - mo->derived_mark (); return mo->scope_; } -void -Output_def::derived_mark () -{ -} - void assign_context_def (Output_def * m, SCM transdef) { diff --git a/lily/quote-iterator.cc b/lily/quote-iterator.cc index 8b101eb6e8..718b0278f3 100644 --- a/lily/quote-iterator.cc +++ b/lily/quote-iterator.cc @@ -33,7 +33,7 @@ public: bool accept_music_type (Music*) const; protected: - virtual void derived_mark (); + virtual void derived_mark () const; virtual void construct_children (); virtual Moment pending_moment () const; virtual void process (Moment); @@ -56,7 +56,7 @@ Quote_iterator::accept_music_type (Music *mus) const void -Quote_iterator::derived_mark () +Quote_iterator::derived_mark () const { scm_gc_mark (transposed_musics_ ); } @@ -187,6 +187,8 @@ Quote_iterator::process (Moment m) SCM copy = ly_deep_mus_copy (mus->self_scm ()); mus = unsmob_music (copy); transposed_musics_ = scm_cons (copy, transposed_musics_); + scm_gc_unprotect_object (copy); + mus->transpose (diff); } diff --git a/lily/recording-group-engraver.cc b/lily/recording-group-engraver.cc index 41e96ee5e9..1852b26372 100644 --- a/lily/recording-group-engraver.cc +++ b/lily/recording-group-engraver.cc @@ -21,9 +21,17 @@ public: virtual void stop_translation_timestep (); virtual void finalize (); virtual void initialize (); - Protected_scm accumulator_; + virtual void derived_mark () const; + SCM accumulator_; }; +void +Recording_group_engraver::derived_mark () const +{ + Engraver_group_engraver::derived_mark(); + scm_gc_mark (accumulator_); +} + void Recording_group_engraver::initialize () { @@ -33,6 +41,7 @@ Recording_group_engraver::initialize () Recording_group_engraver::Recording_group_engraver () { + accumulator_ = SCM_EOL; } void diff --git a/lily/slur-scoring.cc b/lily/slur-scoring.cc index 0d7852950f..1d6dccb0bd 100644 --- a/lily/slur-scoring.cc +++ b/lily/slur-scoring.cc @@ -44,11 +44,6 @@ struct Slur_score } }; -/* - TODO: put in details property., - - use lowercase. -*/ struct Slur_score_parameters { int region_size_; @@ -63,8 +58,15 @@ struct Slur_score_parameters Real max_slope_factor_; Real extra_object_collision_; Real accidental_collision_; + Real free_head_distance_; Real extra_encompass_free_distance_; + + Real head_slur_distance_max_ratio_; + Real head_slur_distance_factor_; + + + Slur_score_parameters (Grob*); }; @@ -74,8 +76,6 @@ struct Slur_score_parameters - curve around flag for y coordinate - better scoring. - short-cut: try a smaller region first. - - collisions with accidentals - - collisions with articulations (staccato, portato, sforzato, ...) - handle non-visible stems better. */ struct Encompass_info @@ -89,6 +89,13 @@ struct Encompass_info stem_ = 0.0; head_ = 0.0; } + Real get_point (Direction dir) + { + Interval y; + y.add_point (stem_); + y.add_point (head_); + return y[dir]; + } }; struct Bound_info @@ -222,6 +229,10 @@ init_score_param (Grob *me, = get_detail (details, ly_symbol2scm ("accidental-collision")); score_param->extra_encompass_free_distance_ = get_detail (details, ly_symbol2scm ("extra-encompass-free-distance")); + score_param->head_slur_distance_factor_ + = get_detail (details, ly_symbol2scm ("head-slur-distance-factor")); + score_param->head_slur_distance_max_ratio_ + = get_detail (details, ly_symbol2scm ("head-slur-distance-max-ratio")); } @@ -425,9 +436,6 @@ get_bound_info (Spanner* me, Grob **common) void set_end_points (Grob *me) { - - - Link_array columns = Pointer_group_interface__extract_grobs (me, (Grob *) 0, "note-columns"); @@ -486,7 +494,7 @@ set_end_points (Grob *me) #if DEBUG_SLUR_QUANTING SCM inspect_quants = me->get_property ("inspect-quants"); if (to_boolean (me->get_paper () - ->lookup_variable (ly_symbol2scm ("debug-slur-quanting"))) + ->lookup_variable (ly_symbol2scm ("debug-slur-scoring"))) && ly_c_pair_p (inspect_quants)) { Drul_array ins = ly_scm2interval (inspect_quants); @@ -654,11 +662,12 @@ generate_curves (Grob *me, Grob **common, Real h_inf = staff_space * scm_to_double (me->get_property ("height-limit")); for (int i = 0; i < scores->size(); i++) { - Bezier bez= get_bezier (me, + Bezier bez = get_bezier (me, common, score_param, extremes, (*scores)[i].attachment_, r_0, h_inf); + bez = avoid_staff_line (me, common, extremes, bez); (*scores)[i].attachment_[LEFT] = bez.control_[0]; (*scores)[i].attachment_[RIGHT] = bez.control_[3]; @@ -704,13 +713,9 @@ avoid_staff_line (Grob *me, Grob **common, * 5 * thick; Real dy = (newp - p) * staff_space / 2.0; -#if 0 - bez.translate (Offset (0, dy)); -#else + bez.control_[1][Y_AXIS] += dy; bez.control_[2][Y_AXIS] += dy; - -#endif } } return bez; @@ -812,6 +817,14 @@ enumerate_attachments (Grob *me, Grob *common[], return scores; } +inline Real +linear_interpolate (Real x, Real x1, Real x2, Real y1, Real y2) +{ + return (x2 - x) / (x2 - x1) * y1 + + (x - x1) / (x2 - x1) * y2 ; +} + + void score_encompass (Grob *me, Grob *common[], Slur_score_parameters *score_param, @@ -833,8 +846,16 @@ score_encompass (Grob *me, Grob *common[], for (int i = 0; i < scores->size (); i++) { - Bezier const &bez (scores->elem (i).curve_); + Slur_score &configuration = scores->elem_ref (i); + Bezier const &bez (configuration.curve_); Real demerit = 0.0; + + /* + Distances for heads that are between slur and line between + attachment points. + */ + Array convex_head_distances; + Array edge_distances; for (int j = 0; j < infos.size(); j++) { Real x = infos[j].x_; @@ -843,8 +864,16 @@ score_encompass (Grob *me, Grob *common[], bool r_edge = j==infos.size()-1; bool edge = l_edge || r_edge; - if (!(x < scores->elem (i).attachment_[RIGHT][X_AXIS] - && x > scores->elem (i).attachment_[LEFT][X_AXIS])) + + if (edge) + { + edge_distances.push (fabs (configuration.attachment_[l_edge ? LEFT : RIGHT][Y_AXIS] + - infos[j].get_point (dir))); + } + + + if (!(x < configuration.attachment_[RIGHT][X_AXIS] + && x > configuration.attachment_[LEFT][X_AXIS])) continue; Real y = bez.get_other_coordinate (X_AXIS, x); @@ -852,7 +881,10 @@ score_encompass (Grob *me, Grob *common[], { Real head_dy = (y - infos[j].head_); if (dir * head_dy < 0) - demerit += score_param->head_encompass_penalty_; + { + demerit += score_param->head_encompass_penalty_; + convex_head_distances.push (0.0); + } else { Real hd = (head_dy) @@ -860,9 +892,24 @@ score_encompass (Grob *me, Grob *common[], : score_param->head_encompass_penalty_; hd = (hd >? 0)head_encompass_penalty_; - demerit += hd; + demerit += hd; } - } + + Real line_y = linear_interpolate (x, + configuration.attachment_[RIGHT][X_AXIS], + configuration.attachment_[LEFT][X_AXIS], + configuration.attachment_[RIGHT][Y_AXIS], + configuration.attachment_[LEFT][Y_AXIS]); + + if (dir * (infos[j].get_point (dir) - line_y) > 0) + { + Real d = fabs (infos[j].get_point (dir) - y); + convex_head_distances.push (d); + } + } + + + if (dir * (y - infos[j].stem_) < 0) { @@ -888,11 +935,50 @@ score_encompass (Grob *me, Grob *common[], } } + Real variance_penalty = 0.0; + + if (convex_head_distances.size()) + { + Real avg_distance = 0.0; + Real min_dist = infinity_f; + for (int j = 0; j < convex_head_distances.size(); j++) + { + min_dist = min_dist head_slur_distance_max_ratio_; + if (min_dist > 0.0) + variance_penalty = ((avg_distance / (min_dist +score_param->free_head_distance_)) - 1.0) + head_slur_distance_factor_; + } #if DEBUG_SLUR_QUANTING (*scores)[i].score_card_ += to_string ("C%.2f", demerit); + (*scores)[i].score_card_ += to_string ("D%.2f", variance_penalty); #endif - (*scores)[i].score_ += demerit; + (*scores)[i].score_ += demerit + variance_penalty; } } @@ -1177,7 +1263,8 @@ get_bezier (Grob *me, Slur_score_parameters *score_param, Drul_array extremes, Drul_array attachments, - Real r_0, Real h_inf) + Real r_0, Real h_inf + ) { Link_array encompasses = Pointer_group_interface__extract_grobs (me, (Grob *)0, "note-columns"); diff --git a/lily/slur.cc b/lily/slur.cc index d8bb8401bf..725922bf61 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -81,7 +81,7 @@ Slur::print (SCM smob) SCM quant_score = me->get_property ("quant-score"); if (to_boolean (me->get_paper () - ->lookup_variable (ly_symbol2scm ("debug-slur-quanting"))) + ->lookup_variable (ly_symbol2scm ("debug-slur-scoring"))) && scm_is_string (quant_score)) { String str; diff --git a/lily/tempo-performer.cc b/lily/tempo-performer.cc index 6fad4e0ce4..53943e809f 100644 --- a/lily/tempo-performer.cc +++ b/lily/tempo-performer.cc @@ -23,7 +23,7 @@ protected: virtual void create_audio_elements (); private: -Music* tempo_req_; + Music* tempo_req_; Audio_tempo* audio_; }; diff --git a/lily/tie-engraver.cc b/lily/tie-engraver.cc index 7d2b83d82c..1aecbe526c 100644 --- a/lily/tie-engraver.cc +++ b/lily/tie-engraver.cc @@ -36,12 +36,13 @@ class Tie_engraver : public Engraver Link_array now_heads_; Link_array heads_to_tie_; Link_array ties_; - Protected_scm tie_start_definition_; + SCM tie_start_definition_; Spanner * tie_column_; protected: virtual void stop_translation_timestep (); + virtual void derived_mark () const; virtual void start_translation_timestep (); virtual void acknowledge_grob (Grob_info); virtual bool try_music (Music*); @@ -58,6 +59,13 @@ Tie_engraver::Tie_engraver () event_ = 0; last_event_ = 0; tie_column_ = 0; + tie_start_definition_ = SCM_EOL; +} + +void +Tie_engraver::derived_mark () const +{ + scm_gc_mark (tie_start_definition_); } diff --git a/lily/translator-group.cc b/lily/translator-group.cc index d7036957d7..7a75736946 100644 --- a/lily/translator-group.cc +++ b/lily/translator-group.cc @@ -134,3 +134,14 @@ recurse_over_translators (Context * c, Translator_method ptr, Direction dir) (tg->*ptr) (); } } + +Translator_group::Translator_group() +{ + simple_trans_list_ = SCM_EOL; +} + +void +Translator_group::derived_mark () const +{ + scm_gc_mark (simple_trans_list_); +} diff --git a/lily/translator-scheme.cc b/lily/translator-scheme.cc index c32b13b017..a80b4c1661 100644 --- a/lily/translator-scheme.cc +++ b/lily/translator-scheme.cc @@ -39,8 +39,6 @@ Translator::print_smob (SCM s, SCM port, scm_print_state *) Translator *me = (Translator*) ly_cdr (s); scm_puts ("#simple_trans_list_, port); - scm_puts (" >", port); return 1; } diff --git a/lily/translator.cc b/lily/translator.cc index 17c9ab38c2..a5c612a929 100644 --- a/lily/translator.cc +++ b/lily/translator.cc @@ -26,7 +26,6 @@ Translator::init () { must_be_last_ = false; self_scm_ = SCM_EOL; - simple_trans_list_ = SCM_BOOL_F; daddy_context_ =0; smobify_self (); } @@ -125,7 +124,8 @@ SCM Translator::mark_smob (SCM sm) { Translator * me = (Translator*) SCM_CELL_WORD_1 (sm); - return me->simple_trans_list_; + me->derived_mark (); + return SCM_EOL; } SCM @@ -166,3 +166,8 @@ Translator::must_be_last () const return must_be_last_; } +void +Translator::derived_mark () const +{ + +} diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc index f96551bc6f..0260b2a1ce 100644 --- a/lily/tuplet-bracket.cc +++ b/lily/tuplet-bracket.cc @@ -160,10 +160,10 @@ Tuplet_bracket::print (SCM smob) Direction dir = get_grob_direction (me); Grob * lgr = get_x_bound_grob (columns[0], dir); - Grob * rgr = get_x_bound_grob (columns.top (), dir); - Real x0 = lgr->extent (commonx,X_AXIS)[LEFT]; - Real x1 = rgr->extent (commonx,X_AXIS)[RIGHT]; - + Grob * rgr = get_x_bound_grob (columns.top (), dir); + + Real x0 = robust_relative_extent (lgr, commonx, X_AXIS)[LEFT]; + Real x1 = robust_relative_extent (rgr, commonx, X_AXIS)[RIGHT]; Real w = x1 -x0; SCM number = me->get_property ("text"); @@ -360,9 +360,8 @@ Tuplet_bracket::calc_position_and_height (Grob*me,Real *offset, Real * dy) Grob * lgr = get_x_bound_grob (columns[0], dir); Grob * rgr = get_x_bound_grob (columns.top (), dir); - Real x0 = lgr->extent (commonx,X_AXIS)[LEFT]; - Real x1 = rgr->extent (commonx,X_AXIS)[RIGHT]; - + Real x0 = robust_relative_extent (lgr, commonx, X_AXIS)[LEFT]; + Real x1 = robust_relative_extent (rgr, commonx, X_AXIS)[RIGHT]; /* Slope. @@ -478,7 +477,7 @@ Tuplet_bracket::after_line_breaking (SCM smob) /* duh. magic. -< */ + */ offset = lp + dir * (0.5 + scm_to_double (me->get_property ("padding"))); dy = rp- lp; } diff --git a/scm/page-layout.scm b/scm/page-layout.scm index 7422ca2682..296444317b 100644 --- a/scm/page-layout.scm +++ b/scm/page-layout.scm @@ -300,11 +300,14 @@ is what have collected so far, and has ascending page numbers." (entry (list idx (1+ idx) distance))) entry))) (rods (map calc-rod (iota (1- no-systems)))) - (page-very-empty (> space-left (/ page-height 3))) + (page-very-empty? (> space-left (/ page-height 3))) (result (ly:solve-spring-rod-problem springs rods space - ragged?)) - (force (car result)) + (or page-very-empty? ragged?))) + (force (car (if page-very-empty? + (ly:solve-spring-rod-problem + springs rods space ragged?) + result))) (positions (map (lambda (y) (+ y topskip)) @@ -346,7 +349,6 @@ CURRENT-BEST is the best result sofar, or #f." (and (eq? #t (ly:output-def-lookup bookpaper 'raggedlastbottom)) last?))) (page-height (page-height this-page-num last?)) - (vertical-spacing (space-systems page-height current-lines ragged?)) (satisfied-constraints (car vertical-spacing)) (force (if satisfied-constraints satisfied-constraints 10000)) diff --git a/scm/slur.scm b/scm/slur.scm index d7ec5fef84..943e6dd61e 100644 --- a/scm/slur.scm +++ b/scm/slur.scm @@ -22,4 +22,6 @@ (extra-object-collision . 50) (accidental-collision . 3) (extra-encompass-free-distance . 0.3) + (head-slur-distance-max-ratio . 3) + (head-slur-distance-factor . 10) ))