taraijpn
5/31/2017 - 7:13 PM

e2ps-4.34修正パッチ(ページ数カウント誤りの修正、EPS記述の除去、用紙サイズ修正)

e2ps-4.34修正パッチ(ページ数カウント誤りの修正、EPS記述の除去、用紙サイズ修正)

diff -urN e2ps-4.34.orig/e2ps.c e2ps-4.34/e2ps.c
--- e2ps-4.34.orig/e2ps.c	2002-08-21 17:50:02.000000000 +0900
+++ e2ps-4.34/e2ps.c	2018-03-05 22:56:40.642873373 +0900
@@ -330,7 +330,7 @@
       giHeight = A4HEIGHT;
     }
     else if ( strcmp(argv[i], "-b4") == 0 ) {
-      /* B4 */
+      /* JIS B4 */
       strcpy(sPaper, "B4");
       giWidth = B4WIDTH;
       giHeight = B4HEIGHT;
@@ -485,19 +485,11 @@
       /* Print Font List */
       if ( guJapanese ) {
 	printf("\n�ե���ȥꥹ��\n");
-	printf("%s", ps_font(NULL, NULL));
-	/*  printf("Ryumin-Light-H\n"); */
-	/*  printf("Ryumin-Light-H-Italic\n"); */
-	/*  printf("Ryumin-Light-EUC-H\n"); */
-	/*  printf("Ryumin-Light-EUC-H-Italic\n"); */
-	/*  printf("GothicBBB-Medium-H\n"); */
-	/*  printf("GothicBBB-Medium-H-Italic\n"); */
-	/*  printf("GothicBBB-Medium-EUC-H\n"); */
-	/*  printf("GothicBBB-Medium-EUC-H-Italic\n\n"); */
       }
       else {
 	printf("\nFont Lists\n");
-	printf("%s", ps_font(NULL, NULL));
+      }
+        printf("%s\n", ps_font(NULL, NULL));
 	/*  printf("Ryumin-Light-H\n"); */
 	/*  printf("Ryumin-Light-H-Italic\n"); */
 	/*  printf("Ryumin-Light-EUC-H\n"); */
@@ -506,7 +498,6 @@
 	/*  printf("GothicBBB-Medium-H-Italic\n"); */
 	/*  printf("GothicBBB-Medium-EUC-H\n"); */
 	/*  printf("GothicBBB-Medium-EUC-H-Italic\n\n"); */
-      }
       exit(0);
     }
     else if ( strcmp(argv[i], "-lib") == 0 ) {
@@ -630,7 +621,7 @@
 
   /* Start Input and Output */
   /* Header */
-  fprintf(gpfOut, "%%!PS-Adobe-2.0 EPSF-1.2\n");
+  fprintf(gpfOut, "%%!PS-Adobe-2.0\n");
   fprintf(gpfOut, "%%%%Title:");
   for ( iFileNum = 0 ; iFileNum < iFiles ; iFileNum++ ) {
     fprintf(gpfOut, " %s", sFileNames[iFileNum]);
@@ -642,6 +633,7 @@
   fprintf(gpfOut, "%%%%PageOrder: Ascend\n");
   fprintf(gpfOut, "%%%%DocumentPaperSizes: %s\n", sPaper);
   fprintf(gpfOut, "%%%%Orientation: Portrait\n");
+  fprintf(gpfOut, "%%%%DocumentMedia: %s %d %d 64 white () \n", sPaper, giWidth, giHeight);
 #ifdef	TEKTRO
   /* Number of paper */
   fprintf(gpfOut, "%%%%Requirements: numcopies(%d) collate\n", uCopy);
@@ -652,14 +644,18 @@
   fprintf(gpfOut, "/#copies %d def\n\n", uCopy);
   /* Both side */
   if ( uDup ) {
-    fprintf(gpfOut, "[{\n");
-    fprintf(gpfOut, "%%%%BeginFeature: *Duplex DuplexTumble\n\n");
+    fprintf(gpfOut, "{\n");
+    fprintf(gpfOut, "%%%%BeginFeature: *Duplex DuplexTumble\n");
     fprintf(gpfOut, "        <</Duplex true /Tumble false>> setpagedevice\n");
     fprintf(gpfOut, "%%%%EndFeature\n");
     fprintf(gpfOut, "} stopped cleartomark\n\n");
   }
 #endif
 
+  /* Set %%BeginSetup */
+  fprintf(gpfOut, "\n%%%%BeginSetup\n");
+
+  
   /* Set Fonts */
   fprintf(gpfOut, "/A-R { /%s findfont %.2f scalefont [1 0 0 1 0 0.12] makefont setfont } bind def\n", gsAsciiFont, gfFontSize);
   fprintf(gpfOut, "/A-B { /%s findfont %.2f scalefont [1 0 0 1 0 0.12] makefont setfont } bind def\n", gsBoldAsciiFont, gfFontSize);
@@ -730,6 +726,9 @@
   }
   fprintf(gpfOut, "\n\n");
 
+  /* Set %%EndSetup */
+  fprintf(gpfOut, "%%%%EndSetup\n\n");
+  
   /* Page */
   giPsPage = 0;
   
@@ -917,7 +916,7 @@
     free(sFileData);
   }
   /* Finish */
