]> git.donarmstrong.com Git - lilypond.git/blob - lily/atom.cc
release: 0.1.13
[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   String tex_str = sym_.tex;
42   Offset off = off_;
43
44   /* infinity checks. */
45   for (int a =X_AXIS; a < NO_AXES; a++)
46     {
47       Axis ax = (Axis)a;
48       if (abs (off[ax]) >= 100 CM)
49         {
50           warning ("ridiculous dimension " + axis_name_str (ax)  + ", " 
51                    +print_dimen(off[ax]));
52           off[ax] = 0.0;
53           tex_str += "\errormark"; 
54         }
55     }
56   // whugh.. Hard coded...
57   String s ("\\placebox{");
58   s += print_dimen (off[Y_AXIS])+"}{";
59   s += print_dimen (off[X_AXIS]) + "}{";
60   s += tex_str + "}";
61   return s;
62 }