10
10
or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134,
11
11
San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
13
/* $Id: gdevlbp8.c 11097 2010-04-21 18:12:56Z robin $*/
14
14
/* Canon LBP-8II and LIPS III driver */
15
15
#include "gdevprn.h"
19
19
2.2.97 Lauri Paatero
20
20
Changed CSI command into ESC [. DCS commands may still need to be changed
22
22
4.9.96 Lauri Paatero
23
Corrected LBP-8II margins again. Real problem was that (0,0) is NOT
23
Corrected LBP-8II margins again. Real problem was that (0,0) is NOT
24
24
in upper left corner.
25
Now using relative addressing for vertical addressing. This avoids
25
Now using relative addressing for vertical addressing. This avoids
27
27
when printing to paper with wrong size.
28
28
18.6.96 Lauri Paatero, lauri.paatero@paatero.pp.fi
50
49
const gx_device_printer far_data gs_lbp8_device =
51
50
prn_device(prn_std_procs, "lbp8",
52
DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
54
0.16, 0.2, 0.32, 0.21, /* margins: left, bottom, right, top */
51
DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
53
0.16, 0.2, 0.32, 0.21, /* margins: left, bottom, right, top */
58
57
const gx_device_printer far_data gs_lips3_device =
59
58
prn_device(prn_std_procs, "lips3",
60
82, /* width_10ths, 8.3" */
61
117, /* height_10ths, 11.7" */
63
0.16, 0.27, 0.23, 0.27, /* margins */
59
82, /* width_10ths, 8.3" */
60
117, /* height_10ths, 11.7" */
62
0.16, 0.27, 0.23, 0.27, /* margins */
67
66
/* ------ Internal routines ------ */
77
76
ESC, '[', '1', '4', 'p', /* select page type (A4) */
78
77
ESC, '[', '1', '1', 'h', /* set mode */
79
78
ESC, '[', '7', ' ', 'I', /* select unit size (300dpi)*/
80
ESC, '[', '6', '3', 'k', /* Move 63 dots up (to top of printable area) */
79
ESC, '[', '6', '3', 'k', /* Move 63 dots up (to top of printable area) */
104
103
can_print_page(gx_device_printer *pdev, FILE *prn_stream,
105
104
const char *init, int init_size, const char *end, int end_size)
107
char data[LINE_SIZE*2];
109
int last_line_nro = 0;
111
fwrite(init, init_size, 1, prn_stream); /* initialize */
113
/* Send each scan line in turn */
116
int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
117
byte rmask = (byte)(0xff << (-pdev->width & 7));
119
for ( lnum = 0; lnum < pdev->height; lnum++ ) {
120
char *end_data = data + LINE_SIZE;
121
gdev_prn_copy_scan_lines(pdev, lnum,
122
(byte *)data, line_size);
123
/* Mask off 1-bits beyond the line width. */
124
end_data[-1] &= rmask;
125
/* Remove trailing 0s. */
126
while ( end_data > data && end_data[-1] == 0 )
128
if ( end_data != data ) {
135
fprintf(prn_stream, "%c[%de",
136
ESC, lnum-last_line_nro );
137
last_line_nro = lnum;
139
while (out_data < end_data) {
140
/* Remove leading 0s*/
141
while(out_data < end_data && *out_data == 0) {
106
char data[LINE_SIZE*2];
108
int last_line_nro = 0;
110
fwrite(init, init_size, 1, prn_stream); /* initialize */
112
/* Send each scan line in turn */
115
int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
116
byte rmask = (byte)(0xff << (-pdev->width & 7));
118
for ( lnum = 0; lnum < pdev->height; lnum++ ) {
119
char *end_data = data + LINE_SIZE;
120
gdev_prn_copy_scan_lines(pdev, lnum,
121
(byte *)data, line_size);
122
/* Mask off 1-bits beyond the line width. */
123
end_data[-1] &= rmask;
124
/* Remove trailing 0s. */
125
while ( end_data > data && end_data[-1] == 0 )
127
if ( end_data != data ) {
134
fprintf(prn_stream, "%c[%de",
135
ESC, lnum-last_line_nro );
136
last_line_nro = lnum;
138
while (out_data < end_data) {
139
/* Remove leading 0s*/
140
while(out_data < end_data && *out_data == 0) {
146
out_count = end_data - out_data;
149
/* if there is a lot data, find if there is sequence of zeros */
154
while(out_data+out_count+zero_count < end_data) {
155
if (out_data[zero_count+out_count] != 0) {
156
out_count += 1+zero_count;
171
/* move down and across*/
172
fprintf(prn_stream, "%c[%d`",
174
/* transfer raster graphic command */
175
fprintf(prn_stream, "%c[%d;%d;300;.r",
176
ESC, out_count, out_count);
179
fwrite(out_data, sizeof(char),
145
out_count = end_data - out_data;
148
/* if there is a lot data, find if there is sequence of zeros */
153
while(out_data+out_count+zero_count < end_data) {
154
if (out_data[zero_count+out_count] != 0) {
155
out_count += 1+zero_count;
170
/* move down and across*/
171
fprintf(prn_stream, "%c[%d`",
173
/* transfer raster graphic command */
174
fprintf(prn_stream, "%c[%d;%d;300;.r",
175
ESC, out_count, out_count);
178
fwrite(out_data, sizeof(char),
180
179
out_count, prn_stream);
182
out_data += out_count+zero_count;
183
num_cols += 8*(out_count+zero_count);
190
fprintf(prn_stream, "%c=", ESC);
194
(void)fwrite(end, end_size, 1, prn_stream);
181
out_data += out_count+zero_count;
182
num_cols += 8*(out_count+zero_count);
189
fprintf(prn_stream, "%c=", ESC);
193
(void)fwrite(end, end_size, 1, prn_stream);
199
198
/* Print an LBP-8 page. */