source file of the GNU LilyPond music typesetter
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
-#include "symbol.hh"
-#include "tex.hh"
+
+#include <math.h>
+#include "ly-smobs.icc"
+
+#include "atom.hh"
#include "interval.hh"
-#include "dimen.hh"
#include "string.hh"
-#include "varray.hh"
+#include "array.hh"
#include "debug.hh"
+#include "dimensions.hh"
+#include "lookup.hh"
+#include "main.hh"
+#include "global-ctor.hh"
+#include "font-metric.hh"
-void
-Atom::print() const
+Atom::Atom(SCM s)
{
-#ifndef NPRINT
- DOUT << "texstring: " <<sym_.tex<<"\n";
-#endif
+ SCM onstack = s; // protection. just to be sure.
+ func_ = s;
+ self_scm_ = SCM_EOL;
+ smobify_self ();
}
-Box
-Atom::extent() const
+SCM
+Atom::mark_smob (SCM s)
{
- Box b (sym_.dim);
- b.translate (off_);
- return b;
+ Atom* a = SMOB_TO_TYPE(Atom, s);
+ assert (s == a->self_scm_);
+ return a->func_;
}
-Atom::Atom (Symbol s)
+void
+Atom::fontify (Font_metric * met)
{
- sym_=s;
+ SCM desc = ly_quote_scm (met->description ());
+ SCM font_switch = gh_list (ly_symbol2scm ("select-font"),
+ desc,
+ SCM_UNDEFINED);
+
+ SCM f =func_;
+ func_ = gh_list (ly_symbol2scm ("string-append"),
+ font_switch , f,
+ SCM_UNDEFINED);
}
+void
+Atom::do_smobify_self ()
+{
+}
-String
-Atom::TeX_string() const
+Atom::Atom (Atom const &s)
{
- /* 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);
+ off_ = s.off_;
+ func_ = s.func_;
+ self_scm_= SCM_EOL;
+ smobify_self ();
}
+int
+Atom::print_smob (SCM s, SCM p, scm_print_state*)
+{
+ Atom * a = unsmob_atom (s);
+
+ scm_puts ("#<Atom off ",p);
+ String str(a->off_.str ());
+ scm_puts ((char *)str.ch_C(), p);
+ scm_display (a->func_, p);
+ scm_puts ("> ",p);
+ return 1;
+}
+
+IMPLEMENT_UNSMOB(Atom, atom)
+IMPLEMENT_SMOBS(Atom)
+