2 simple-spacer.hh -- declare Simple_spacer
4 source file of the GNU LilyPond music typesetter
6 (c) 1999--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #ifndef SIMPLE_SPACER_HH
11 #define SIMPLE_SPACER_HH
14 #include "lily-proto.hh"
17 struct Spring_description
25 Real
length (Real force
) const;
26 Spring_description ();
32 A simple spacing constraint solver. The approach:
34 Stretch the line uniformly until none of the constraints (rods)
35 block. It then is very wide.
38 Compress until the next constraint blocks,
40 Mark the springs over the constrained part to be non-active.
42 Repeat with the smaller set of non-active constraints, until all
43 constraints blocked, or until the line is as short as desired.
45 This is much simpler, and much much faster than full scale
46 Constrained QP. On the other hand, a situation like this will not
47 be typeset as dense as possible, because
50 veryveryverylongsyllable2 veryveryverylongsyllable2
51 " "4 veryveryverylongsyllable2 syllable4
54 can be further compressed to
58 veryveryverylongsyllable2 veryveryverylongsyllable2
59 " "4 veryveryverylongsyllable2 syllable4
62 Perhaps this is not a bad thing, because the 1st looks better anyway. */
65 Array
<Spring_description
> springs_
;
66 Link_array
<Grob
> spaced_cols_
;
67 Link_array
<Grob
> loose_cols_
;
71 Real default_space_f_
;
76 void solve (Column_x_positions
*) const;
77 void add_columns (Link_array
<Grob
>);
78 void my_solve_linelen ();
79 void my_solve_natural_len ();
80 Real
active_springs_stiffness () const;
81 Real
range_stiffness (int, int) const;
82 void add_rod (int l
, int r
, Real dist
);
83 Real
range_ideal_len (int l
, int r
)const;
84 Real
active_blocking_force ()const;
85 Real
configuration_length ()const;
86 void set_active_states ();
87 bool active_b () const;
90 #endif /* SIMPLE_SPACER_HH */