1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-18 00:10:04 +00:00
freebsd-ports/japanese/vfghostscript/files/gdevep82.patch

333 lines
11 KiB
Diff
Raw Normal View History

*** /dev/null Sun Aug 18 13:11:02 1996
--- drivers/gdevep82/gdevep82.c Sun Aug 18 18:24:05 1996
***************
*** 0 ****
--- 1,266 ----
+ /* Copyright (C) 1991 Aladdin Enterprises. All rights reserved.
+ Distributed by Free Software Foundation, Inc.
+
+ This file is part of Ghostscript.
+
+ Ghostscript is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY. No author or distributor accepts responsibility
+ to anyone for the consequences of using it or for whether it serves any
+ particular purpose or works at all, unless he says so in writing. Refer
+ to the Ghostscript General Public License for full details.
+
+ Everyone is granted permission to copy, modify and redistribute
+ Ghostscript, but only under the conditions described in the Ghostscript
+ General Public License. A copy of this license is supposed to have been
+ given to you along with Ghostscript so you can know your rights and
+ responsibilities. It should be in a file named COPYING. Among other
+ things, the copyright notice and this notice must be preserved on all
+ copies. */
+
+ /* gdevepag.c */
+ /* ESC/Page driver for Ghostscript */
+ #include "gdevprn.h"
+
+ #define EPAG300 1
+ #define EPAG600 2
+
+ /* cut from gdevpcl.h gdevmjc.c */
+ #define PAPER_SIZE_LETTER 2
+ #define PAPER_SIZE_LEGAL 3
+ #define PAPER_SIZE_A4 26
+ #define PAPER_SIZE_A3 27
+ #define PAPER_SIZE_A3_NOBI 28
+ #define PAPER_SIZE_A2 29
+ #define PAPER_SIZE_B4 30
+ #define PAPER_SIZE_B5 31
+
+ #define LINE_SIZE ((7016+7) / 8) /* bytes per line */
+
+ /* The device descriptors */
+ private dev_proc_print_page(epag300_print_page);
+ private dev_proc_print_page(epag600_print_page);
+
+ gx_device_printer gs_epag300_device =
+ prn_device(prn_std_procs, "epag300",
+ 83, /* width_10ths, 8.3" */
+ 117, /* height_10ths, 11.7" */
+ 300, 300,
+ 0.20, 0.20, 0.20, 0.20, /* margins, lbrt */
+ 1, epag300_print_page);
+
+ gx_device_printer gs_epag600_device =
+ prn_device(prn_std_procs, "epag600",
+ 83, /* width_10ths, 8.3" */
+ 117, /* height_10ths, 11.7" */
+ 600, 600,
+ 0.20, 0.20, 0.20, 0.20, /* margins, lbrt */
+ 1, epag600_print_page);
+
+ /* ------ Internal routines ------ */
+
+ #define ESC 0x1b
+ #define GS 0x1d
+ #define FS 0x1c
+ #define CSI 0233
+
+ static char can_inits300[] ={
+ GS, 'r', 'h', 'E', /* hard reset */
+ GS, '0', ';', '0', '.', '2', '4', 'm', 'u', 'E', /* <20>Ǿ<EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1/600' */
+ GS, '0', 'p', 'o', 'E', /* landscape */
+ GS, '1', 'm', 'm', 'E', /* <20>ڡ<EFBFBD><DAA1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2A1BC> */
+ GS, '0', ';', '3', '0', '0', ';', '3', '0', '0', 'd', 'r', 'E', /*<2A>ɥåȥѥ<C8A5><D1A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
+ GS, '3', 'b', 'c', 'I', /* <20><><EFBFBD>̷<EFBFBD><CCB7><EFBFBD> */
+ GS, '0', ';', '0', 'l', 'o', 'E' /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
+ };
+
+ static char can_inits600[] ={
+ GS, 'r', 'h', 'E', /* hard reset */
+ GS, '0', ';', '0', '.', '1', '2', 'm', 'u', 'E', /* <20>Ǿ<EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1/600' */
+ GS, '0', 'p', 'o', 'E', /* landscape */
+ GS, '1', 'm', 'm', 'E', /* <20>ڡ<EFBFBD><DAA1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2A1BC> */
+ GS, '0', ';', '6', '0', '0', ';', '6', '0', '0', 'd', 'r', 'E', /*<2A>ɥåȥѥ<C8A5><D1A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
+ GS, '3', 'b', 'c', 'I', /* <20><><EFBFBD>̷<EFBFBD><CCB7><EFBFBD> */
+ GS, '0', ';', '0', 'l', 'o', 'E' /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
+ };
+
+
+ private int
+ gdev_epag_paper_size(gx_device_printer *dev)
+ { return
+ (dev->height / dev->y_pixels_per_inch >= 22.2 ? PAPER_SIZE_A2 :
+ dev->height / dev->y_pixels_per_inch >= 18.0 ? PAPER_SIZE_A3_NOBI :
+ dev->height / dev->y_pixels_per_inch >= 16.0 ? PAPER_SIZE_A3 :
+ dev->height / dev->y_pixels_per_inch >= 13.6 ? PAPER_SIZE_B4 :
+ dev->height / dev->y_pixels_per_inch >= 11.8 ? PAPER_SIZE_LEGAL :
+ dev->height / dev->y_pixels_per_inch >= 11.1 ? PAPER_SIZE_A4 :
+ dev->height / dev->y_pixels_per_inch >= 10.4 ? PAPER_SIZE_LETTER :
+ PAPER_SIZE_LETTER);
+ }
+
+ /* Send the page to the printer. */
+ private int
+ epag_print_page(gx_device_printer *pdev, FILE *prn_stream, int ptype)
+ {
+ char data[LINE_SIZE*2];
+ char buf[LINE_SIZE*2];
+ char *out_data;
+ int out_count;
+ int c_size;
+ int paper_size;
+ char *ps, *pse;
+
+ #define GS_print(str) fprintf(prn_stream, str, GS)
+ #define GS_print_1(str,arg) fprintf(prn_stream, str, GS, arg)
+
+ /* initialize */
+ paper_size=gdev_epag_paper_size(pdev);
+ switch(paper_size){
+ case PAPER_SIZE_LETTER:
+ ps="";pse="14psE";break;
+ case PAPER_SIZE_LEGAL:
+ ps="";pse="14psE";break;
+ case PAPER_SIZE_A4:
+ ps="A4";pse="14psE";break;
+ case PAPER_SIZE_A3:
+ ps="A3";pse="13psE";break;
+ case PAPER_SIZE_A3_NOBI:
+ ps="A3";pse="13psE";break;
+ case PAPER_SIZE_A2:
+ ps="A2";pse="12psE";break;
+ case PAPER_SIZE_B4:
+ ps="B4";pse="24psE";break;
+ case PAPER_SIZE_B5:
+ ps="B5";pse="25psE";break;
+ }
+ sprintf(buf, "%cS%c%cS%c", ESC, ESC, ESC, FS); /* ESC/PS -> ESC/P */
+ sprintf(buf, "%cz%c%c", ESC, NULL, NULL); /* ESC/P -> ESC/Page */
+ sprintf(buf,"\033\001@EJL \012@EJL EN LA=ESC/PAGE\012\033\001@EJL \012@EJL SE LA=ESC/PAGE\012@EJL SET EC=ON RS=%s PU=%s PS=%s ZO=OFF FO=OFF\012@EJL EN LA=ESC/PAGE\012",
+ (ptype==EPAG300)?"QK":"FN",
+ "AU", /* "AU"..auto "2"..tray(maybe) "1"..casette1*/
+ ps
+ );
+ fwrite(buf, strlen(buf), 1, prn_stream);
+ switch(ptype) {
+ case EPAG300:
+ fwrite(can_inits300, sizeof(can_inits300), 1, prn_stream);
+ break;
+ case EPAG600:
+ fwrite(can_inits600, sizeof(can_inits300), 1, prn_stream);
+ break;
+ }
+ buf[0]=GS;
+ strcpy(buf+1,pse);
+ fwrite(buf, strlen(buf), 1, prn_stream);
+
+ /* Send each scan line in turn */
+ { int lnum;
+ int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ byte rmask = (byte)(0xff << (-pdev->width & 7));
+
+ for ( lnum = 0; lnum < pdev->height; lnum++ )
+ { char *end_data = data + line_size;
+ int s;
+
+ s = gdev_prn_copy_scan_lines(pdev, lnum,
+ (byte *)data, line_size);
+ /* Mask off 1-bits beyond the line width. */
+ end_data[-1] &= rmask;
+ /* Remove trailing 0s. */
+ while ( end_data > data && end_data[-1] == 0 )
+ end_data--;
+ if ( end_data != data ) {
+ int num_cols = 0;
+
+ out_data = data;
+ while(out_data < end_data && *out_data == 0) {
+ num_cols += 8;
+ out_data++;
+ }
+ out_count = end_data - out_data;
+
+ /* move down */
+ GS_print_1("%c%dY", lnum);
+ /* move across */
+ GS_print_1("%c%dX", num_cols);
+
+ /* <20><><EFBFBD><EFBFBD> */
+
+ c_size = data_compress_82(out_data, end_data, buf);
+
+ /* transfer raster graphics */
+ fprintf(prn_stream, "%c%d;%d;1;0bi{I",
+ GS, c_size, out_count * 8 );
+
+ /* send the row */
+ fwrite(buf, sizeof(char), c_size, prn_stream);
+ }
+ }
+ }
+ /* eject page */
+ fprintf(prn_stream, "\014");
+ fprintf(prn_stream, "%c1;0pmE", GS); /* ESC/Page -> ESC/P */
+ fprintf(prn_stream, "%cS%c%cSK", ESC, ESC, ESC); /* ESC/P -> ESC/PS */
+ return 0;
+ }
+
+ private int
+ epag300_print_page(gx_device_printer *pdev, FILE *prn_stream)
+ {
+ return epag_print_page(pdev, prn_stream, EPAG300);
+ }
+
+ private int
+ epag600_print_page(gx_device_printer *pdev, FILE *prn_stream)
+ {
+ return epag_print_page(pdev, prn_stream, EPAG600);
+ }
+
+
+
+ /*@fn data_compress_82(out_data, end_data, buf)
+ *@f1 <20>ǡ<EFBFBD><C7A1><EFBFBD><EFBFBD>򰵽̤<F2B0B5BD>buf<75>˽񤭹<CBBD><F1A4ADB9><EFBFBD>
+ *@fr <20><><EFBFBD≯<EFBFBD><CCB8>ΥХ<CEA5><D0A5>ȿ<EFBFBD><C8BF><EFBFBD><EFBFBD>֤<EFBFBD>
+ */
+ data_compress_82(out_data, end_data, buf)
+ char *out_data; /* <20><><EFBFBD>ǡ<EFBFBD><C7A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƭ<EFBFBD><C6AC><EFBFBD><EFBFBD> */
+ char *end_data; /* <20><><EFBFBD>ǡ<EFBFBD><C7A1><EFBFBD><EFBFBD>κǸ<CEBA><C7B8>ܣ<EFBFBD> */
+ char *buf; /* <20><><EFBFBD≯<EFBFBD><CCB8>Υǡ<CEA5><C7A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>񤭹<EFBFBD><F1A4ADB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
+ {
+ char *p; /* <20>ɤ߽Ф<DFBD><D0A4>ݥ<EFBFBD><DDA5><EFBFBD><EFBFBD><EFBFBD> */
+ char *q; /* <20>񤭹<EFBFBD><F1A4ADB9>ߥݥ<DFA5><DDA5><EFBFBD><EFBFBD><EFBFBD> */
+ int pdata; /* <20>Ǹ<EFBFBD><C7B8>˽񤭹<CBBD><F1A4ADB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǡ<EFBFBD><C7A1><EFBFBD> */
+ int cdata; /* <20><><EFBFBD>ܥǡ<DCA5><C7A1><EFBFBD> */
+ int count; /* <20>ǡ<EFBFBD><C7A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԡ<EFBFBD><D4A1>ȿ<EFBFBD> <20>ݣ<EFBFBD> */
+
+ p = out_data;
+ q = buf;
+ pdata = 9999; /* <20><EFBFBD>ư<EFBFBD><C6B0>פ<EFBFBD><D7A4>ʤ<EFBFBD><CAA4><EFBFBD><EFBFBD>ǡ<EFBFBD><C7A1><EFBFBD> */
+ count = 0;
+
+ while(p < end_data){
+ cdata = *p++;
+ if(cdata == pdata){ /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
+ count++;
+ if(count == 256){ /* <20>ǡ<EFBFBD><C7A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><20>ե<EFBFBD><D5A5>å<EFBFBD><C3A5><EFBFBD> */
+ *q++ = pdata;
+ *q++ = count - 1;
+ count = 0;
+ pdata = 9999; /* <20><EFBFBD>ư<EFBFBD><C6B0>פ<EFBFBD><D7A4>ʤ<EFBFBD><CAA4><EFBFBD><EFBFBD>ǡ<EFBFBD><C7A1><EFBFBD> */
+ }
+ }
+ else{ /* <20><><EFBFBD>Υǡ<CEA5><C7A1><EFBFBD><EFBFBD>Ȱ㤦 */
+ if(count > 0){ /* <20>ե<EFBFBD><D5A5>å<EFBFBD><C3A5><EFBFBD> */
+ *q++ = pdata;
+ *q++ = count-1;
+ count = 0;
+ }
+ *q++ = pdata = cdata;
+ }
+ }
+ if(count >0){ /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Υǡ<CEA5><C7A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĤäƤ<C3A4><C6A4><EFBFBD><EFBFBD><EFBFBD> */
+ *q++ = pdata; /* <20>ե<EFBFBD><D5A5>å<EFBFBD><C3A5><EFBFBD> */
+ *q++ = count - 1;
+ }
+ return(q-buf);
+ }
+
*** /dev/null Sun Aug 18 13:11:02 1996
--- drivers/gdevep82/gdevep82.jis Sun Aug 18 18:07:08 1996
***************
*** 0 ****
--- 1,40 ----
+
+ gdevep82.c - Epson LP-1700, LP-8200 (ESC/PS 300,600dpi)<29>ѥǥХ<C7A5><D0A5><EFBFBD><EFBFBD>ɥ饤<C9A5><E9A5A4>
+
+ <20><><EFBFBD><EFBFBD><EFBFBD>󥹥ȡ<F3A5B9A5><C8A1><EFBFBD><EFBFBD><EFBFBD>ˡ
+
+ 1. gdevep60.c <20><> gs261 <20>Υ<EFBFBD><CEA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ץ<EFBFBD><D7A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0A4AC><EFBFBD><EFBFBD><EFBFBD>ǥ<EFBFBD><C7A5><EFBFBD>ȥ<EFBFBD><C8A5>˥<EFBFBD><CBA5>ԡ<EFBFBD><D4A1><EFBFBD>
+ <20>Ʋ<EFBFBD><C6B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+
+ 2. Makefile <20><> gdevep60.mak <20><><EFBFBD>ɲä<C9B2><C3A4>Ʋ<EFBFBD><C6B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+
+ 3. Makefile <20><> DEVICE_DEVS <20><> epag300.dev(300dpi) epag600.dpi(600dpi)
+ <20><><EFBFBD>ä<EFBFBD><C3A4>Ʋ<EFBFBD><C6B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+
+ <20><>) DEVICE_DEVS=x11.dev epag300.dev epag600.dev
+ ^^^^^^^^^^^^^^^^^^^^^^^
+ 4. make <20><><EFBFBD>ޥ<EFBFBD><DEA5>ɤ<EFBFBD> gs <20>򥳥<EFBFBD><F2A5B3A5>ѥ<EFBFBD><D1A5><EFBFBD><EBA4B7><EFBFBD><EFBFBD><EFBFBD>󥹥ȡ<F3A5B9A5><C8A1><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+
+
+ <20><><EFBFBD>Ȥ<EFBFBD><C8A4><EFBFBD>
+
+ <20><><EFBFBD>ǥХ<C7A5><D0A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -sDEVICE <20><><EFBFBD>ץ<EFBFBD><D7A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˤ<EFBFBD><CBA4>äƹԤʤ<D4A4><CAA4>ޤ<EFBFBD><DEA4><EFBFBD>
+
+ <20><>) 300dpi<70>ξ<EFBFBD><CEBE>硢 gs -sDEVICE=epag300
+ 600dpi<70>ξ<EFBFBD><CEBE><EFBFBD> gs -sDEVICE=epag600
+
+ <20><><EFBFBD>ݥ<EFBFBD><DDA5>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ץȥ<D7A5><C8A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˥ڡ<CBA5><DAA1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǽ<EFBFBD><C7BD><EFBFBD><EFBFBD><EFBFBD>äƤ<C3A4><C6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>ưŪ<C6B0>ˡ<EFBFBD>
+ ̵<><CCB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϥ<EFBFBD><CFA4>Τ<CEA4>ˤ<EFBFBD><CBA4><EFBFBD><EFBFBD>ѻ極<D1BB><E6A5B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǥ<EFBFBD><C7A4>ޤ<EFBFBD><DEA4><EFBFBD>
+
+ <20><>) A3,300dpi<70>ξ<EFBFBD><CEBE>硢 gs -sDEVICE=epag300 -SPAPERSIZE=a3
+ B4,600dpi<70>ξ<EFBFBD><CEBE>硢 gs -sDEVICE=epag600 -SPAPERSIZE=B4
+
+ <09><><EFBFBD>ĵ<EFBFBD>Ϻ (mita@hoh.t.u-tokyo.ac.jp)
+
+ <20><> <20><><EFBFBD><EFBFBD>ESC/PS<50>ɥ饤<C9A5>С<EFBFBD><D0A1><EFBFBD> Tom Quinn<6E><6E>(trq@prg.oxford.ac.uk)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
+ lbp8<70>ѥɥ饤<C9A5>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>(nari@lsi.tmg.nec.co.jp)<29><>ESC/Page<67>Ѥ<EFBFBD>
+ <20><>¤<EFBFBD><C2A4><EFBFBD><EFBFBD>ʪ<EFBFBD><CAAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> δ<><CEB4><EFBFBD><EFBFBD>(irita@hoh.t.u-tokyo.ac.jp)<29>Ȼ<EFBFBD><C8BB>ĤȤ<C4A4>
+ ESC/PS<50><EFBFBD>ɤβ<C9A4><CEB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>򡢥ڡ<F2A1A2A5><DAA1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǽ<EFBFBD><C7BD><EFBFBD>ղä<D5B2><C3A4><EFBFBD>ʪ<EFBFBD>Ǥ<EFBFBD><C7A4><EFBFBD>
+ <20>ѻ<EFBFBD><D1BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>β<EFBFBD>¤<EFBFBD><C2A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>äƤϡ<C6A4><CFA1><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><EEA4B5><EFBFBD>Ρ<EFBFBD>gdevmjc<6A>򻲹ͤˤ<CDA4><CBA4><EFBFBD><EFBFBD><EFBFBD>
+ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD>
+
*** /dev/null Sun Aug 18 13:11:02 1996
--- drivers/gdevep82/gdevep82.mak Sun Aug 18 18:07:08 1996
***************
*** 0 ****
--- 1,11 ----
+ ### ------ The Epson LP-8200 (ESC/PS 300/600dpi) printer device ------- ###
+
+ epag82_=gdevep82.$(OBJ) gdevprn.$(OBJ)
+ epag300.dev: $(epag82_)
+ $(SHP)gssetdev epag300 $(epag82_)
+
+ epag600.dev: $(epag82_)
+ $(SHP)gssetdev epag600 $(epag82_)
+
+ gdevep82.$(OBJ): gdevep82.c $(PDEVH)
+