-  fprintf(gpfOut, "%%%%Trailer\n");
+  fprintf(gpfOut, "%%%%Trailer\n\n%%%%EOF\n");
 
   if ( uLpr ) {
     pclose(gpfOut);
@@ -931,7 +930,7 @@
     fprintf(stderr, "%% %d �ڡ������Ϥ��ޤ���\n", giPsPage);
   }
   else {
-    if ( giPsPage == 1 ) {
+    if ( giPsPage != 1 ) {
       fprintf(stderr, "%% %d pages were outputed.\n", giPsPage);
     }
     else {
@@ -1675,7 +1674,7 @@
     fprintf(stderr, "    -ls nlrate                : space ratio between lines (%0.1f)\n", NLRATE);
     fprintf(stderr, "    -line line                : max lines (%d)\n", MAXLINE);
     fprintf(stderr, "    -a4                       : A4 paper (default)\n");
-    fprintf(stderr, "    -b4                       : B4 paper\n");
+    fprintf(stderr, "    -b4                       : JIS B4 paper\n");
     fprintf(stderr, "    -le                       : letter paper\n");
     fprintf(stderr, "    -ohp                      : OHP printing (font size:%0.1f)\n", OHPFONTSIZE);
     fprintf(stderr, "    -box                      : print page frame-line (looks like a2ps)\n");
diff -urN e2ps-4.34.orig/e2ps.h e2ps-4.34/e2ps.h
--- e2ps-4.34.orig/e2ps.h	2002-08-21 17:50:05.000000000 +0900
+++ e2ps-4.34/e2ps.h	2018-03-05 22:54:38.926873197 +0900
@@ -31,12 +31,13 @@
 #define	ESC			(0x1b)			/* Escape */
 
 /* Paper */
-#define A4WIDTH			(594)
-#define	A4HEIGHT		(840)
+#define A4WIDTH			(595)
+#define	A4HEIGHT		(842)
 #define LEWIDTH			(612)
-#define LEHEIGHT		(796)
-#define B4WIDTH			(730)
-#define	B4HEIGHT		(1030)
+#define LEHEIGHT		(792)
+/* JIS B4*/
+#define B4WIDTH			(729)
+#define	B4HEIGHT		(1032)
 
 /* sqrt(0.5) */
 #define	SQRT			(0.707106781186548)
diff -urN e2ps-4.34.orig/ps-font.c e2ps-4.34/ps-font.c
--- e2ps-4.34.orig/ps-font.c	2002-02-05 00:25:38.000000000 +0900
+++ e2ps-4.34/ps-font.c	2018-03-05 22:50:36.281873074 +0900
@@ -11,46 +11,7 @@
 #include	"e2ps.h"
 
 
-char *gsFonts = "Times-Roman
-Times-Italic
-Times-Bold
-Times-BoldItalic
-Helvetica
-Helvetica-Oblique
-Helvetica-Bold
-Helvetica-BoldOblique
-Courier
-Courier-Oblique
-Courier-Bold
-Courier-BoldOblique
-Symbol
-AvantGarde-Book
-AvantGarde_BookOblique
-AvantGarde_Demi
-AvantGarde_DemiOblique
-Bookman-Light
-Bookman-LightItalic
-Bookman-Demi
-Bookman-DemiItalic
-Helvetica-Narrow
-Helvetica-Narrow-Oblique
-Helvetica-Narrow-Bold
-Helvetica-Narrow-BoldObliqeu
-NewCenturySchlbl-Roman
-NewCenturySchlbl-Italic
-NewCenturySchlbl-Bold
-NewCenturySchlbl-BoldItalic
-Palatino-Roman
-Palatino-Italic
-Palatino-Bold
-Palatino-BoldItalic
-Zapfchancery-MediumItalic
-ZapfDingbats
-Ryumin-Light.Hiragana
-Ryumin-Light.Katakana
-Gothic-Meduim.Hiragana
-Gothic-Medium.Katakana
-";
+char *gsFonts = "Times-Roman Times-Italic Times-Bold Times-BoldItalic Helvetica Helvetica-Oblique Helvetica-Bold Helvetica-BoldOblique Courier Courier-Oblique Courier-Bold Courier-BoldOblique Symbol AvantGarde-Book AvantGarde_BookOblique AvantGarde_Demi AvantGarde_DemiOblique Bookman-Light Bookman-LightItalic Bookman-Demi Bookman-DemiItalic Helvetica-Narrow Helvetica-Narrow-Oblique Helvetica-Narrow-Bold Helvetica-Narrow-BoldObliqeu NewCenturySchlbl-Roman NewCenturySchlbl-Italic NewCenturySchlbl-Bold NewCenturySchlbl-BoldItalic Palatino-Roman Palatino-Italic Palatino-Bold Palatino-BoldItalic Zapfchancery-MediumItalic ZapfDingbats Ryumin-Light.Hiragana Ryumin-Light.Katakana Gothic-Meduim.Hiragana Gothic-Medium.Katakana ";
 
 
 /* Set PostScript Font Width */