2 paper-def.cc -- implement Paper_def
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
12 #include "book-paper-def.hh"
13 #include "virtual-font-metric.hh"
14 #include "all-font-metrics.hh"
17 #include "paper-def.hh"
19 #include "scaled-font-metric.hh"
21 #include "scm-hash.hh"
22 #include "paper-outputter.hh"
23 #include "ly-module.hh"
26 This is an almost empty thing. The only substantial thing this class
27 handles is scaling up and down to real-world dimensions (internally
28 dimensions are against global staff-space.)
31 Paper_def::Paper_def ()
36 Paper_def::Paper_def (Paper_def const&src)
37 : Music_output_def (src)
39 /* Do not remove this statement, scm_make_hash_table may trigger GC. */
43 Paper_def::~Paper_def ()
48 Paper_def::derived_mark ()
51 scm_gc_mark (bookpaper_->self_scm ());
55 Paper_def::get_dimension (SCM s) const
57 SCM val = lookup_variable (s);
58 return ly_scm2double (val);
61 /* FIXME. This is broken until we have a generic way of
62 putting lists inside the \paper block. */
64 Paper_def::line_dimensions_int (int n) const
66 Real lw = get_dimension (ly_symbol2scm ("linewidth"));
67 Real ind = n? 0.0:get_dimension (ly_symbol2scm ("indent"));
69 return Interval (ind, lw);
73 Paper_def::get_paper_outputter (String outname) const
75 progress_indication (_f ("paper output to `%s'...",
76 outname == "-" ? String ("<stdout>") : outname));
77 return new Paper_outputter (outname);
84 return dynamic_cast<Paper_def*> (unsmob_music_output_def (x));
88 LY_DEFINE (ly_paper_def_p, "ly:paper-def?",
90 "Is @var{def} a paper definition?")
92 Paper_def *op = dynamic_cast<Paper_def*> (unsmob_music_output_def (def));
95 return ly_bool2scm (pap);