From: Han-Wen Nienhuys Date: Thu, 19 Jan 2006 22:39:13 +0000 (+0000) Subject: tie formatting X-Git-Tag: release/2.7.28~6 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=7e33691750a97e1b66192cb484f479a173390132;p=lilypond.git tie formatting --- diff --git a/ChangeLog b/ChangeLog index aff751f38b..31fa0c1a72 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,26 @@ +<<<<<<< ChangeLog +2006-01-19 Han-Wen Nienhuys + + * lily/tie-formatting-problem.cc (generate_configuration): make + large ties avoid stafflines in the horizontal section. + (score_configuration): use softcoded penalties + (score_aptitude): idem. + + * lily/tie-helper.cc (from_grob): softcode tie details + + * lily/staff-symbol-referencer.cc (on_staff_line): new function + + * lily/staff-symbol-referencer.cc (on_line): rename from + on_staffline + +======= 2006-01-18 Han-Wen Nienhuys * ly/music-functions-init.ly: remove duplicate tag. * lily/include/*.hh: GCC 4.1 fixes. +>>>>>>> 1.4455 006-01-16 Erlend Aasland * Documentation/user/global.itely: fix typos; @bugs -> @refbugs diff --git a/lily/dot-column.cc b/lily/dot-column.cc index 5ad2e0923a..630e154d95 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -128,7 +128,7 @@ shift_one (Dot_configuration const &cfg, int p = i->first; if (p == k) { - if (Staff_symbol_referencer::on_staffline (i->second.dot_, p)) + if (Staff_symbol_referencer::on_line (i->second.dot_, p)) p += d; else p += 2* d; @@ -155,7 +155,7 @@ shift_one (Dot_configuration const &cfg, int p = i->first; if (p == k) { - if (Staff_symbol_referencer::on_staffline (i->second.dot_, p)) + if (Staff_symbol_referencer::on_line (i->second.dot_, p)) p += d; else p += 2* d; @@ -254,7 +254,7 @@ Dot_column::calc_positioning_done (SCM smob) remove_collision (cfg, p); cfg[p] = dp; - if (Staff_symbol_referencer::on_staffline (dp.dot_, p)) + if (Staff_symbol_referencer::on_line (dp.dot_, p)) remove_collision (cfg, p); } diff --git a/lily/easy-notation.cc b/lily/easy-notation.cc index 90e6accd98..fde6514345 100644 --- a/lily/easy-notation.cc +++ b/lily/easy-notation.cc @@ -20,6 +20,11 @@ using namespace std; #include "staff-symbol-referencer.hh" #include "stem.hh" +/* + +TODO: move to scheme + +*/ MAKE_SCHEME_CALLBACK (Note_head, brew_ez_stencil, 1); SCM Note_head::brew_ez_stencil (SCM smob) diff --git a/lily/include/staff-symbol-referencer.hh b/lily/include/staff-symbol-referencer.hh index 0391e2a79a..5e1fd878fd 100644 --- a/lily/include/staff-symbol-referencer.hh +++ b/lily/include/staff-symbol-referencer.hh @@ -30,8 +30,10 @@ public: static Real line_thickness (Grob *); static Real staff_space (Grob *); static Grob *get_staff_symbol (Grob *); - static bool on_staffline (Grob *); - static bool on_staffline (Grob *, int); + static bool on_line (Grob *); + static bool on_line (Grob *, int); + static bool on_staff_line (Grob *, int); + static bool on_staff_line (Grob *); static int line_count (Grob *); static Real get_position (Grob *); static Real staff_radius (Grob *); diff --git a/lily/include/tie-formatting-problem.hh b/lily/include/tie-formatting-problem.hh index 5a6686ff59..3325d53380 100644 --- a/lily/include/tie-formatting-problem.hh +++ b/lily/include/tie-formatting-problem.hh @@ -26,6 +26,18 @@ struct Tie_details Real staff_space_; Real x_gap_; Real between_length_limit_; + Real wrong_direction_offset_penalty_; + Real distance_penalty_factor_; + Real length_penalty_factor_; + Real min_length_; + Real staff_line_clearance_; + Real staff_line_collision_penalty_; + Real dot_collision_clearance_; + Real dot_collision_penalty_; + Real tie_column_monotonicity_penalty_; + Real tie_tie_collision_penalty_; + Real tie_tie_collision_distance_; + Grob *staff_symbol_referencer_; Tie_details (); @@ -38,7 +50,8 @@ typedef map< pair, Tie_configuration *> Tie_configuration_map; struct Tie_specification { int position_; - + Drul_array note_head_drul_; + bool has_manual_position_; bool has_manual_dir_; @@ -71,8 +84,8 @@ class Tie_formatting_problem Tie_configuration *generate_configuration (int position, Direction dir) const; Array get_variations (Ties_configuration const &ties); - Real score_configuration (Tie_configuration const&) const; - Real score_aptitude (Tie_configuration const&, int) const; + Real score_configuration (Tie_configuration const &) const; + Real score_aptitude (Tie_configuration const &, Tie_specification const &) const; Real score_ties_aptitude (Ties_configuration const &ties) const; Real score_ties_configuration (Ties_configuration const &ties) const; void set_ties_config_standard_directions (Ties_configuration *tie_configs_ptr); @@ -86,10 +99,10 @@ public: Tie_formatting_problem (); ~Tie_formatting_problem (); - + Tie_specification get_tie_specification (int) const; Ties_configuration generate_optimal_chord_configuration (); Ties_configuration generate_ties_configuration (Ties_configuration const &); - Tie_configuration find_optimal_tie_configuration (int p, Direction d) const; + Tie_configuration find_optimal_tie_configuration (Tie_specification const &) const; void from_ties (Link_array const &ties); void from_tie (Grob *tie); void from_lv_ties (Link_array const &); diff --git a/lily/ledger-line-spanner.cc b/lily/ledger-line-spanner.cc index 5076d303e5..43bc35b695 100644 --- a/lily/ledger-line-spanner.cc +++ b/lily/ledger-line-spanner.cc @@ -59,7 +59,7 @@ Ledger_line_spanner::brew_ledger_lines (Grob *staff, = Lookup::round_filled_box (Box (x_extent, y_extent), blotdiameter); Direction dir = (Direction)sign (pos); - Real offs = (Staff_symbol_referencer::on_staffline (staff, pos)) + Real offs = (Staff_symbol_referencer::on_line (staff, pos)) ? 0.0 : -dir * halfspace; diff --git a/lily/lexer.ll b/lily/lexer.ll index 8fba3fa2a7..7189daf623 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -570,6 +570,7 @@ BOM_UTF8 \357\273\277 Real r; int cnv = sscanf (YYText (), "%lf", &r); assert (cnv == 1); + (void) cnv; yylval.scm = scm_from_double (r); return REAL; diff --git a/lily/side-position-interface.cc b/lily/side-position-interface.cc index b60af41146..9decfed405 100644 --- a/lily/side-position-interface.cc +++ b/lily/side-position-interface.cc @@ -185,7 +185,7 @@ Side_position_interface::aligned_side (Grob *me, Axis a) && sign (Staff_symbol_referencer::get_position (head)) == - dir)) { o += dir *(rounded - position) * 0.5 * ss; - if (Staff_symbol_referencer::on_staffline (me, int (rounded))) + if (Staff_symbol_referencer::on_line (me, int (rounded))) o += dir * 0.5 * ss; } } diff --git a/lily/slur-scoring.cc b/lily/slur-scoring.cc index 57fa3c6183..6005bc076b 100644 --- a/lily/slur-scoring.cc +++ b/lily/slur-scoring.cc @@ -615,7 +615,7 @@ Slur_score_state::move_away_from_staffline (Real y, * 2.0 / staff_space_; if (fabs (pos - my_round (pos)) < 0.2 - && Staff_symbol_referencer::on_staffline (on_staff, (int) rint (pos)) + && Staff_symbol_referencer::on_line (on_staff, (int) rint (pos)) && Staff_symbol_referencer::line_count (on_staff) - 1 >= rint (pos)) y += 1.5 * staff_space_ * dir_ / 10; diff --git a/lily/staff-symbol-referencer-scheme.cc b/lily/staff-symbol-referencer-scheme.cc new file mode 100644 index 0000000000..da8491e8fa --- /dev/null +++ b/lily/staff-symbol-referencer-scheme.cc @@ -0,0 +1,26 @@ +/* + staff-symbol-referencer-scheme.cc -- implement Staff_symbol_referencer bindings + + source file of the GNU LilyPond music typesetter + + (c) 1999--2006 Han-Wen Nienhuys +*/ + +#include "grob.hh" +#include "staff-symbol-referencer.hh" +#include "libc-extension.hh" + +LY_DEFINE (ly_grob_staff_position, "ly:grob-staff-position", + 1, 0, 0, (SCM sg), + "Return the Y-position of @var{sg} relative to the staff.") +{ + Grob *g = unsmob_grob (sg); + + SCM_ASSERT_TYPE (g, sg, SCM_ARG1, __FUNCTION__, "grob"); + Real pos = Staff_symbol_referencer::get_position (g); + + if (fabs (rint (pos) -pos) < 1e-6) // ugh. + return scm_from_int ((int) my_round (pos)); + else + return scm_from_double (pos); +} diff --git a/lily/staff-symbol-referencer.cc b/lily/staff-symbol-referencer.cc index 81a7b16934..367bed131d 100644 --- a/lily/staff-symbol-referencer.cc +++ b/lily/staff-symbol-referencer.cc @@ -21,22 +21,30 @@ Staff_symbol_referencer::line_count (Grob *me) } bool -Staff_symbol_referencer::on_staffline (Grob *me) +Staff_symbol_referencer::on_line (Grob *me) { - return on_staffline (me, (int) rint (get_position (me))); + return on_line (me, (int) rint (get_position (me))); +} + +bool +Staff_symbol_referencer::on_staff_line (Grob *me) +{ + return on_staff_line (me, (int) rint (get_position (me))); } -/* - This does not take size into account. - maybe rename: on_virtual_staffline, on_staff_or_ledger_line? -*/ bool -Staff_symbol_referencer::on_staffline (Grob *me, int pos) +Staff_symbol_referencer::on_line (Grob *me, int pos) { int sz = line_count (me) - 1; return ((pos + sz) % 2) == 0; } +bool +Staff_symbol_referencer::on_staff_line (Grob *me, int pos) +{ + return on_line (me, pos) && fabs (pos) <= 2 * staff_radius (me); +} + Grob * Staff_symbol_referencer::get_staff_symbol (Grob *me) { @@ -90,21 +98,6 @@ Staff_symbol_referencer::get_rounded_position (Grob *me) return int (rint (get_position (me))); } -LY_DEFINE (ly_grob_staff_position, "ly:grob-staff-position", - 1, 0, 0, (SCM sg), - "Return the Y-position of @var{sg} relative to the staff.") -{ - Grob *g = unsmob_grob (sg); - - SCM_ASSERT_TYPE (g, sg, SCM_ARG1, __FUNCTION__, "grob"); - Real pos = Staff_symbol_referencer::get_position (g); - - if (fabs (rint (pos) -pos) < 1e-6) // ugh. - return scm_from_int ((int) my_round (pos)); - else - return scm_from_double (pos); -} - MAKE_SCHEME_CALLBACK (Staff_symbol_referencer, callback, 1); SCM Staff_symbol_referencer::callback (SCM smob) diff --git a/lily/stem.cc b/lily/stem.cc index d5555a1e72..18314f1b19 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -572,7 +572,7 @@ Stem::flag (Grob *me) { int p = (int) (rint (stem_end_position (me))); staffline_offs - = Staff_symbol_referencer::on_staffline (me, p) ? "0" : "1"; + = Staff_symbol_referencer::on_line (me, p) ? "0" : "1"; } else staffline_offs = "2"; diff --git a/lily/tie-column-format.cc b/lily/tie-column-format.cc index 39c7286877..68afe8f303 100644 --- a/lily/tie-column-format.cc +++ b/lily/tie-column-format.cc @@ -21,69 +21,3 @@ #include - -void -shift_small_ties (Ties_configuration *tie_configs, - Grob *staff_referencer, - Tie_details const &details) -{ - set positions_taken; - for (int i = 0; i < tie_configs->size (); i++) - positions_taken.insert (int (rint (tie_configs->elem (i).position_))); - - for (int i = 0; i < tie_configs->size (); i++) - { - Tie_configuration * conf = &tie_configs->elem_ref (i); - - /* - on staff line and small enough, translate a little further - */ - Real h = conf->height (details); - bool next_free = positions_taken.find (int (rint (conf->position_ + conf->dir_))) - == positions_taken.end (); - - int rounded_pos = int (rint (conf->position_ + conf->delta_y_ / details.staff_space_)); - bool on_line = Staff_symbol_referencer::on_staffline (staff_referencer, rounded_pos); - - if (next_free) - if (on_line && h < 0.4 * details.staff_space_) - { - positions_taken.insert (int (rint (conf->position_ + conf->dir_))); - conf->delta_y_ += 0.2 * details.staff_space_ * conf->dir_; - } - else if (!on_line && h > 0.6 * details.staff_space_) - { - positions_taken.insert (int (rint (conf->position_ + conf->dir_))); - conf->delta_y_ += 0.5 * details.staff_space_ * conf->dir_; - } - } -} - - -void -final_shape_adjustment (Tie_configuration &conf, - Tie_formatting_problem const &problem, - Grob *staff_referencer) -{ - Tie_details const &details (problem.details_); - Real line_dy = 0.0; - bool on_line = Staff_symbol_referencer::on_staffline (staff_referencer, - int (rint (conf.position_))); - if (on_line) - line_dy = - sign (conf.height (details) - 0.6 * details.staff_space_) - * 0.2 * details.staff_space_ * conf.dir_; - - Real y = conf.position_ * details.staff_space_ * 0.5 - + line_dy; - - conf.attachment_x_ = problem.get_attachment (y); - conf.attachment_x_.intersect (problem.get_attachment (y + conf.dir_ * details.staff_space_ * 0.5)); - - conf.delta_y_ += line_dy; - conf.attachment_x_.widen (-details.x_gap_); - if (!on_line - && Staff_symbol_referencer::staff_radius (staff_referencer) * details.staff_space_ > y) - conf.center_tie_vertically (details); -} - - diff --git a/lily/tie-formatting-problem.cc b/lily/tie-formatting-problem.cc index fc4413df2e..03293c564b 100644 --- a/lily/tie-formatting-problem.cc +++ b/lily/tie-formatting-problem.cc @@ -1,5 +1,5 @@ /* - tie-formatting-problem.cc -- implement Tie_formatting_problem6 + tie-formatting-problem.cc -- implement Tie_formatting_problem source file of the GNU LilyPond music typesetter @@ -210,6 +210,12 @@ Tie_formatting_problem::from_ties (Link_array const &ties) } spec.position_ = Tie::get_position (ties[i]); + + do + { + spec.note_head_drul_[d] = Tie::head (ties[i], d); + } + while (flip (&d) != LEFT); specifications_.push (spec); } @@ -236,7 +242,8 @@ Tie_formatting_problem::from_lv_ties (Link_array const &lv_ties) { spec.position_ = int (Staff_symbol_referencer::get_position (head)); } - + + spec.note_head_drul_[LEFT] = head; heads.push (head); specifications_.push (spec); } @@ -263,6 +270,14 @@ Tie_formatting_problem::from_lv_ties (Link_array const &lv_ties) chord_outlines_[RIGHT].push (right_entry); } + +Tie_specification +Tie_formatting_problem::get_tie_specification (int i) const +{ + return specifications_[i]; +} + + Tie_configuration* Tie_formatting_problem::get_configuration (int pos, Direction dir) { @@ -298,15 +313,32 @@ Tie_formatting_problem::generate_configuration (int pos, Direction dir) const Real h = conf->height (details_); if (!conf->delta_y_) { - if (h < 0.5 * details_.staff_space_ - && !Staff_symbol_referencer::on_staffline (details_.staff_symbol_referencer_, pos)) + if (h < 0.5 * details_.staff_space_) { - conf->center_tie_vertically (details_); + if (!Staff_symbol_referencer::on_line (details_.staff_symbol_referencer_, pos)) + { + conf->center_tie_vertically (details_); + } + else if (Staff_symbol_referencer::on_line (details_.staff_symbol_referencer_, pos)) + { + conf->delta_y_ += dir * 0.2 * details_.staff_space_; + } } - else if (h < 0.5 * details_.staff_space_ - && Staff_symbol_referencer::on_staffline (details_.staff_symbol_referencer_, pos)) + else { - conf->delta_y_ += dir * 0.2 * details_.staff_space_; + Real top_y = y + conf->delta_y_ + conf->dir_ * h; + Real top_pos = top_y / (0.5*details_.staff_space_); + int round_pos = int (my_round (top_pos)); + + /* TODO: should use other variable? */ + Real clearance = details_.staff_line_clearance_; + if (fabs (top_pos - round_pos) < clearance + && Staff_symbol_referencer::on_staff_line (details_.staff_symbol_referencer_, + round_pos)) + { + Real new_y = (round_pos + clearance * conf->dir_) * 0.5 * details_.staff_space_; + conf->delta_y_ = (new_y - top_y); + } } } @@ -316,40 +348,25 @@ Tie_formatting_problem::generate_configuration (int pos, Direction dir) const Real Tie_formatting_problem::score_aptitude (Tie_configuration const &conf, - int tie_position) const + Tie_specification const &spec) const { - Real wrong_direction_offset_penalty_; - Real distance_penalty_factor_; - - wrong_direction_offset_penalty_ = 10; - distance_penalty_factor_ = 5; - Real penalty = 0.0; Real curve_y = conf.position_ * details_.staff_space_ * 0.5 + conf.delta_y_; - Real tie_y = tie_position * details_.staff_space_ * 0.5; + Real tie_y = spec.position_ * details_.staff_space_ * 0.5; if (sign (curve_y - tie_y) != conf.dir_) - penalty += wrong_direction_offset_penalty_; + penalty += details_.wrong_direction_offset_penalty_; - penalty += distance_penalty_factor_ * fabs (curve_y - tie_y); + penalty += details_.distance_penalty_factor_ * fabs (curve_y - tie_y); return penalty; } - Real Tie_formatting_problem::score_configuration (Tie_configuration const &conf) const { - Real length_penalty_factor = 1.0; - Real min_length = 0.333; - Real staff_line_clearance = 0.1; - Real staff_line_collision_penalty = 5; - Real dot_collision_clearance = 0.25; - Real dot_collision_penalty = 10; - - Real penalty = 0.0; Real length = conf.attachment_x_.length (); - if (length < min_length) - penalty += length_penalty_factor / max (0.01, length); + if (length < details_.min_length_) + penalty += details_.length_penalty_factor_ / max (0.01, length); Real tip_pos = conf.position_ + conf.delta_y_ / 0.5 * details_.staff_space_; Real tip_y = tip_pos * details_.staff_space_ * 0.5; @@ -358,19 +375,19 @@ Tie_formatting_problem::score_configuration (Tie_configuration const &conf) cons Real top_y = tip_y + conf.dir_ * height; Real top_pos = 2 * top_y / details_.staff_space_; Real round_top_pos = rint (top_pos); - if (fabs (top_pos - round_top_pos) < staff_line_clearance - && Staff_symbol_referencer::on_staffline (details_.staff_symbol_referencer_, + if (fabs (top_pos - round_top_pos) < details_.staff_line_clearance_ + && Staff_symbol_referencer::on_line (details_.staff_symbol_referencer_, int (round_top_pos)) && Staff_symbol_referencer::staff_radius (details_.staff_symbol_referencer_) > top_y) { - penalty += staff_line_collision_penalty; + penalty += details_.staff_line_collision_penalty_; } - if (fabs (tip_pos - rint (tip_pos)) < staff_line_clearance - && Staff_symbol_referencer::on_staffline (details_.staff_symbol_referencer_, - int (rint (tip_pos)))) + if (fabs (tip_pos - rint (tip_pos)) < details_.staff_line_clearance_ + && Staff_symbol_referencer::on_line (details_.staff_symbol_referencer_, + int (rint (tip_pos)))) { - penalty += staff_line_collision_penalty; + penalty += details_.staff_line_collision_penalty_; } if (!dot_x_.is_empty ()) @@ -387,22 +404,25 @@ Tie_formatting_problem::score_configuration (Tie_configuration const &conf) cons i != dot_positions_.end (); i ++) { int dot_pos = (*i); - if (fabs (dot_pos * details_.staff_space_ * 0.5 - y) < dot_collision_clearance) + if (fabs (dot_pos * details_.staff_space_ * 0.5 - y) < details_.dot_collision_clearance_) { - penalty += dot_collision_penalty; + penalty += details_.dot_collision_penalty_; } } - } + } } return penalty; } Tie_configuration -Tie_formatting_problem::find_optimal_tie_configuration (int pos, Direction dir) const +Tie_formatting_problem::find_optimal_tie_configuration (Tie_specification const &spec) const { Link_array confs; + int pos = spec.position_; + Direction dir = spec.manual_dir_; + int region_size = 3; for (int i = 0; i < region_size; i ++) { @@ -417,7 +437,7 @@ Tie_formatting_problem::find_optimal_tie_configuration (int pos, Direction dir) { Real score = 0.0; score += score_configuration (*confs[i]); - score += score_aptitude (*confs[i], pos); + score += score_aptitude (*confs[i], spec); if (score < best_score) { @@ -440,6 +460,8 @@ Tie_specification::Tie_specification () position_ = 0; manual_position_ = 0; manual_dir_ = CENTER; + note_head_drul_[LEFT] = + note_head_drul_[RIGHT] = 0; } @@ -454,7 +476,7 @@ Tie_formatting_problem::score_ties_aptitude (Ties_configuration const &ties) con } for (int i = 0; i < ties.size (); i++) - score += score_aptitude (ties[i], specifications_[i].position_); + score += score_aptitude (ties[i], specifications_[i]); return score; } @@ -469,10 +491,6 @@ Tie_formatting_problem::score_ties (Ties_configuration const &ties) const Real Tie_formatting_problem::score_ties_configuration (Ties_configuration const &ties) const { - const Real tie_monotonicity_penalty = 100; - const Real tie_collision_penalty = 30; - const Real tie_collision_distance = 0.25; - Real score = 0.0; for (int i = 0; i < ties.size (); i++) { @@ -492,16 +510,18 @@ Tie_formatting_problem::score_ties_configuration (Ties_configuration const &ties if (i) { if (edge <= last_edge) - score += tie_monotonicity_penalty; + score += details_.tie_column_monotonicity_penalty_; if (center <= last_center) - score += tie_monotonicity_penalty; + score +=details_. tie_column_monotonicity_penalty_; score += - tie_collision_penalty - * max (tie_collision_distance - fabs (center - last_center), 0.0) / tie_collision_distance; + details_.tie_tie_collision_penalty_ + * max (details_.tie_tie_collision_distance_ - fabs (center - last_center), 0.0) + / details_.tie_tie_collision_distance_; score += - tie_collision_penalty - * max (tie_collision_distance - fabs (edge - last_edge), 0.0) / tie_collision_distance; + details_.tie_tie_collision_penalty_ + * max (details_.tie_tie_collision_distance_ - fabs (edge - last_edge), 0.0) + / details_.tie_tie_collision_distance_; } last_edge = edge; @@ -538,8 +558,6 @@ Ties_configuration Tie_formatting_problem::generate_base_chord_configuration () { Ties_configuration ties_config; - - for (int i = 0; i < specifications_.size (); i ++) { Tie_configuration conf; diff --git a/lily/tie-helper.cc b/lily/tie-helper.cc index f53ebba374..6da15c0c3c 100644 --- a/lily/tie-helper.cc +++ b/lily/tie-helper.cc @@ -14,24 +14,36 @@ #include "warn.hh" #include "tie-formatting-problem.hh" + +#define get_real_detail(src, defvalue) robust_scm2double(ly_assoc_get (ly_symbol2scm (src), details, SCM_EOL), defvalue) + void Tie_details::from_grob (Grob *me) { staff_symbol_referencer_ = me; staff_space_ = Staff_symbol_referencer::staff_space (me); + x_gap_ = robust_scm2double (me->get_property ("x-gap"), 0.2); + SCM details = me->get_property ("details"); - height_limit_ = robust_scm2double (ly_assoc_get (ly_symbol2scm ("height-limit"), details, SCM_EOL), - 0.75) * staff_space_; - - ratio_ = robust_scm2double (ly_assoc_get (ly_symbol2scm ("ratio"), details, SCM_EOL), - .333); - - x_gap_ = robust_scm2double (me->get_property ("x-gap"), 0.2); - between_length_limit_ - = robust_scm2double (ly_assoc_get (ly_symbol2scm ("between-length-limit"), details, SCM_EOL), - 1.0); + height_limit_ = get_real_detail("height-limit", 0.75); + ratio_ = get_real_detail("ratio", .333); + between_length_limit_ = get_real_detail ("between-length-limit", 1.0); + wrong_direction_offset_penalty_ = get_real_detail("wrong-direction-offset-penalty", 10); + distance_penalty_factor_ = get_real_detail("distance-penalty-factor", 5); + length_penalty_factor_ = get_real_detail("length-penalty-factor", 1.0); + min_length_ = get_real_detail("min-length", 0.333); + + // in half-space + staff_line_clearance_ = get_real_detail ("staff-line-clearance", 0.4); + staff_line_collision_penalty_ = get_real_detail("staff-line-collision-penalty", 5); + dot_collision_clearance_ = get_real_detail ( "dot-collision-clearance", 0.25); + dot_collision_penalty_ = get_real_detail ( "dot-collision-penalty", 0.25); + + tie_column_monotonicity_penalty_ = get_real_detail ("tie-column-monotonicity-penalty", 100); + tie_tie_collision_penalty_ = get_real_detail ("tie-tie-collision-penalty", 30); + tie_tie_collision_distance_ = get_real_detail ("tie-tie-collision-distance", .25); } Tie_details::Tie_details () diff --git a/lily/tie.cc b/lily/tie.cc index d79ffccd55..e67ed6b3e1 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -144,11 +144,13 @@ Tie::set_default_control_points (Grob *me_grob) Tie_formatting_problem problem; problem.from_tie (me); + Tie_specification spec = problem.get_tie_specification (0); + spec.has_manual_dir_ = true; + spec.manual_dir_ = get_grob_direction (me); - // get_configuration (me, &conf, problem); - int tie_position = (int) Tie::get_position (me); Tie_configuration conf - = problem.find_optimal_tie_configuration (tie_position, get_grob_direction (me)); + = problem.find_optimal_tie_configuration (spec); + set_control_points (me, problem.common_x_refpoint (), conf, problem.details_); } diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc index 90edb7c94a..e8b006f990 100644 --- a/lily/tuplet-bracket.cc +++ b/lily/tuplet-bracket.cc @@ -602,7 +602,7 @@ Tuplet_bracket::calc_position_and_height (Grob *me_grob, Real *offset, Real *dy) *offset *= 2 / ss; *offset = rint (*offset); - if (Staff_symbol_referencer::on_staffline (me, (int) rint (*offset))) + if (Staff_symbol_referencer::on_line (me, (int) rint (*offset))) *offset += dir; *offset *= 0.5 * ss; diff --git a/lily/vaticana-ligature.cc b/lily/vaticana-ligature.cc index 0477c0e785..1fdf2b5430 100644 --- a/lily/vaticana-ligature.cc +++ b/lily/vaticana-ligature.cc @@ -25,7 +25,7 @@ vaticana_brew_cauda (Grob *me, Real thickness, Real blotdiameter) { - bool on_staffline = Staff_symbol_referencer::on_staffline (me, pos); + bool on_staffline = Staff_symbol_referencer::on_line (me, pos); int interspaces = Staff_symbol_referencer::line_count (me) - 1; bool above_staff = pos > interspaces; diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index e075119ea4..0d3cab0815 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -1716,6 +1716,7 @@ (direction . ,Tie::calc_direction) (stencil . ,Tie::print) (details . ((ratio . 0.333) + (staff-line-clearance . 0.6) (height-limit . 1.0) (between-length-limit . 1.0))) (thickness . 1.0)