From: fred Date: Wed, 27 Mar 2002 02:06:57 +0000 (+0000) Subject: lilypond-1.5.42 X-Git-Tag: release/1.5.59~256 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=a04fc38dc02f8271faee126a918c86b00c80d667;p=lilypond.git lilypond-1.5.42 --- diff --git a/lily/gourlay-breaking.cc b/lily/gourlay-breaking.cc index 96728b602a..b61a750562 100644 --- a/lily/gourlay-breaking.cc +++ b/lily/gourlay-breaking.cc @@ -207,9 +207,15 @@ Gourlay_breaking::combine_demerits (Column_x_positions const &prev, } } +#if 1 + /* + Q: do want globally non-cramped lines, or locally equally cramped lines. + */ Real demerit = abs (this_one.force_f_) + abs (prev.force_f_ - this_one.force_f_) + break_penalties; - +#else + Real demerit = abs (this_one.force_f_) + break_penalties; +#endif if (!this_one.satisfies_constraints_b_) { diff --git a/lily/include/beam.hh b/lily/include/beam.hh index c0c7c28933..86c539d8ff 100644 --- a/lily/include/beam.hh +++ b/lily/include/beam.hh @@ -35,7 +35,12 @@ public: DECLARE_SCHEME_CALLBACK (check_concave, (SCM)); DECLARE_SCHEME_CALLBACK (slope_damping, (SCM)); DECLARE_SCHEME_CALLBACK (quantise_position, (SCM)); - + DECLARE_SCHEME_CALLBACK (new_quanting, (SCM)); + DECLARE_SCHEME_CALLBACK (score_slopes_dy, (SCM, SCM,SCM)); + DECLARE_SCHEME_CALLBACK (score_stem_lengths, (SCM, SCM,SCM)); + DECLARE_SCHEME_CALLBACK (score_forbidden_quants, (SCM, SCM,SCM)); + + static Molecule stem_beams (Grob*,Item *here, Item *next, Item *prev, Real dydx); diff --git a/lily/include/lily-guile.hh b/lily/include/lily-guile.hh index d4ea1f8192..a5d1b283aa 100644 --- a/lily/include/lily-guile.hh +++ b/lily/include/lily-guile.hh @@ -219,10 +219,12 @@ typedef SCM (*Scheme_function_unknown) (); typedef SCM (*Scheme_function_0) (); typedef SCM (*Scheme_function_1) (SCM); typedef SCM (*Scheme_function_2) (SCM,SCM); +typedef SCM (*Scheme_function_3) (SCM,SCM, SCM); #else typedef SCM (*Scheme_function_0) (...); typedef SCM (*Scheme_function_1) (...); typedef SCM (*Scheme_function_2) (...); +typedef SCM (*Scheme_function_3) (...); #endif #define DECLARE_SCHEME_CALLBACK(NAME,ARGS) \ diff --git a/lily/include/stem-info.hh b/lily/include/stem-info.hh index 25c0a8eec2..d4496a442d 100644 --- a/lily/include/stem-info.hh +++ b/lily/include/stem-info.hh @@ -12,6 +12,11 @@ #include "real.hh" +/* + Parameters for a stem, (multiply with stemdirection, to get real values + for a downstem.) + + */ struct Stem_info { Real idealy_f_; diff --git a/lily/simple-spacer.cc b/lily/simple-spacer.cc index f6a36eaa48..fa75e433a7 100644 --- a/lily/simple-spacer.cc +++ b/lily/simple-spacer.cc @@ -317,9 +317,10 @@ void Simple_spacer::solve (Column_x_positions *positions) const { positions->force_f_ = force_f_; - if (compression_penalty_b_ && (force_f_ < 0)) + if ((force_f_ < 0)) { - + positions->force_f_ *= 1.3; + if (compression_penalty_b_) positions->force_f_ *= 2; // hmm. } diff --git a/lily/stem.cc b/lily/stem.cc index e69de92f54..3268f31bca 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -660,6 +660,19 @@ Stem::beam_l (Grob*me) Stem_info Stem::calc_stem_info (Grob*me) { + SCM scm_info = me->get_grob_property ("stem-info"); + + if (gh_pair_p (scm_info )) + { + Stem_info si ; + + si.idealy_f_ = gh_scm2double (gh_car (scm_info)); + si.maxy_f_ = gh_scm2double (gh_cadr (scm_info)); + si.miny_f_ = gh_scm2double (gh_caddr (scm_info)); + + return si; + } + Grob * beam = beam_l (me); Direction beam_dir = Directional_element_interface::get (beam); @@ -715,7 +728,7 @@ Stem::calc_stem_info (Grob*me) info.idealy_f_ += thick + (multiplicity - 1) * interbeam_f; } info.miny_f_ = info.idealy_f_; - info.maxy_f_ = INT_MAX; + info.maxy_f_ = 1000; // INT_MAX; info.idealy_f_ += stem_length; info.miny_f_ += minimum_length; @@ -749,7 +762,7 @@ Stem::calc_stem_info (Grob*me) { info.idealy_f_ -= thick; info.maxy_f_ = info.idealy_f_; - info.miny_f_ = -INT_MAX; + info.miny_f_ = - 1000 ; // INT_MAX; info.idealy_f_ -= stem_length; info.maxy_f_ -= minimum_length; @@ -770,6 +783,12 @@ Stem::calc_stem_info (Grob*me) info.miny_f_ += interstaff_f; info.maxy_f_ += interstaff_f ; + me->set_grob_property ("stem-info", + scm_list_n (gh_double2scm (info.idealy_f_), + gh_double2scm (info.maxy_f_ ), + gh_double2scm (info.miny_f_), + SCM_UNDEFINED)); + return info; } diff --git a/scm/beam.scm b/scm/beam.scm index efcc28835e..4ab5e2eb4b 100644 --- a/scm/beam.scm +++ b/scm/beam.scm @@ -57,6 +57,55 @@ ;; period: 1 (staff-space) (append quants (list (+ 1 (car quants)))))) +(define (default-left-beam-pos-quants beam multiplicity dir dy staff-line) + (default-beam-pos-quants beam multiplicity 1 staff-line)) +;; +(define (foo beam multiplicity dir dy staff-line) + (let* ((beam-straddle 0) + (thick (ly-get-grob-property beam 'thickness)) + (beam-sit (/ (- thick staff-line) 2)) + (beam-hang (- 1 (/ (- thick staff-line) 2))) + (quants '()) + ) + + (if (or (<= multiplicity 1) + (and (not (equal? dir 1)) + (not (< dy 0)))) + (set! quants (cons beam-sit quants))) + (if (or (<= multiplicity 1) + (and (not (equal? dir -1)) + (not (> dy 0)))) + (set! quants (cons beam-hang quants))) + (if (or (<= multiplicity 2) (>= (abs dy) (/ staff-line 2))) + (set! quants (cons beam-straddle quants))) + ;; period: 1 (staff-space) + (append quants (list (+ 1 (car quants)))))) + +(define (default-right-beam-pos-quants beam multiplicity dir dy staff-line) + (default-beam-pos-quants beam multiplicity 1 staff-line)) +;; +(define (foo beam multiplicity dir dy staff-line) + (let* ((beam-straddle 0) + (thick (ly-get-grob-property beam 'thickness)) + (beam-sit (/ (- thick staff-line) 2)) + (beam-hang (- 1 (/ (- thick staff-line) 2))) + (quants '()) + ) + + + (if (or (<= multiplicity 1) + (and (not (equal? dir 1)) + (not (> dy 0)))) + (set! quants (cons beam-sit quants))) + (if (or (<= multiplicity 1) + (and (not (equal? dir -1)) + (not (< dy 0)))) + (set! quants (cons beam-hang quants))) + (if (or (<= multiplicity 2) (>= (abs dy) (/ staff-line 2))) + (set! quants (cons beam-straddle quants))) + ;; period: 1 (staff-space) + (append quants (list (+ 1 (car quants)))))) + (define (beam-traditional-pos-quants beam multiplicity dy staff-line) (let* ((beam-straddle 0) (thick (ly-get-grob-property beam 'thickness)) diff --git a/scm/grob-description.scm b/scm/grob-description.scm index fcb3f3b90f..d6e3d431a2 100644 --- a/scm/grob-description.scm +++ b/scm/grob-description.scm @@ -103,7 +103,8 @@ (position-callbacks . (,Beam::least_squares ,Beam::check_concave ,Beam::slope_damping - ,Beam::quantise_position)) + ,Beam::new_quanting + )) (thickness . 0.48) ; in staff-space (before-line-breaking-callback . ,Beam::before_line_breaking) @@ -111,7 +112,8 @@ ,Beam::end_after_line_breaking)) (neutral-direction . -1) (dir-function . ,beam-dir-majority) - (vertical-position-quant-function . ,default-beam-pos-quants) + (left-position-quant-function . ,default-left-beam-pos-quants) + (right-position-quant-function . ,default-right-beam-pos-quants) (beamed-stem-shorten . (1.0 0.5)) (outer-stem-length-limit . 0.2) (slope-limit . 0.2) @@ -119,6 +121,11 @@ (space-function . ,default-beam-space-function) (damping . 1) (auto-knee-gap . 7) + (font-name . "cmr10") + (quant-score-functions . (,Beam::score_forbidden_quants + ,Beam::score_slopes_dy + ,Beam::score_stem_lengths + )) (meta . ,(grob-description beam-interface)) )) diff --git a/scm/interface-description.scm b/scm/interface-description.scm index dd05c80db0..38499a65b4 100644 --- a/scm/interface-description.scm +++ b/scm/interface-description.scm @@ -73,20 +73,16 @@ #'thickness= weight of beams, in staffspace " '(auto-knee-gap - staff-position - height - flag-width-function - damping - neutral-direction - thickness - space-function beamed-stem-shorten - height-quants - vertical-position-quant-function damping + flag-width-function + neutral-direction outer-stem-length-limit + positions slope-limit - auto-knee-gap + space-function + thickness + vertical-position-quant-function ) )