2 paper-score.cc -- implement Paper_score
4 source file of the GNU LilyPond music typesetter
6 (c) 1996--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
12 #include "font-metric.hh"
14 #include "paper-def.hh"
16 #include "paper-column.hh"
17 #include "paper-score.hh"
18 #include "paper-column.hh"
19 #include "scm-hash.hh"
20 #include "gourlay-breaking.hh"
21 #include "paper-outputter.hh"
22 #include "input-file-results.hh"
24 #include "all-font-metrics.hh"
26 Paper_score::Paper_score ()
35 Paper_score::typeset_line (System *l)
42 main_smob_ = gh_cons (l->self_scm (), main_smob_);
45 scm_gc_unprotect_object (l->self_scm());
49 Paper_score::Paper_score (Paper_score const &s)
55 Array<Column_x_positions>
56 Paper_score::calc_breaking ()
58 Break_algorithm *algorithm=0;
59 Array<Column_x_positions> sol;
61 algorithm = new Gourlay_breaking ;
62 algorithm->set_pscore (this);
63 sol = algorithm->solve ();
73 Paper_score::process (String outname)
76 progress_indication (_f ("Element count %d (spanners %d) ",
77 system_->element_count (),
78 system_->spanner_count ()));
81 progress_indication (_ ("Preprocessing graphical objects...") + " ");
84 Be sure to set breakability on first & last column.
86 { /* doubly, also done in Score_engraver */
87 Link_array<Grob> pc (system_->columns ());
89 pc[0]->set_grob_property ("breakable", SCM_BOOL_T);
90 pc.top ()->set_grob_property ("breakable", SCM_BOOL_T);
92 system_->pre_processing ();
94 Array<Column_x_positions> breaking = calc_breaking ();
95 system_->break_into_pieces (breaking);
97 outputter_ = paper_->get_paper_outputter (outname);
98 outputter_->output_header ();
99 outputter_->output_version ();
101 progress_indication ("\n");
103 if (global_input_file->header_)
105 outputter_->output_scope (global_input_file->header_, "lilypond");
106 outputter_->write_header_fields_to_file (global_input_file->header_);
111 outputter_->output_scope (header_, "lilypond");
112 outputter_->write_header_fields_to_file (header_);
115 outputter_->output_scope (paper_->scope_, "lilypondpaper");
117 SCM scm = scm_list_n (ly_symbol2scm ("header-end"), SCM_UNDEFINED);
118 outputter_->output_scheme (scm);
120 system_->output_lines ();
122 scm = scm_list_n (ly_symbol2scm ("end-output"), SCM_UNDEFINED);
123 outputter_->output_scheme (scm);
125 progress_indication ("\n");