--- /dev/null
+/*
+ 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
+{
+ mtor << "texstring: " <<sym.tex<<"\n";
+}
+
+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);
+}
+/*
+ symbol.hh -- declare Symbol, Atom
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
#ifndef SYMBOL_HH
#define SYMBOL_HH
String str()const; // for printing.
};
+
+/// a symbol which can be translated, and freely copied
+struct Atom {
+ Offset off;
+ Symbol sym;
+
+ /* *************** */
+
+ void translate(Offset o) {
+ off += o;
+ }
+
+ /// how big is #this#?
+ Box extent() const;
+ Atom(Symbol s);
+
+ void print() const;
+
+ String TeX_string() const;
+};
#endif