}
}
+#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_)
{
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);
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) \
#include "real.hh"
+/*
+ Parameters for a stem, (multiply with stemdirection, to get real values
+ for a downstem.)
+
+ */
struct Stem_info
{
Real idealy_f_;
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.
}
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);
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;
{
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;
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;
}
;; 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))
(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)
,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)
(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))
))
#'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
)
)