]> git.donarmstrong.com Git - lilypond.git/blob - lily/ps-outputter.cc
d0ad70ef39045c954d357af0b5a73dc3328238b2
[lilypond.git] / lily / ps-outputter.cc
1 /*
2   ps-outputter.cc -- implement Ps_outputter
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   Jan Nieuwenhuizen <janneke@gnu.org>
8 */
9
10 #include "ps-outputter.hh"
11 #include "ps-stream.hh"
12 #include "molecule.hh"
13 #include "atom.hh"
14 #include "array.hh"
15 #include "string-convert.hh"
16 #include "debug.hh"
17
18 Ps_outputter::Ps_outputter (Paper_stream *s)
19   :Paper_outputter (s)
20 {
21 }
22
23 Ps_outputter::~Ps_outputter ()
24 {
25 }
26
27 /*
28    26 fonts ought to be enough for anyone.
29 */
30 static String
31 ps_font_command(int i)
32 {
33 // urg
34 //  return "%\\font" + String_convert::form_str ("%c",  'A' + i) + "\n";
35   return "\n/feta20 findfont 12 scalefont setfont ";
36 }
37
38 void
39 Ps_outputter::switch_to_font (String fontname)
40 {
41   if (!fontname.length_i () || fontname == current_font_)
42     return;
43
44   current_font_ = fontname;
45   int i=0;
46   for (; i< font_arr_.size (); i++)
47     if (font_arr_[i] == fontname)
48       {
49         *outstream_l_ <<ps_font_command (i) << "\n";
50         return ;
51       }
52
53   
54   font_arr_.push (fontname);
55   *outstream_l_ << "%\\font"  + ps_font_command (i) << "% =" + fontname << "\n";
56   *outstream_l_<< ps_font_command (i) << "\n";
57 }
58
59 void
60 Ps_outputter::output_molecule (Molecule const*m, Offset o, char const *nm)
61 {
62   if (check_debug)
63     *outstream_l_ << String ("\n%start: ") << nm << "\n";
64
65   Paper_outputter::output_molecule (m, o, nm, "% % {%}placebox \n");
66 }
67
68 void
69 Ps_outputter::start_line ()
70 {
71   *outstream_l_ << "\nstart_line {\n";
72 }
73
74 void
75 Ps_outputter::stop_line ()
76 {
77   *outstream_l_ << "}\nstop_line\n";
78   current_font_ = "";
79   font_arr_.clear ();
80 }