b7f097
diff -pruN paps-0.6.8.orig/src/libpaps.c paps-0.6.8/src/libpaps.c
b7f097
--- paps-0.6.8.orig/src/libpaps.c	2008-05-14 23:07:14.000000000 +0900
b7f097
+++ paps-0.6.8/src/libpaps.c	2008-05-14 23:11:12.000000000 +0900
b7f097
@@ -118,7 +118,6 @@ gchar *paps_get_postscript_header_strdup
b7f097
     gchar *ret_str;
b7f097
     g_string_append_printf(paps->header,
b7f097
 			   "end end\n"
b7f097
-			   "%%%%EndPrologue\n"
b7f097
 			   );
b7f097
     ret_str = g_strdup(paps->header->str);
b7f097
     g_string_truncate(paps->header, old_len);
b7f097
@@ -247,7 +246,6 @@ static void
b7f097
 add_postscript_prologue(paps_private_t *paps)
b7f097
 {
b7f097
   g_string_append_printf(paps->header,
b7f097
-			 "%%%%BeginProlog\n"
b7f097
 			 "/papsdict 1 dict def\n"
b7f097
 			 "papsdict begin\n"
b7f097
 			 "\n"
b7f097
@@ -272,10 +270,10 @@ add_postscript_prologue(paps_private_t *
b7f097
 			 "/start_ol { gsave } bind def\n"
b7f097
 			 "/end_ol { closepath fill grestore } bind def\n"
b7f097
 			 /* Specify both x and y. */
b7f097
-			 "/draw_char { fontdict begin gsave %f dup scale last_x last_y translate load exec end grestore} def\n"
b7f097
-			 "/goto_xy { fontdict begin /last_y exch def /last_x exch def end } def\n"
b7f097
-			 "/goto_x { fontdict begin /last_x exch def end } def\n"
b7f097
-			 "/fwd_x { fontdict begin /last_x exch last_x add def end } def\n"
b7f097
+			 "/draw_char { fontdict begin gsave %f dup scale last_x cvi last_y cvi translate load exec end grestore} def\n"
b7f097
+			 "/goto_xy { fontdict begin /last_y exch string_y cvs def /last_x exch string_x cvs def end } def\n"
b7f097
+			 "/goto_x { fontdict begin /last_x exch string_x cvs def end } def\n"
b7f097
+			 "/fwd_x { fontdict begin /last_x exch last_x cvi add string_x cvs def end } def\n"
b7f097
 			 "/c /curveto load def\n"
b7f097
 			 "/x /conicto load def\n"
b7f097
 			 "/l /lineto load def\n"
b7f097
@@ -344,7 +342,7 @@ add_postscript_prologue(paps_private_t *
b7f097
 
b7f097
   /* Open up dictionaries */
b7f097
   g_string_append(paps->header,
b7f097
-		  "/fontdict 1 dict def\n"
b7f097
+		  "/fontdict 1 dict dup begin 16 string dup /string_x exch def /last_x exch def 16 string dup /string_y exch def /last_y exch def end def\n"
b7f097
 		  "papsdict begin fontdict begin\n");
b7f097
 }
b7f097
 
b7f097
diff -pruN paps-0.6.8.orig/src/paps.c paps-0.6.8/src/paps.c
b7f097
--- paps-0.6.8.orig/src/paps.c	2008-05-14 23:07:14.000000000 +0900
b7f097
+++ paps-0.6.8/src/paps.c	2008-05-14 23:12:53.000000000 +0900
b7f097
@@ -659,7 +659,7 @@ int main(int argc, char *argv[])
b7f097
   fprintf(OUT, "%s", paps_header);
b7f097
   g_free(paps_header);
b7f097
 
b7f097
-  fprintf(OUT, "%%%%EndPrologue\n");
b7f097
+  fprintf(OUT, "%%%%EndSetup\n");
b7f097
   fprintf(OUT, "%s", ps_pages_string->str);
b7f097
   print_postscript_trailer(OUT, num_pages);
b7f097
 
b7f097
@@ -1089,8 +1089,9 @@ void print_postscript_header(FILE *OUT,
b7f097
           "%%%%Creator: paps version 0.6.7 by Dov Grobgeld\n"
b7f097
           "%%%%Pages: (atend)\n"
b7f097
           "%%%%BoundingBox: 0 0 %d %d\n%s"
b7f097
-          "%%%%BeginProlog\n"
b7f097
           "%%%%Orientation: %s\n"
b7f097
+          "%%%%EndComments\n"
b7f097
+          "%%%%BeginProlog\n"
b7f097
           "/papsdict 1 dict def\n"
b7f097
           "papsdict begin\n"
b7f097
           "\n"
b7f097
@@ -1134,7 +1135,8 @@ void print_postscript_header(FILE *OUT,
b7f097
           "/turnpage {\n"
b7f097
           "  90 rotate\n"
b7f097
           "  0 pageheight neg translate\n"
b7f097
-          "} def\n",
b7f097
+          "} def\n"
b7f097
+          "%%%%EndProlog\n",
b7f097
 	  /*
b7f097
 	   * Put %%cupsRotation tag to prevent the rotation in pstops.
b7f097
 	   * This breaks paps's behavior to make it in landscape say.
b7f097
@@ -1150,6 +1152,7 @@ void print_postscript_header(FILE *OUT,
b7f097
   g_free(owner);
b7f097
   
b7f097
   fprintf(OUT,
b7f097
+          "%%%%BeginSetup\n"
b7f097
           "%% User settings\n"
b7f097
           "/pagewidth %d def\n"
b7f097
           "/pageheight %d def\n"
b7f097
@@ -1232,8 +1235,8 @@ void print_postscript_trailer(FILE *OUT,
b7f097
                              int num_pages)
b7f097
 {
b7f097
   fprintf(OUT,
b7f097
-          "%%%%Pages: %d\n"
b7f097
           "%%%%Trailer\n"
b7f097
+          "%%%%Pages: %d\n"
b7f097
           "%%%%EOF\n",
b7f097
           num_pages
b7f097
           );