lilypond-1.3.69
[lilypond.git] / lily / tex-outputter.cc
blob89ebf316237399c3cc5afa0fc84c70e44b287b3e
1 /*
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>
7 Jan Nieuwenhuizen <janneke@gnu.org>
8 */
10 #include "tex-outputter.hh"
11 #include "tex-stream.hh"
12 #include "molecule.hh"
13 #include "atom.hh"
14 #include "array.hh"
15 #include "string-convert.hh"
16 #include "debug.hh"
18 Tex_outputter::Tex_outputter (Paper_stream *s)
19 :Paper_outputter (s)
23 Tex_outputter::~Tex_outputter ()
28 26 fonts ought to be enough for anyone.
30 static String
31 tex_font_command(int i)
33 return "\\font" +String_convert::form_str ("%c", 'A' + i) ;
36 void
37 Tex_outputter::switch_to_font (String fontname)
39 if (!fontname.length_i () || fontname == current_font_)
40 return;
42 current_font_ = fontname;
43 int i=0;
44 for (; i< font_arr_.size (); i++)
45 if (font_arr_[i] == fontname)
47 *outstream_l_ <<tex_font_command (i) << "\n";
48 return ;
52 font_arr_.push (fontname);
53 *outstream_l_ << "\\font" + tex_font_command (i) << "=" + fontname << "\n";
54 *outstream_l_<< tex_font_command (i);
57 void
58 Tex_outputter::output_molecule (Molecule const*m, Offset o, char const *nm)
60 if (check_debug)
61 *outstream_l_ << String ("\n%start: ") << nm << "\n";
63 Paper_outputter::output_molecule (m, o, nm, "\\placebox{%}{%}{%}");
66 void
67 Tex_outputter::start_line ()
69 *outstream_l_ << "\\hbox{%\n";
72 void
73 Tex_outputter::stop_line ()
75 *outstream_l_ << "}";
76 *outstream_l_ << "\\interscoreline";
77 current_font_ = "";
78 font_arr_.clear ();