#include "ps-lookup.hh"
#include "debug.hh"
+#include "dimensions.hh"
#include "symtable.hh"
-#include "dimension.hh"
-#include "tex.hh"
#include "scalar.hh"
#include "paper-def.hh"
#include "string-convert.hh"
#include "main.hh"
+#include "file-results.hh"
+#include "header.hh"
+#include "paper-stream.hh"
+#include "ps-stream.hh"
+#include "ps-outputter.hh"
Ps_lookup::Ps_lookup ()
: Lookup ()
Atom
Ps_lookup::afm_find (String s) const
{
- return Lookup::afm_find (s, String ("(%d)"));
+ return Lookup::afm_find (s, String ("(\\%03o) show "));
+}
+
+Atom*
+Ps_lookup::atom_p (String s, int n, Box b) const
+{
+ for (int i = 0; i < n; i++)
+ s.prepend ("% ");
+ return new Atom (s, b);
+}
+
+String
+Ps_lookup::character_str (int i) const
+{
+ return to_str (i, "(\\%03o)");
}
Atom
ps += "[" + String_convert::double_str (on) + " ";
ps += String_convert::double_str (off) + "] ";
ps += String_convert::int_str (0) + " ";
- ps += " draw_dashed_slur";
+ ps += "draw_dashed_slur ";
Atom a;
a.str_ = ps;
return a;
}
+Lookup*
+Ps_lookup::lookup_p (Lookup const& l) const
+{
+ return new Ps_lookup (l);
+}
+
+Lookup*
+Ps_lookup::lookup_p (Symtables const& s) const
+{
+ return new Ps_lookup (s);
+}
+
+Paper_outputter*
+Ps_lookup::paper_outputter_p (Paper_stream* os_p, Paper_def* paper_l, Header* header_l, String origin_str) const
+{
+ if (header_global_p)
+ *os_p << header_global_p->ps_string ();
+
+ *os_p << _ ("\n% outputting Score, defined at: ") << origin_str << '\n';
+
+ if (header_l)
+ *os_p << header_l->ps_string ();
+ *os_p << paper_l->ps_output_settings_str ();
+
+ if (experimental_features_global_b)
+ *os_p << "turnOnExperimentalFeatures\n";
+
+ return new Ps_outputter (os_p);
+}
+
+Paper_stream*
+Ps_lookup::paper_stream_p () const
+{
+#if 1
+ String outname = base_output_str ();
+#else
+ String outname = "lelie";
+#endif
+
+ if (outname != "-")
+ outname += ".ps";
+ *mlog << _f ("PostScript output to %s...",
+ outname == "-" ? String ("<stdout>") : outname ) << endl;
+ target_str_global_array.push (outname);
+ return new Ps_stream (outname);
+}
+
Atom
Ps_lookup::plet (Real dy , Real dx, Direction dir) const
{
ps += String_convert::double_str (dx) + " "
+ String_convert::double_str (dy) + " "
+ String_convert::int_str ( (int)dir) +
- " draw_plet";
+ " draw_plet ";
Atom s;
s.str_ = ps;
{
String ps;
ps += to_str (width) + " "+ to_str (slope) + " " + to_str (thick)
- + " draw_beam";
+ + " draw_beam ";
Atom s;
s.str_ = ps;
ps += String_convert::double_str (controls[0].x ()) + " "
+ String_convert::double_str (controls[0].y ()) + " ";
- ps += " draw_slur";
+ ps += " draw_slur ";
Atom s;
s.str_ = ps;
Atom
Ps_lookup::stem (Real y1, Real y2) const
{
- // return Lookup::stem (y1, y2, "\\kern %\\vrule width % height % depth %");
- return Lookup::stem (y1, y2, "% % moveto % % lineto");
+ return Lookup::stem (y1, y2, "\n% % % % draw_stem ");
+}
+
+Atom
+Ps_lookup::text (String style, String text) const
+{
+ return Lookup::text (style, "(" + text + ")");
+}
+
+String
+Ps_lookup::unknown_str () const
+{
+ return "unknown ";
}
Atom
+ " " + _ ("too small") + " (" + print_dimen (y) + ")");
// y = min_y;
}
- psbracket.str_ = to_str (y) + " draw_bracket";
+ psbracket.str_ = to_str (y) + " draw_bracket ";
psbracket.dim_[Y_AXIS] = Interval (-y/2,y/2);
psbracket.dim_[X_AXIS] = Interval (0,4 PT);
return psbracket;