]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/ps-lookup.cc
release: 1.0.14
[lilypond.git] / lily / ps-lookup.cc
index fd9d8873509afc2e56e478f04f17ded4356fabb5..f488b5e92a31358f17b14463e79472a0b44ca9ac 100644 (file)
@@ -8,13 +8,17 @@
 
 #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 ()
@@ -38,7 +42,21 @@ Ps_lookup::~Ps_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
@@ -64,7 +82,7 @@ Ps_lookup::dashed_slur (Array<Offset> controls, Real thick, Real dash) const
   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;
@@ -94,6 +112,53 @@ Ps_lookup::hairpin (Real width, bool decresc, bool continued) const
   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
 {
@@ -102,7 +167,7 @@ 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;
@@ -114,7 +179,7 @@ Ps_lookup::ps_beam (Real slope, Real width, Real thick) const
 {
   String ps;
   ps += to_str (width) + " "+ to_str (slope) + " " + to_str (thick)
-    + " draw_beam";
+    + " draw_beam ";
 
   Atom s;
   s.str_ = ps;
@@ -145,7 +210,7 @@ Ps_lookup::slur (Array<Offset> controls) const
   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;
@@ -159,8 +224,19 @@ Ps_lookup::slur (Array<Offset> controls) const
 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
@@ -174,7 +250,7 @@ Ps_lookup::vbracket (Real &y) const
        + " " + _ ("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;