]> git.donarmstrong.com Git - lilypond.git/blob - lily/paper-outputter.cc
17231564b8555774d6be312d1e4c7d67af9a639d
[lilypond.git] / lily / paper-outputter.cc
1 /*
2   paper-outputter.cc -- implement Paper_outputter
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   Jan Nieuwenhuizen <janneke@gnu.org>
8 */
9
10 #include "paper-outputter.hh"
11 #include "paper-stream.hh"
12 #include "paper-def.hh"
13 #include "molecule.hh"
14 #include "atom.hh"
15 #include "array.hh"
16 #include "string-convert.hh"
17 #include "debug.hh"
18 #include "lookup.hh"
19 #include "main.hh"
20
21 Paper_outputter::Paper_outputter (Paper_stream *s)
22 {
23   outstream_l_ = s;
24 }
25
26 Paper_outputter::~Paper_outputter ()
27 {
28 }
29
30 void
31 Paper_outputter::output_molecule (Molecule const*m, Offset o, char const *nm, String s)
32 {
33   if (check_debug)
34     *outstream_l_ << String ("\n%start: ") << nm << "\n";
35
36   for (PCursor <Atom*> i (m->atoms_); i.ok (); i++)
37     {
38       Offset a_off = i->offset ();
39       a_off += o;
40
41       switch_to_font (i->font_);
42
43       Array<String> a;
44       String r;
45   
46       a.push (global_paper_l->dimension_str (a_off.y()));
47       a.push (global_paper_l->dimension_str (a_off.x()));
48       a.push (i->str_);
49       r += global_lookup_l->substitute_args (s, a);
50       *outstream_l_ << r;
51     }
52 }