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::get_dimension (SCM s) const
50 SCM val = lookup_variable (s);
51 return ly_scm2double (val);
54 /* FIXME. This is broken until we have a generic way of
55 putting lists inside the \paper block. */
57 Paper_def::line_dimensions_int (int n) const
59 Real lw = get_dimension (ly_symbol2scm ("linewidth"));
60 Real ind = n? 0.0:get_dimension (ly_symbol2scm ("indent"));
62 return Interval (ind, lw);
66 Paper_def::get_paper_outputter (String outname) const
68 progress_indication (_f ("paper output to `%s'...",
69 outname == "-" ? String ("<stdout>") : outname));
70 return new Paper_outputter (outname);
77 return dynamic_cast<Paper_def*> (unsmob_music_output_def (x));
81 LY_DEFINE (ly_paper_def_p, "ly:paper-def?",
83 "Is @var{def} a paper definition?")
85 Paper_def *op = dynamic_cast<Paper_def*> (unsmob_music_output_def (def));
88 return ly_bool2scm (pap);