summaryrefslogtreecommitdiff
path: root/lily/atom.cc
blob: 0d8eb44f44cc59ad9130ff6625988b2b838a771c (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
  atom.cc -- implement Atom

  source file of the GNU LilyPond music typesetter

  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
#include "symbol.hh"
#include "tex.hh"
#include "interval.hh"
#include "dimen.hh"
#include "string.hh"
#include "varray.hh"
#include "debug.hh"

void
Atom::print() const
{
#ifndef NPRINT
    mtor << "texstring: " <<sym_.tex<<"\n";    
#endif
}

Box
Atom::extent() const
{
    Box b( sym_.dim);
    b.translate(off_);
    return b;
}

Atom::Atom(Symbol s)
{
    sym_=s;
}


String
Atom::TeX_string() const
{
    /* infinity checks. */
    assert( abs(off_.x()) < 100 CM);
    assert( abs(off_.y()) < 100 CM);
    
    // whugh.. Hard coded...
    String s("\\placebox{%}{%}{%}");
    Array<String> a;
    a.push(print_dimen(off_.y()));
    a.push(print_dimen(off_.x()));
    a.push(sym_.tex);
    return substitute_args(s, a);
}