]> git.donarmstrong.com Git - lilypond.git/blob - lily/paper-score.cc
* configure.in: Test for and accept lmodern if EC fonts not found.
[lilypond.git] / lily / paper-score.cc
1 /*
2   paper-score.cc -- implement Paper_score
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1996--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include "paper-score.hh"
10
11 #include "all-font-metrics.hh"
12 #include "gourlay-breaking.hh"
13 #include "ly-module.hh"
14 #include "main.hh"
15 #include "misc.hh"
16 #include "output-def.hh"
17 #include "paper-book.hh"
18 #include "paper-column.hh"
19 #include "scm-hash.hh"
20 #include "score.hh"
21 #include "stencil.hh"
22 #include "system.hh"
23 #include "warn.hh"
24
25 Paper_score::Paper_score ()
26 {
27   layout_ = 0;
28   system_ = 0;
29 }
30
31 Paper_score::Paper_score (Paper_score const &s)
32   : Music_output (s)
33 {
34   assert (false);
35 }
36
37 void
38 Paper_score::typeset_line (System *system)
39 {
40   if (!system_)
41     system_ = system;
42
43   systems_ = scm_cons (system->self_scm (), systems_);
44   system->pscore_ = this;
45
46   scm_gc_unprotect_object (system->self_scm ());
47 }
48
49 Array<Column_x_positions>
50 Paper_score::calc_breaking ()
51 {
52   Break_algorithm *algorithm = 0;
53   Array<Column_x_positions> sol;
54
55   algorithm = new Gourlay_breaking ;
56   algorithm->set_pscore (this);
57   sol = algorithm->solve ();
58   delete algorithm;
59
60   return sol;
61 }
62
63 SCM
64 Paper_score::process (String)
65 {
66   if (verbose_global_b)
67     progress_indication (_f ("Element count %d (spanners %d) ",
68                              system_->element_count (),
69                              system_->spanner_count ()));
70
71   progress_indication (_ ("Preprocessing graphical objects...") + " ");
72
73   /* FIXME: Check out why we need this - removing gives assertion failures
74      down the road.
75      
76      doubly, also done in Score_engraver */
77   Link_array<Grob> pc (system_->columns ());
78   pc[0]->set_property ("breakable", SCM_BOOL_T);
79   pc.top ()->set_property ("breakable", SCM_BOOL_T);
80     
81   system_->pre_processing ();
82  
83   Array<Column_x_positions> breaking = calc_breaking ();
84   system_->break_into_pieces (breaking);
85   SCM lines = system_->get_lines ();
86 #if 0
87   /* gourlay:do_solve also prints newline.  */
88   progress_indication ("\n");
89 #endif
90   
91   /* Only keep result stencils in lines_, *title_; delete all grobs.  */
92   systems_ = SCM_EOL;
93   
94   return lines;
95 }