]> git.donarmstrong.com Git - lilypond.git/blob - lily/atom.cc
release: 0.1.9
[lilypond.git] / lily / atom.cc
1 /*
2   atom.cc -- implement Atom
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8 #include "symbol.hh"
9 #include "tex.hh"
10 #include "interval.hh"
11 #include "dimen.hh"
12 #include "string.hh"
13 #include "varray.hh"
14 #include "debug.hh"
15
16 void
17 Atom::print() const
18 {
19 #ifndef NPRINT
20   DOUT << "texstring: " <<sym_.tex<<"\n";    
21 #endif
22 }
23
24 Box
25 Atom::extent() const
26 {
27   Box b (sym_.dim);
28   b.translate (off_);
29   return b;
30 }
31
32 Atom::Atom (Symbol s)
33 {
34   sym_=s;
35 }
36
37
38 String
39 Atom::TeX_string() const
40 {
41   /* infinity checks. */
42   assert (abs (off_.x()) < 100 CM);
43   assert (abs (off_.y()) < 100 CM);
44   
45   // whugh.. Hard coded...
46   String s ("\\placebox{%}{%}{%}");
47   Array<String> a;
48   a.push (print_dimen (off_.y()));
49   a.push (print_dimen (off_.x()));
50   a.push (sym_.tex);
51   return substitute_args (s, a);
52 }