2 tex-outputter.cc -- implement Tex_outputter
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "tex-outputter.hh"
10 #include "tex-stream.hh"
11 #include "molecule.hh"
14 #include "dimension.hh"
16 #include "string-convert.hh"
19 Tex_outputter::Tex_outputter (Tex_stream *s)
25 26 fonts ought to be enough for anyone.
28 tex_font_command(int i)
30 return "\\font" +String_convert::form_str ("%c", 'A' + i) ;
34 Tex_outputter::switch_to_font (String fontname)
36 if (!fontname.length_i () || fontname == current_font_)
39 current_font_ = fontname;
41 for (; i< font_arr_.size (); i++)
42 if (font_arr_[i] == fontname)
44 *outstream_l_ <<tex_font_command (i) << "\n";
49 font_arr_.push (fontname);
50 *outstream_l_ << "\\font" + tex_font_command (i) << "=" + fontname << "\n";
51 *outstream_l_<< tex_font_command (i);
55 Tex_outputter::output_molecule (Molecule const*m, Offset o, char const *nm)
58 *outstream_l_ << String ("\n%start: ") << nm << "\n";
60 for (PCursor <Atom*> i (m->atoms_); i.ok (); i++)
62 Offset a_off = i->offset ();
65 switch_to_font (i->font_);
71 String s ("\\placebox{%}{%}{%}");
72 a.push (print_dimen (a_off.y()));
73 a.push (print_dimen (a_off.x()));
75 r += substitute_args (s, a);
82 Tex_outputter::start_line ()
84 *outstream_l_ << "\\hbox{%\n";
88 Tex_outputter::stop_line ()
91 *outstream_l_ << "\\interscoreline";