| 1 | /* |
| 2 | * |
| 3 | * Print plug-in HP PCL driver for the GIMP. |
| 4 | * |
| 5 | * Copyright 1997-2000 Michael Sweet ([email protected]), |
| 6 | * Robert Krawitz ([email protected]) and |
| 7 | * Dave Hill ([email protected]) |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify it |
| 10 | * under the terms of the GNU General Public License as published by the Free |
| 11 | * Software Foundation; either version 2 of the License, or (at your option) |
| 12 | * any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, but |
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 17 | * for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 21 | */ |
| 22 | |
| 23 | /* |
| 24 | * This file must include only standard C header files. The core code must |
| 25 | * compile on generic platforms that don't support glib, gimp, gtk, etc. |
| 26 | */ |
| 27 | |
| 28 | #ifdef HAVE_CONFIG_H |
| 29 | #include <config.h> |
| 30 | #endif |
| 31 | #include <gutenprint/gutenprint.h> |
| 32 | #include <gutenprint/gutenprint-intl-internal.h> |
| 33 | #include "gutenprint-internal.h" |
| 34 | #include <stdio.h> |
| 35 | #include <string.h> |
| 36 | |
| 37 | /* #define DEBUG */ |
| 38 | /* #define PCL_DEBUG_DISABLE_BLANKLINE_REMOVAL */ |
| 39 | |
| 40 | #ifdef __GNUC__ |
| 41 | #define UNUSED __attribute__ ((unused)) |
| 42 | #else |
| 43 | #define UNUSED |
| 44 | #endif |
| 45 | |
| 46 | /* |
| 47 | * Local functions... |
| 48 | */ |
| 49 | static void pcl_mode0(stp_vars_t *, unsigned char *, int, int); |
| 50 | static void pcl_mode2(stp_vars_t *, unsigned char *, int, int); |
| 51 | |
| 52 | #ifndef MAX |
| 53 | # define MAX(a, b) ((a) > (b) ? (a) : (b)) |
| 54 | #endif /* !MAX */ |
| 55 | |
| 56 | typedef struct |
| 57 | { |
| 58 | int do_blank; |
| 59 | int blank_lines; |
| 60 | unsigned char *row_buf; /* For color laser */ |
| 61 | unsigned char *comp_buf; |
| 62 | void (*writefunc)(stp_vars_t *, unsigned char *, int, int); /* PCL output function */ |
| 63 | int do_cret; |
| 64 | int do_cretb; |
| 65 | int do_6color; |
| 66 | int height; |
| 67 | int duplex; |
| 68 | int copies; |
| 69 | int tumble; |
| 70 | int use_crd; |
| 71 | int orientation; |
| 72 | int label_separator; |
| 73 | unsigned int h_offset; /* decipoints */ |
| 74 | unsigned int v_offset; /* decipoints */ |
| 75 | int darkness; |
| 76 | int nodither; |
| 77 | } pcl_privdata_t; |
| 78 | |
| 79 | /* |
| 80 | * Generic define for a name/value set |
| 81 | */ |
| 82 | |
| 83 | typedef struct |
| 84 | { |
| 85 | const char *pcl_name; |
| 86 | const char *pcl_text; |
| 87 | int pcl_code; |
| 88 | int p0; |
| 89 | int p1; |
| 90 | } pcl_t; |
| 91 | |
| 92 | static const stp_dotsize_t single_dotsize[] = |
| 93 | { |
| 94 | { 0x1, 1.0 } |
| 95 | }; |
| 96 | |
| 97 | static const stp_shade_t photo_dither_shades[] = |
| 98 | { |
| 99 | { 1.0000, 1, single_dotsize }, |
| 100 | { 0.3333, 1, single_dotsize }, |
| 101 | }; |
| 102 | |
| 103 | /* |
| 104 | * Media size to PCL media size code table |
| 105 | * |
| 106 | * Note, you can force the list of papersizes given in the GUI to be only those |
| 107 | * supported by defining PCL_NO_CUSTOM_PAPERSIZES |
| 108 | */ |
| 109 | |
| 110 | /* #define PCL_NO_CUSTOM_PAPERSIZES */ |
| 111 | |
| 112 | #define PCL_PAPERSIZE_EXECUTIVE 1 |
| 113 | #define PCL_PAPERSIZE_LETTER 2 |
| 114 | #define PCL_PAPERSIZE_LEGAL 3 |
| 115 | #define PCL_PAPERSIZE_TABLOID 6 /* "Ledger" */ |
| 116 | #define PCL_PAPERSIZE_STATEMENT 15 /* Called "Manual" in print-util */ |
| 117 | #define PCL_PAPERSIZE_SUPER_B 16 /* Called "13x19" in print-util */ |
| 118 | #define PCL_PAPERSIZE_A5 25 |
| 119 | #define PCL_PAPERSIZE_A4 26 |
| 120 | #define PCL_PAPERSIZE_A3 27 |
| 121 | #define PCL_PAPERSIZE_JIS_B5 45 |
| 122 | #define PCL_PAPERSIZE_JIS_B4 46 |
| 123 | #define PCL_PAPERSIZE_HAGAKI_CARD 71 |
| 124 | #define PCL_PAPERSIZE_OUFUKU_CARD 72 |
| 125 | #define PCL_PAPERSIZE_A6_CARD 73 |
| 126 | #define PCL_PAPERSIZE_4x6 74 |
| 127 | #define PCL_PAPERSIZE_5x8 75 |
| 128 | #define PCL_PAPERSIZE_3x5 78 |
| 129 | #define PCL_PAPERSIZE_MONARCH_ENV 80 |
| 130 | #define PCL_PAPERSIZE_COMMERCIAL10_ENV 81 |
| 131 | #define PCL_PAPERSIZE_DL_ENV 90 |
| 132 | #define PCL_PAPERSIZE_C5_ENV 91 |
| 133 | #define PCL_PAPERSIZE_C6_ENV 92 |
| 134 | #define PCL_PAPERSIZE_CUSTOM 101 /* Custom size */ |
| 135 | #define PCL_PAPERSIZE_INVITATION_ENV 109 |
| 136 | #define PCL_PAPERSIZE_JAPANESE_3_ENV 110 |
| 137 | #define PCL_PAPERSIZE_JAPANESE_4_ENV 111 |
| 138 | #define PCL_PAPERSIZE_KAKU_ENV 113 |
| 139 | #define PCL_PAPERSIZE_HP_CARD 114 /* HP Greeting card!?? */ |
| 140 | |
| 141 | /* |
| 142 | * This data comes from the HP documentation "Deskjet 1220C and 1120C |
| 143 | * PCL reference guide 2.0, Nov 1999". NOTE: The first name *must* match |
| 144 | * those in print-util.c for the lookups to work properly! |
| 145 | * The long names are not used so they have been removed, the ones in |
| 146 | * print-util.c are used in the interface. |
| 147 | */ |
| 148 | |
| 149 | static const pcl_t pcl_media_sizes[] = |
| 150 | { |
| 151 | { "Executive", "notused", PCL_PAPERSIZE_EXECUTIVE}, /* US Exec (7.25 x 10.5 in) */ |
| 152 | { "Letter", "notused", PCL_PAPERSIZE_LETTER}, /* US Letter (8.5 x 11 in) */ |
| 153 | { "Legal", "notused", PCL_PAPERSIZE_LEGAL}, /* US Legal (8.5 x 14 in) */ |
| 154 | { "Tabloid", "notused", PCL_PAPERSIZE_TABLOID}, /* US Tabloid (11 x 17 in) */ |
| 155 | { "Statement", "notused", PCL_PAPERSIZE_STATEMENT}, /* US Manual/Statement (5.5 x 8.5 in) */ |
| 156 | { "SuperB", "notused", PCL_PAPERSIZE_SUPER_B}, /* US 13x19/Super B (13 x 19 in) */ |
| 157 | { "A5", "notused", PCL_PAPERSIZE_A5}, /* ISO/JIS A5 (148 x 210 mm) */ |
| 158 | { "A4", "notused", PCL_PAPERSIZE_A4}, /* ISO/JIS A4 (210 x 297 mm) */ |
| 159 | { "A3", "notused", PCL_PAPERSIZE_A3}, /* ISO/JIS A3 (297 x 420 mm) */ |
| 160 | { "B5", "notused", PCL_PAPERSIZE_JIS_B5}, /* JIS B5 (182 x 257 mm). */ |
| 161 | { "B4", "notused", PCL_PAPERSIZE_JIS_B4}, /* JIS B4 (257 x 364 mm). */ |
| 162 | { "w283h420", "notused", PCL_PAPERSIZE_HAGAKI_CARD}, /* Japanese Hagaki Card (100 x 148 mm) */ |
| 163 | { "w420h567", "notused", PCL_PAPERSIZE_OUFUKU_CARD}, /* Japanese Oufuku Card (148 x 200 mm) */ |
| 164 | { "A6", "notused", PCL_PAPERSIZE_A6_CARD}, /* ISO/JIS A6 card */ |
| 165 | { "w288h432", "notused", PCL_PAPERSIZE_4x6}, /* US Index card (4 x 6 in) */ |
| 166 | { "w360h576", "notused", PCL_PAPERSIZE_5x8}, /* US Index card (5 x 8 in) */ |
| 167 | { "w216h360", "notused", PCL_PAPERSIZE_3x5}, /* US Index card (3 x 5 in) */ |
| 168 | { "Monarch", "notused", PCL_PAPERSIZE_MONARCH_ENV}, /* Monarch Envelope (3 7/8 x 7 1/2 in) */ |
| 169 | { "COM10", "notused", PCL_PAPERSIZE_COMMERCIAL10_ENV}, /* US Commercial 10 Envelope (4.125 x 9.5 in) Portrait */ |
| 170 | { "DL", "notused", PCL_PAPERSIZE_DL_ENV}, /* DL envelope (110 x 220 mm) Portrait */ |
| 171 | { "C5", "notused", PCL_PAPERSIZE_C5_ENV}, /* C5 envelope (162 x 229 mm) */ |
| 172 | { "C6", "notused", PCL_PAPERSIZE_C6_ENV}, /* C6 envelope (114 x 162 mm) */ |
| 173 | { "w315h414", "notused", PCL_PAPERSIZE_INVITATION_ENV}, /* US A2 Invitation envelope (4 3/8 x 5 3/4 in) */ |
| 174 | { "w340h666", "notused", PCL_PAPERSIZE_JAPANESE_3_ENV}, /* Japanese Long Envelope #3 (120 x 235 mm) */ |
| 175 | { "w255h581", "notused", PCL_PAPERSIZE_JAPANESE_4_ENV}, /* Japanese Long Envelope #4 (90 x 205 mm) */ |
| 176 | { "w680h941", "notused", PCL_PAPERSIZE_KAKU_ENV}, /* Japanese Kaku Envelope (240 x 332.1 mm) */ |
| 177 | /**** MRS: this size not supported by print-util funcs! ****/ |
| 178 | { "w612h792", "notused", PCL_PAPERSIZE_HP_CARD}, /* Hp greeting card */ |
| 179 | }; |
| 180 | #define NUM_PRINTER_PAPER_SIZES (sizeof(pcl_media_sizes) / sizeof(pcl_t)) |
| 181 | |
| 182 | /* |
| 183 | * Media type to code table |
| 184 | */ |
| 185 | |
| 186 | #define PCL_PAPERTYPE_PLAIN 0 |
| 187 | #define PCL_PAPERTYPE_BOND 1 |
| 188 | #define PCL_PAPERTYPE_PREMIUM 2 |
| 189 | #define PCL_PAPERTYPE_GLOSSY 3 /* or photo */ |
| 190 | #define PCL_PAPERTYPE_TRANS 4 |
| 191 | #define PCL_PAPERTYPE_QPHOTO 5 /* Quick dry photo (2000 only) */ |
| 192 | #define PCL_PAPERTYPE_QTRANS 6 /* Quick dry transparency (2000 only) */ |
| 193 | |
| 194 | static const pcl_t pcl_media_types[] = |
| 195 | { |
| 196 | { "Plain", N_ ("Plain"), PCL_PAPERTYPE_PLAIN}, |
| 197 | { "Bond", N_ ("Bond"), PCL_PAPERTYPE_BOND}, |
| 198 | { "Premium", N_ ("Premium"), PCL_PAPERTYPE_PREMIUM}, |
| 199 | { "Glossy", N_ ("Glossy Photo"), PCL_PAPERTYPE_GLOSSY}, |
| 200 | { "Transparency", N_ ("Transparency"), PCL_PAPERTYPE_TRANS}, |
| 201 | { "GlossyQD", N_ ("Quick-dry Photo"), PCL_PAPERTYPE_QPHOTO}, |
| 202 | { "TransparencyQD", N_ ("Quick-dry Transparency"), PCL_PAPERTYPE_QTRANS}, |
| 203 | }; |
| 204 | #define NUM_PRINTER_PAPER_TYPES (sizeof(pcl_media_types) / sizeof(pcl_t)) |
| 205 | |
| 206 | /* |
| 207 | * Media feed to code table. There are different names for the same code, |
| 208 | * so we encode them by adding "lumps" of "PAPERSOURCE_MOD". |
| 209 | * This is removed later to get back to the main codes. |
| 210 | */ |
| 211 | |
| 212 | #define PAPERSOURCE_MOD 16 |
| 213 | #define PAPERSOURCE_340_MOD (PAPERSOURCE_MOD) |
| 214 | #define PAPERSOURCE_DJ_MOD (PAPERSOURCE_MOD << 1) |
| 215 | #define PAPERSOURCE_ADJ_GUIDE (PAPERSOURCE_MOD << 2) |
| 216 | |
| 217 | #define PCL_PAPERSOURCE_STANDARD 0 /* Don't output code */ |
| 218 | #define PCL_PAPERSOURCE_MANUAL 2 |
| 219 | #define PCL_PAPERSOURCE_MANUAL_ADJ (PCL_PAPERSOURCE_MANUAL + PAPERSOURCE_ADJ_GUIDE) |
| 220 | #define PCL_PAPERSOURCE_ENVELOPE 3 /* Not used */ |
| 221 | |
| 222 | /* LaserJet types */ |
| 223 | #define PCL_PAPERSOURCE_LJ_TRAY2 1 |
| 224 | #define PCL_PAPERSOURCE_LJ_TRAY3 4 |
| 225 | #define PCL_PAPERSOURCE_LJ_TRAY4 5 |
| 226 | #define PCL_PAPERSOURCE_LJ_TRAY1 8 |
| 227 | #define PCL_PAPERSOURCE_LJ_TRAY1_ADJ (PCL_PAPERSOURCE_LJ_TRAY1 + PAPERSOURCE_ADJ_GUIDE) |
| 228 | #define PCL_PAPERSOURCE_LJ_TRAY2_ADJ (PCL_PAPERSOURCE_LJ_TRAY2 + PAPERSOURCE_ADJ_GUIDE) |
| 229 | #define PCL_PAPERSOURCE_LJ_TRAY3_ADJ (PCL_PAPERSOURCE_LJ_TRAY3 + PAPERSOURCE_ADJ_GUIDE) |
| 230 | #define PCL_PAPERSOURCE_LJ_TRAY4_ADJ (PCL_PAPERSOURCE_LJ_TRAY4 + PAPERSOURCE_ADJ_GUIDE) |
| 231 | |
| 232 | /* Deskjet 340 types */ |
| 233 | #define PCL_PAPERSOURCE_340_PCSF (1 + PAPERSOURCE_340_MOD) |
| 234 | /* Portable sheet feeder for 340 */ |
| 235 | #define PCL_PAPERSOURCE_340_DCSF (4 + PAPERSOURCE_340_MOD) |
| 236 | /* Desktop sheet feeder for 340 */ |
| 237 | |
| 238 | /* Other Deskjet types */ |
| 239 | #define PCL_PAPERSOURCE_DJ_TRAY (1 + PAPERSOURCE_DJ_MOD) |
| 240 | #define PCL_PAPERSOURCE_DJ_TRAY2 (4 + PAPERSOURCE_DJ_MOD) |
| 241 | /* Tray 2 for 2500 */ |
| 242 | #define PCL_PAPERSOURCE_DJ_OPTIONAL (5 + PAPERSOURCE_DJ_MOD) |
| 243 | /* Optional source for 2500 */ |
| 244 | #define PCL_PAPERSOURCE_DJ_AUTO (7 + PAPERSOURCE_DJ_MOD) |
| 245 | /* Autoselect for 2500 */ |
| 246 | |
| 247 | static const pcl_t pcl_media_sources[] = |
| 248 | { |
| 249 | { "Standard", N_ ("Standard"), PCL_PAPERSOURCE_STANDARD}, |
| 250 | { "Manual", N_ ("Manual"), PCL_PAPERSOURCE_MANUAL}, |
| 251 | { "ManualAdj", N_ ("Manual - Movable Guides"), PCL_PAPERSOURCE_MANUAL_ADJ}, |
| 252 | /* {"Envelope", PCL_PAPERSOURCE_ENVELOPE}, */ |
| 253 | { "MultiPurposeAdj", N_ ("Tray 1 - Movable Guides"), PCL_PAPERSOURCE_LJ_TRAY1_ADJ}, |
| 254 | { "MultiPurpose", N_ ("Tray 1"), PCL_PAPERSOURCE_LJ_TRAY1}, |
| 255 | { "UpperAdj", N_ ("Tray 2 - Movable Guides"), PCL_PAPERSOURCE_LJ_TRAY2_ADJ}, |
| 256 | { "Upper", N_ ("Tray 2"), PCL_PAPERSOURCE_LJ_TRAY2}, |
| 257 | { "LowerAdj", N_ ("Tray 3 - Movable Guides"), PCL_PAPERSOURCE_LJ_TRAY3_ADJ}, |
| 258 | { "Lower", N_ ("Tray 3"), PCL_PAPERSOURCE_LJ_TRAY3}, |
| 259 | { "LargeCapacityAdj", N_ ("Tray 4 - Movable Guides"), PCL_PAPERSOURCE_LJ_TRAY4_ADJ}, |
| 260 | { "LargeCapacity", N_ ("Tray 4"), PCL_PAPERSOURCE_LJ_TRAY4}, |
| 261 | { "Portable", N_ ("Portable Sheet Feeder"), PCL_PAPERSOURCE_340_PCSF}, |
| 262 | { "Desktop", N_ ("Desktop Sheet Feeder"), PCL_PAPERSOURCE_340_DCSF}, |
| 263 | { "Tray", N_ ("Tray"), PCL_PAPERSOURCE_DJ_TRAY}, |
| 264 | { "Tray2", N_ ("Tray 2"), PCL_PAPERSOURCE_DJ_TRAY2}, |
| 265 | { "Optional", N_ ("Optional Source"), PCL_PAPERSOURCE_DJ_OPTIONAL}, |
| 266 | { "Auto", N_ ("Autoselect"), PCL_PAPERSOURCE_DJ_AUTO}, |
| 267 | }; |
| 268 | #define NUM_PRINTER_PAPER_SOURCES (sizeof(pcl_media_sources) / sizeof(pcl_t)) |
| 269 | |
| 270 | #define PCL_RES_150_150 1 |
| 271 | #define PCL_RES_300_300 2 |
| 272 | #define PCL_RES_600_300 4 /* DJ 600 series */ |
| 273 | #define PCL_RES_600_600_MONO 8 /* DJ 600/800/1100/2000 b/w only */ |
| 274 | #define PCL_RES_600_600 16 /* DJ 9xx/1220C/PhotoSmart */ |
| 275 | #define PCL_RES_1200_600 32 /* DJ 9xx/1220C/PhotoSmart */ |
| 276 | #define PCL_RES_2400_600 64 /* DJ 9xx/1220C/PhotoSmart */ |
| 277 | |
| 278 | static const pcl_t pcl_resolutions[] = |
| 279 | { |
| 280 | { "150dpi", N_("150x150 DPI"), PCL_RES_150_150, 150, 150}, |
| 281 | { "300dpi", N_("300x300 DPI"), PCL_RES_300_300, 300, 300}, |
| 282 | { "600x300dpi", N_("600x300 DPI"), PCL_RES_600_300, 600, 300}, |
| 283 | { "600mono", N_("600x600 DPI monochrome"), PCL_RES_600_600_MONO, 600, 600}, |
| 284 | { "600dpi", N_("600x600 DPI"), PCL_RES_600_600, 600, 600}, |
| 285 | { "1200x600dpi", N_("1200x600 DPI"), PCL_RES_1200_600, 1200, 600}, |
| 286 | { "2400x600dpi", N_("2400x600 DPI"), PCL_RES_2400_600, 2400, 600}, |
| 287 | }; |
| 288 | #define NUM_RESOLUTIONS (sizeof(pcl_resolutions) / sizeof (pcl_t)) |
| 289 | |
| 290 | static const pcl_t pcl_qualities[] = |
| 291 | { |
| 292 | { "Draft", N_("Draft"), PCL_RES_150_150, 150, 150}, |
| 293 | { "Standard", N_("Standard"), PCL_RES_300_300, 300, 300}, |
| 294 | { "High", N_("High"), PCL_RES_600_600, 600, 600}, |
| 295 | { "High", N_("Standard"), PCL_RES_600_300, 600, 300}, |
| 296 | { "Photo", N_("Photo"), PCL_RES_1200_600, 1200, 600}, |
| 297 | { "Photo", N_("Photo"), PCL_RES_2400_600, 2400, 600}, |
| 298 | }; |
| 299 | #define NUM_QUALITIES (sizeof(pcl_qualities) / sizeof (pcl_t)) |
| 300 | |
| 301 | typedef struct { |
| 302 | int top_margin; |
| 303 | int bottom_margin; |
| 304 | int left_margin; |
| 305 | int right_margin; |
| 306 | } margins_t; |
| 307 | |
| 308 | /* |
| 309 | * Printer capability data |
| 310 | */ |
| 311 | |
| 312 | typedef struct { |
| 313 | int model; |
| 314 | unsigned int custom_max_width; |
| 315 | unsigned int custom_max_height; |
| 316 | unsigned int custom_min_width; |
| 317 | unsigned int custom_min_height; |
| 318 | int resolutions; |
| 319 | margins_t normal_margins; |
| 320 | margins_t a4_margins; |
| 321 | int color_type; /* 2 print head or one, 2 level or 4 */ |
| 322 | int stp_printer_type; /* Deskjet/Laserjet and quirks */ |
| 323 | /* The paper size, paper type and paper source codes cannot be combined */ |
| 324 | const short *paper_sizes; /* Paper sizes */ |
| 325 | const short *paper_types; /* Paper types */ |
| 326 | const short *paper_sources; /* Paper sources */ |
| 327 | } pcl_cap_t; |
| 328 | |
| 329 | #define PCL_COLOR_NONE 0 |
| 330 | #define PCL_COLOR_CMY 1 /* One print head */ |
| 331 | #define PCL_COLOR_CMYK 2 /* Two print heads */ |
| 332 | #define PCL_COLOR_CMYK4 4 /* CRet printing */ |
| 333 | #define PCL_COLOR_CMYKcm 8 /* CMY + Photo Cart */ |
| 334 | #define PCL_COLOR_CMYK4b 16 /* CRet for HP840c */ |
| 335 | #define PCL_COLOR_RGB 32 /* RGB for color lasers */ |
| 336 | |
| 337 | #define PCL_PRINTER_LJ 1 |
| 338 | #define PCL_PRINTER_DJ 2 |
| 339 | #define PCL_PRINTER_NEW_ERG 4 /* use "\033*rC" to end raster graphics, |
| 340 | instead of "\033*rB" */ |
| 341 | #define PCL_PRINTER_TIFF 8 /* Use TIFF compression */ |
| 342 | #define PCL_PRINTER_MEDIATYPE 16 /* Use media type & print quality */ |
| 343 | #define PCL_PRINTER_CUSTOM_SIZE 32 /* Custom sizes supported */ |
| 344 | #define PCL_PRINTER_BLANKLINE 64 /* Blank line removal supported */ |
| 345 | #define PCL_PRINTER_DUPLEX 128 /* Printer can have duplexer */ |
| 346 | #define PCL_PRINTER_LABEL 256 /* Datamax-O'Neil PCL Label Printer */ |
| 347 | #define PCL_PRINTER_LJ_COLOR 512 /* Color laser printers */ |
| 348 | #define PCL_PRINTER_COPIES 1024 /* Supports PCL5/HPGL2/HP-RTL copies */ |
| 349 | |
| 350 | /* |
| 351 | * FIXME - the 520 shouldn't be lumped in with the 500 as it supports |
| 352 | * more paper sizes. |
| 353 | * |
| 354 | * The following models use depletion, raster quality and shingling:- |
| 355 | * 500, 500c, 510, 520, 550c, 560c. |
| 356 | * The rest use Media Type and Print Quality. |
| 357 | * |
| 358 | * This data comes from the HP documentation "Deskjet 1220C and 1120C |
| 359 | * PCL reference guide 2.0, Nov 1999". |
| 360 | */ |
| 361 | |
| 362 | static const short emptylist[] = |
| 363 | { |
| 364 | -1 |
| 365 | }; |
| 366 | |
| 367 | static const short custom_papersizes[] = |
| 368 | { |
| 369 | PCL_PAPERSIZE_CUSTOM, |
| 370 | -1, |
| 371 | }; |
| 372 | |
| 373 | static const short standard_papersizes[] = |
| 374 | { |
| 375 | PCL_PAPERSIZE_EXECUTIVE, |
| 376 | PCL_PAPERSIZE_STATEMENT, |
| 377 | PCL_PAPERSIZE_LETTER, |
| 378 | PCL_PAPERSIZE_LEGAL, |
| 379 | PCL_PAPERSIZE_A4, |
| 380 | -1, |
| 381 | }; |
| 382 | |
| 383 | static const short letter_a4_papersizes[] = |
| 384 | { |
| 385 | PCL_PAPERSIZE_A4, |
| 386 | PCL_PAPERSIZE_LETTER, |
| 387 | -1 |
| 388 | }; |
| 389 | |
| 390 | static const short dj340_papersizes[] = |
| 391 | { |
| 392 | PCL_PAPERSIZE_EXECUTIVE, |
| 393 | PCL_PAPERSIZE_LETTER, |
| 394 | PCL_PAPERSIZE_LEGAL, |
| 395 | PCL_PAPERSIZE_A4, |
| 396 | -1, |
| 397 | }; |
| 398 | |
| 399 | static const short dj400_papersizes[] = |
| 400 | { |
| 401 | PCL_PAPERSIZE_EXECUTIVE, |
| 402 | PCL_PAPERSIZE_LETTER, |
| 403 | PCL_PAPERSIZE_LEGAL, |
| 404 | PCL_PAPERSIZE_A4, |
| 405 | PCL_PAPERSIZE_JIS_B5, |
| 406 | -1, |
| 407 | }; |
| 408 | |
| 409 | static const short dj500_papersizes[] = |
| 410 | { |
| 411 | /* PCL_PAPERSIZE_EXECUTIVE, The 500 doesn't support this, the 520 does */ |
| 412 | PCL_PAPERSIZE_LETTER, |
| 413 | PCL_PAPERSIZE_LEGAL, |
| 414 | PCL_PAPERSIZE_A4, |
| 415 | PCL_PAPERSIZE_COMMERCIAL10_ENV, |
| 416 | /* PCL_PAPERSIZE_DL_ENV, The 500 doesn't support this, the 520 does */ |
| 417 | -1, |
| 418 | }; |
| 419 | |
| 420 | static const short dj540_papersizes[] = |
| 421 | { |
| 422 | PCL_PAPERSIZE_EXECUTIVE, |
| 423 | PCL_PAPERSIZE_LETTER, |
| 424 | PCL_PAPERSIZE_LEGAL, |
| 425 | PCL_PAPERSIZE_A4, |
| 426 | PCL_PAPERSIZE_A5, |
| 427 | PCL_PAPERSIZE_JIS_B5, |
| 428 | PCL_PAPERSIZE_HAGAKI_CARD, |
| 429 | PCL_PAPERSIZE_A6_CARD, |
| 430 | PCL_PAPERSIZE_4x6, |
| 431 | PCL_PAPERSIZE_5x8, |
| 432 | PCL_PAPERSIZE_COMMERCIAL10_ENV, |
| 433 | PCL_PAPERSIZE_DL_ENV, |
| 434 | PCL_PAPERSIZE_C6_ENV, |
| 435 | -1, |
| 436 | }; |
| 437 | |
| 438 | static const short dj600_papersizes[] = |
| 439 | { |
| 440 | PCL_PAPERSIZE_EXECUTIVE, |
| 441 | PCL_PAPERSIZE_LETTER, |
| 442 | PCL_PAPERSIZE_LEGAL, |
| 443 | PCL_PAPERSIZE_A4, |
| 444 | PCL_PAPERSIZE_A5, |
| 445 | PCL_PAPERSIZE_HAGAKI_CARD, |
| 446 | PCL_PAPERSIZE_A6_CARD, |
| 447 | PCL_PAPERSIZE_4x6, |
| 448 | PCL_PAPERSIZE_5x8, |
| 449 | PCL_PAPERSIZE_COMMERCIAL10_ENV, |
| 450 | PCL_PAPERSIZE_DL_ENV, |
| 451 | PCL_PAPERSIZE_C6_ENV, |
| 452 | PCL_PAPERSIZE_INVITATION_ENV, |
| 453 | -1, |
| 454 | }; |
| 455 | |
| 456 | static const short dj1220_papersizes[] = |
| 457 | { |
| 458 | PCL_PAPERSIZE_EXECUTIVE, |
| 459 | PCL_PAPERSIZE_LETTER, |
| 460 | PCL_PAPERSIZE_LEGAL, |
| 461 | PCL_PAPERSIZE_TABLOID, |
| 462 | PCL_PAPERSIZE_STATEMENT, |
| 463 | PCL_PAPERSIZE_SUPER_B, |
| 464 | PCL_PAPERSIZE_A5, |
| 465 | PCL_PAPERSIZE_A4, |
| 466 | PCL_PAPERSIZE_A3, |
| 467 | PCL_PAPERSIZE_JIS_B5, |
| 468 | PCL_PAPERSIZE_JIS_B4, |
| 469 | PCL_PAPERSIZE_HAGAKI_CARD, |
| 470 | PCL_PAPERSIZE_OUFUKU_CARD, |
| 471 | PCL_PAPERSIZE_A6_CARD, |
| 472 | PCL_PAPERSIZE_4x6, |
| 473 | PCL_PAPERSIZE_5x8, |
| 474 | PCL_PAPERSIZE_3x5, |
| 475 | PCL_PAPERSIZE_HP_CARD, |
| 476 | PCL_PAPERSIZE_MONARCH_ENV, |
| 477 | PCL_PAPERSIZE_COMMERCIAL10_ENV, |
| 478 | PCL_PAPERSIZE_DL_ENV, |
| 479 | PCL_PAPERSIZE_C5_ENV, |
| 480 | PCL_PAPERSIZE_C6_ENV, |
| 481 | PCL_PAPERSIZE_INVITATION_ENV, |
| 482 | PCL_PAPERSIZE_JAPANESE_3_ENV, |
| 483 | PCL_PAPERSIZE_JAPANESE_4_ENV, |
| 484 | PCL_PAPERSIZE_KAKU_ENV, |
| 485 | -1, |
| 486 | }; |
| 487 | |
| 488 | static const short dj1100_papersizes[] = |
| 489 | { |
| 490 | PCL_PAPERSIZE_EXECUTIVE, |
| 491 | PCL_PAPERSIZE_LETTER, |
| 492 | PCL_PAPERSIZE_LEGAL, |
| 493 | PCL_PAPERSIZE_TABLOID, |
| 494 | PCL_PAPERSIZE_STATEMENT, |
| 495 | PCL_PAPERSIZE_SUPER_B, |
| 496 | PCL_PAPERSIZE_A5, |
| 497 | PCL_PAPERSIZE_A4, |
| 498 | PCL_PAPERSIZE_A3, |
| 499 | PCL_PAPERSIZE_JIS_B5, |
| 500 | PCL_PAPERSIZE_JIS_B4, |
| 501 | PCL_PAPERSIZE_HAGAKI_CARD, |
| 502 | PCL_PAPERSIZE_A6_CARD, |
| 503 | PCL_PAPERSIZE_4x6, |
| 504 | PCL_PAPERSIZE_5x8, |
| 505 | PCL_PAPERSIZE_COMMERCIAL10_ENV, |
| 506 | PCL_PAPERSIZE_DL_ENV, |
| 507 | PCL_PAPERSIZE_C6_ENV, |
| 508 | PCL_PAPERSIZE_INVITATION_ENV, |
| 509 | PCL_PAPERSIZE_JAPANESE_3_ENV, |
| 510 | PCL_PAPERSIZE_JAPANESE_4_ENV, |
| 511 | PCL_PAPERSIZE_KAKU_ENV, |
| 512 | -1, |
| 513 | }; |
| 514 | |
| 515 | static const short dj1200_papersizes[] = |
| 516 | { |
| 517 | /* This printer is not mentioned in the Comparison tables, |
| 518 | so I'll just pick some likely sizes... */ |
| 519 | PCL_PAPERSIZE_EXECUTIVE, |
| 520 | PCL_PAPERSIZE_LETTER, |
| 521 | PCL_PAPERSIZE_LEGAL, |
| 522 | PCL_PAPERSIZE_A5, |
| 523 | PCL_PAPERSIZE_A4, |
| 524 | PCL_PAPERSIZE_4x6, |
| 525 | PCL_PAPERSIZE_5x8, |
| 526 | -1, |
| 527 | }; |
| 528 | |
| 529 | static const short dj2000_papersizes[] = |
| 530 | { |
| 531 | PCL_PAPERSIZE_EXECUTIVE, |
| 532 | PCL_PAPERSIZE_LETTER, |
| 533 | PCL_PAPERSIZE_LEGAL, |
| 534 | PCL_PAPERSIZE_A5, |
| 535 | PCL_PAPERSIZE_A4, |
| 536 | PCL_PAPERSIZE_HAGAKI_CARD, |
| 537 | PCL_PAPERSIZE_A6_CARD, |
| 538 | PCL_PAPERSIZE_4x6, |
| 539 | PCL_PAPERSIZE_5x8, |
| 540 | PCL_PAPERSIZE_3x5, |
| 541 | PCL_PAPERSIZE_COMMERCIAL10_ENV, |
| 542 | PCL_PAPERSIZE_DL_ENV, |
| 543 | PCL_PAPERSIZE_C6_ENV, |
| 544 | PCL_PAPERSIZE_INVITATION_ENV, |
| 545 | -1, |
| 546 | }; |
| 547 | |
| 548 | static const short dj2500_papersizes[] = |
| 549 | { |
| 550 | PCL_PAPERSIZE_EXECUTIVE, |
| 551 | PCL_PAPERSIZE_LETTER, |
| 552 | PCL_PAPERSIZE_LEGAL, |
| 553 | PCL_PAPERSIZE_TABLOID, |
| 554 | PCL_PAPERSIZE_STATEMENT, |
| 555 | PCL_PAPERSIZE_A5, |
| 556 | PCL_PAPERSIZE_A4, |
| 557 | PCL_PAPERSIZE_A3, |
| 558 | PCL_PAPERSIZE_JIS_B5, |
| 559 | PCL_PAPERSIZE_JIS_B4, |
| 560 | PCL_PAPERSIZE_HAGAKI_CARD, |
| 561 | PCL_PAPERSIZE_A6_CARD, |
| 562 | PCL_PAPERSIZE_4x6, |
| 563 | PCL_PAPERSIZE_5x8, |
| 564 | PCL_PAPERSIZE_COMMERCIAL10_ENV, |
| 565 | PCL_PAPERSIZE_DL_ENV, |
| 566 | -1, |
| 567 | }; |
| 568 | |
| 569 | static const short ljsmall_papersizes[] = |
| 570 | { |
| 571 | PCL_PAPERSIZE_EXECUTIVE, |
| 572 | PCL_PAPERSIZE_STATEMENT, |
| 573 | PCL_PAPERSIZE_LETTER, |
| 574 | PCL_PAPERSIZE_LEGAL, |
| 575 | PCL_PAPERSIZE_A4, |
| 576 | PCL_PAPERSIZE_MONARCH_ENV, |
| 577 | PCL_PAPERSIZE_COMMERCIAL10_ENV, |
| 578 | PCL_PAPERSIZE_DL_ENV, |
| 579 | PCL_PAPERSIZE_C5_ENV, |
| 580 | PCL_PAPERSIZE_C6_ENV, |
| 581 | -1, |
| 582 | }; |
| 583 | |
| 584 | static const short ljbig_papersizes[] = |
| 585 | { |
| 586 | PCL_PAPERSIZE_EXECUTIVE, |
| 587 | PCL_PAPERSIZE_STATEMENT, |
| 588 | PCL_PAPERSIZE_LETTER, |
| 589 | PCL_PAPERSIZE_LEGAL, |
| 590 | PCL_PAPERSIZE_TABLOID, |
| 591 | PCL_PAPERSIZE_SUPER_B, |
| 592 | PCL_PAPERSIZE_A5, |
| 593 | PCL_PAPERSIZE_A4, |
| 594 | PCL_PAPERSIZE_A3, |
| 595 | PCL_PAPERSIZE_JIS_B5, |
| 596 | PCL_PAPERSIZE_JIS_B4, /* Guess */ |
| 597 | PCL_PAPERSIZE_4x6, |
| 598 | PCL_PAPERSIZE_5x8, |
| 599 | PCL_PAPERSIZE_MONARCH_ENV, |
| 600 | PCL_PAPERSIZE_COMMERCIAL10_ENV, |
| 601 | PCL_PAPERSIZE_DL_ENV, |
| 602 | PCL_PAPERSIZE_C5_ENV, |
| 603 | PCL_PAPERSIZE_C6_ENV, |
| 604 | -1, |
| 605 | }; |
| 606 | |
| 607 | static const short ljtabloid_papersizes[] = |
| 608 | { |
| 609 | PCL_PAPERSIZE_EXECUTIVE, |
| 610 | PCL_PAPERSIZE_STATEMENT, |
| 611 | PCL_PAPERSIZE_LETTER, |
| 612 | PCL_PAPERSIZE_LEGAL, |
| 613 | PCL_PAPERSIZE_TABLOID, |
| 614 | PCL_PAPERSIZE_A5, |
| 615 | PCL_PAPERSIZE_A4, |
| 616 | PCL_PAPERSIZE_A3, |
| 617 | PCL_PAPERSIZE_JIS_B5, |
| 618 | PCL_PAPERSIZE_JIS_B4, /* Guess */ |
| 619 | PCL_PAPERSIZE_4x6, |
| 620 | PCL_PAPERSIZE_5x8, |
| 621 | PCL_PAPERSIZE_MONARCH_ENV, |
| 622 | PCL_PAPERSIZE_COMMERCIAL10_ENV, |
| 623 | PCL_PAPERSIZE_DL_ENV, |
| 624 | PCL_PAPERSIZE_C5_ENV, |
| 625 | PCL_PAPERSIZE_C6_ENV, |
| 626 | -1, |
| 627 | }; |
| 628 | |
| 629 | static const short basic_papertypes[] = |
| 630 | { |
| 631 | PCL_PAPERTYPE_PLAIN, |
| 632 | PCL_PAPERTYPE_BOND, |
| 633 | PCL_PAPERTYPE_PREMIUM, |
| 634 | PCL_PAPERTYPE_GLOSSY, |
| 635 | PCL_PAPERTYPE_TRANS, |
| 636 | -1, |
| 637 | }; |
| 638 | |
| 639 | static const short new_papertypes[] = |
| 640 | { |
| 641 | PCL_PAPERTYPE_PLAIN, |
| 642 | PCL_PAPERTYPE_BOND, |
| 643 | PCL_PAPERTYPE_PREMIUM, |
| 644 | PCL_PAPERTYPE_GLOSSY, |
| 645 | PCL_PAPERTYPE_TRANS, |
| 646 | PCL_PAPERTYPE_QPHOTO, |
| 647 | PCL_PAPERTYPE_QTRANS, |
| 648 | -1, |
| 649 | }; |
| 650 | |
| 651 | static const short laserjet_papersources[] = |
| 652 | { |
| 653 | PCL_PAPERSOURCE_STANDARD, |
| 654 | PCL_PAPERSOURCE_MANUAL_ADJ, |
| 655 | PCL_PAPERSOURCE_MANUAL, |
| 656 | PCL_PAPERSOURCE_LJ_TRAY1_ADJ, |
| 657 | PCL_PAPERSOURCE_LJ_TRAY1, |
| 658 | PCL_PAPERSOURCE_LJ_TRAY2_ADJ, |
| 659 | PCL_PAPERSOURCE_LJ_TRAY2, |
| 660 | PCL_PAPERSOURCE_LJ_TRAY3_ADJ, |
| 661 | PCL_PAPERSOURCE_LJ_TRAY3, |
| 662 | PCL_PAPERSOURCE_LJ_TRAY4_ADJ, |
| 663 | PCL_PAPERSOURCE_LJ_TRAY4, |
| 664 | -1, |
| 665 | }; |
| 666 | |
| 667 | static const short dj340_papersources[] = |
| 668 | { |
| 669 | PCL_PAPERSOURCE_STANDARD, |
| 670 | PCL_PAPERSOURCE_MANUAL, |
| 671 | PCL_PAPERSOURCE_340_PCSF, |
| 672 | PCL_PAPERSOURCE_340_DCSF, |
| 673 | -1, |
| 674 | }; |
| 675 | |
| 676 | static const short dj_papersources[] = |
| 677 | { |
| 678 | PCL_PAPERSOURCE_STANDARD, |
| 679 | PCL_PAPERSOURCE_MANUAL, |
| 680 | PCL_PAPERSOURCE_DJ_TRAY, |
| 681 | -1, |
| 682 | }; |
| 683 | |
| 684 | static const short dj2500_papersources[] = |
| 685 | { |
| 686 | PCL_PAPERSOURCE_STANDARD, |
| 687 | PCL_PAPERSOURCE_MANUAL, |
| 688 | PCL_PAPERSOURCE_DJ_AUTO, |
| 689 | PCL_PAPERSOURCE_DJ_TRAY, |
| 690 | PCL_PAPERSOURCE_DJ_TRAY2, |
| 691 | PCL_PAPERSOURCE_DJ_OPTIONAL, |
| 692 | -1, |
| 693 | }; |
| 694 | |
| 695 | static const short standard_papersources[] = |
| 696 | { |
| 697 | PCL_PAPERSOURCE_STANDARD, |
| 698 | -1 |
| 699 | }; |
| 700 | |
| 701 | static const pcl_cap_t pcl_model_capabilities[] = |
| 702 | { |
| 703 | /* Default/unknown printer - assume laserjet */ |
| 704 | { 0, |
| 705 | 17 * 72 / 2, 14 * 72, /* Max paper size */ |
| 706 | 1, 1, /* Min paper size */ |
| 707 | PCL_RES_150_150 | PCL_RES_300_300, /* Resolutions */ |
| 708 | {12, 12, 18, 18}, /* non-A4 Margins */ |
| 709 | {12, 12, 10, 10}, /* A4 Margins */ |
| 710 | PCL_COLOR_NONE, |
| 711 | PCL_PRINTER_LJ, |
| 712 | standard_papersizes, |
| 713 | emptylist, |
| 714 | emptylist, |
| 715 | }, |
| 716 | /* Datamax-O'Neil Thermal PCL printers */ |
| 717 | { 10010, /* p1115 */ |
| 718 | 4 * 72, 99 * 72, /* Max paper size */ |
| 719 | 1, 1, /* Min paper size */ |
| 720 | PCL_RES_150_150 | PCL_RES_300_300, /* Resolutions */ |
| 721 | {0, 0, 0, 0}, /* non-A4 Margins */ |
| 722 | {0, 0, 0, 0}, /* A4 Margins */ |
| 723 | PCL_COLOR_NONE, |
| 724 | PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_LABEL | |
| 725 | PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_COPIES, |
| 726 | custom_papersizes, |
| 727 | emptylist, |
| 728 | emptylist, |
| 729 | }, |
| 730 | /* Datamax-O'Neil Thermal PCL printers */ |
| 731 | { 10011, /* p1115s */ |
| 732 | 4 * 72, 99 * 72, /* Max paper size */ |
| 733 | 1, 1, /* Min paper size */ |
| 734 | PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600, /* Resolutions */ |
| 735 | {0, 0, 0, 0}, /* non-A4 Margins */ |
| 736 | {0, 0, 0, 0}, /* A4 Margins */ |
| 737 | PCL_COLOR_NONE, |
| 738 | PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_LABEL | |
| 739 | PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_COPIES, |
| 740 | custom_papersizes, |
| 741 | emptylist, |
| 742 | emptylist, |
| 743 | }, |
| 744 | /* Datamax-O'Neil Thermal PCL printers */ |
| 745 | { 10012, /* p1120n */ |
| 746 | 4 * 72, 99 * 72, /* Max paper size */ |
| 747 | 1, 1, /* Min paper size */ |
| 748 | PCL_RES_150_150 | PCL_RES_300_300, /* Resolutions */ |
| 749 | {0, 0, 0, 0}, /* non-A4 Margins */ |
| 750 | {0, 0, 0, 0}, /* A4 Margins */ |
| 751 | PCL_COLOR_NONE, |
| 752 | PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_LABEL | |
| 753 | PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_COPIES, |
| 754 | custom_papersizes, |
| 755 | emptylist, |
| 756 | emptylist, |
| 757 | }, |
| 758 | /* Datamax-O'Neil Thermal PCL printers */ |
| 759 | { 10013, /* p1125 */ |
| 760 | 4 * 72, 99 * 72, /* Max paper size */ |
| 761 | 1, 1, /* Min paper size */ |
| 762 | PCL_RES_150_150 | PCL_RES_300_300, /* Resolutions */ |
| 763 | {0, 0, 0, 0}, /* non-A4 Margins */ |
| 764 | {0, 0, 0, 0}, /* A4 Margins */ |
| 765 | PCL_COLOR_NONE, |
| 766 | PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_LABEL | |
| 767 | PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_COPIES, |
| 768 | custom_papersizes, |
| 769 | emptylist, |
| 770 | emptylist, |
| 771 | }, |
| 772 | /* Datamax-O'Neil Thermal PCL printers */ |
| 773 | { 10014, /* p1725 */ |
| 774 | 6 * 72, 99 * 72, /* Max paper size */ |
| 775 | 1, 1, /* Min paper size */ |
| 776 | PCL_RES_150_150 | PCL_RES_300_300, /* Resolutions */ |
| 777 | {0, 0, 0, 0}, /* non-A4 Margins */ |
| 778 | {0, 0, 0, 0}, /* A4 Margins */ |
| 779 | PCL_COLOR_NONE, |
| 780 | PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_LABEL | |
| 781 | PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_COPIES, |
| 782 | custom_papersizes, |
| 783 | emptylist, |
| 784 | emptylist, |
| 785 | }, |
| 786 | /* Datamax-O'Neil Thermal PCL printers */ |
| 787 | { 10015, /* w1110 */ |
| 788 | 4 * 72, 99 * 72, /* Max paper size */ |
| 789 | 1, 1, /* Min paper size */ |
| 790 | PCL_RES_150_150 | PCL_RES_300_300, /* Resolutions */ |
| 791 | {0, 0, 0, 0}, /* non-A4 Margins */ |
| 792 | {0, 0, 0, 0}, /* A4 Margins */ |
| 793 | PCL_COLOR_NONE, |
| 794 | PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_LABEL | |
| 795 | PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_COPIES, |
| 796 | custom_papersizes, |
| 797 | emptylist, |
| 798 | emptylist, |
| 799 | }, |
| 800 | /* Datamax-O'Neil Thermal PCL printers */ |
| 801 | { 10016, /* H8308p */ |
| 802 | 17 * 72 / 2, 99 * 72, /* Max paper size */ |
| 803 | 1, 1, /* Min paper size */ |
| 804 | PCL_RES_150_150 | PCL_RES_300_300, /* Resolutions */ |
| 805 | {0, 0, 0, 0}, /* non-A4 Margins */ |
| 806 | {0, 0, 0, 0}, /* A4 Margins */ |
| 807 | PCL_COLOR_NONE, |
| 808 | PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_LABEL | |
| 809 | PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_COPIES, |
| 810 | custom_papersizes, |
| 811 | emptylist, |
| 812 | emptylist, |
| 813 | }, |
| 814 | /* DesignJet 230/430 (monochrome ) */ |
| 815 | { 10230, |
| 816 | 36 * 72, 150 * 12 * 72, /* 150ft in roll mode, 64" in sheet */ |
| 817 | 826 * 72 / 100, 583 * 72 / 100, /* 8.3" wide min in sheet mode */ |
| 818 | PCL_RES_300_300 | PCL_RES_600_600, |
| 819 | {49, 49, 15, 15}, |
| 820 | {49, 49, 15, 15}, |
| 821 | PCL_COLOR_NONE, |
| 822 | PCL_PRINTER_DJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_NEW_ERG | PCL_PRINTER_COPIES, |
| 823 | letter_a4_papersizes, |
| 824 | basic_papertypes, |
| 825 | standard_papersources, |
| 826 | }, |
| 827 | /* DesignJet 250C/450C/455CA/488CA */ |
| 828 | /* The "CA" versions have a "software RIP" but are the same hardware */ |
| 829 | { 10250, |
| 830 | 36 * 72, 150 * 12 * 72, /* 150ft in roll mode, 64" in sheet */ |
| 831 | 826 * 72 / 100, 583 * 72 / 100, /* 8.3" wide min in sheet mode */ |
| 832 | PCL_RES_300_300 | PCL_RES_600_600_MONO, |
| 833 | {49, 49, 15, 15}, |
| 834 | {49, 49, 15, 15}, |
| 835 | PCL_COLOR_CMYK, |
| 836 | PCL_PRINTER_DJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_NEW_ERG | PCL_PRINTER_COPIES, |
| 837 | letter_a4_papersizes, |
| 838 | basic_papertypes, |
| 839 | standard_papersources, |
| 840 | }, |
| 841 | /* DesignJet 700 (monochrome) */ |
| 842 | { 10700, |
| 843 | 36 * 72, 150 * 12 * 72, /* 150ft in roll mode, 64" in sheet */ |
| 844 | 826 * 72 / 100, 583 * 72 / 100, /* 8.3" wide min in sheet mode */ |
| 845 | PCL_RES_300_300 | PCL_RES_600_600, |
| 846 | {30, 30, 15, 15}, /* These margins are for sheet mode FIX */ |
| 847 | {30, 30, 15, 15}, |
| 848 | PCL_COLOR_NONE, |
| 849 | PCL_PRINTER_DJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_NEW_ERG | PCL_PRINTER_COPIES, |
| 850 | letter_a4_papersizes, |
| 851 | basic_papertypes, |
| 852 | standard_papersources, |
| 853 | }, |
| 854 | /* DesignJet 750C */ |
| 855 | { 10750, |
| 856 | 36 * 72, 150 * 12 * 72, /* 150ft in roll mode, 64" in sheet */ |
| 857 | 826 * 72 / 100, 583 * 72 / 100, /* 8.3" wide min in sheet mode */ |
| 858 | PCL_RES_300_300 | PCL_RES_600_600_MONO, |
| 859 | {30, 30, 15, 15}, /* These margins are for roll mode FIX */ |
| 860 | {30, 30, 15, 15}, |
| 861 | PCL_COLOR_CMYK, |
| 862 | PCL_PRINTER_DJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_NEW_ERG | PCL_PRINTER_COPIES, |
| 863 | letter_a4_papersizes, |
| 864 | basic_papertypes, |
| 865 | standard_papersources, |
| 866 | }, |
| 867 | /* DesignJet 2000C/2500C (36" wide) */ |
| 868 | { 12500, /* Deskjet 2500 already has "2500" */ |
| 869 | 36 * 72, 150 * 12 * 72, /* 150ft in roll mode, 64" in sheet */ |
| 870 | 826 * 72 / 100, 583 * 72 / 100, /* 8.3" wide min in sheet mode */ |
| 871 | PCL_RES_300_300 | PCL_RES_600_600_MONO, |
| 872 | {49, 49, 15, 15}, /* Check/Fix */ |
| 873 | {49, 49, 15, 15}, |
| 874 | PCL_COLOR_CMYK, |
| 875 | PCL_PRINTER_DJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_NEW_ERG | PCL_PRINTER_COPIES, |
| 876 | letter_a4_papersizes, |
| 877 | basic_papertypes, |
| 878 | standard_papersources, |
| 879 | }, |
| 880 | /* DesignJet 3000C/3500C (54" wide) */ |
| 881 | { 13500, /* Deskjet 2500 already has "2500" */ |
| 882 | 54 * 72, 150 * 12 * 72, /* 150ft in roll mode, 64" in sheet */ |
| 883 | 826 * 72 / 100, 583 * 72 / 100, /* 8.3" wide min in sheet mode */ |
| 884 | PCL_RES_300_300 | PCL_RES_600_600_MONO, |
| 885 | {49, 49, 15, 15}, /* Check/Fix */ |
| 886 | {49, 49, 15, 15}, |
| 887 | PCL_COLOR_CMYK, |
| 888 | PCL_PRINTER_DJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_NEW_ERG | PCL_PRINTER_COPIES, |
| 889 | letter_a4_papersizes, |
| 890 | basic_papertypes, |
| 891 | standard_papersources, |
| 892 | }, |
| 893 | /* Deskjet 340 */ |
| 894 | { 340, |
| 895 | 17 * 72 / 2, 14 * 72, |
| 896 | 1, 1, /* Min paper size */ |
| 897 | PCL_RES_150_150 | PCL_RES_300_300, |
| 898 | {6, 48, 18, 18}, /* from bpd07933.pdf */ |
| 899 | {6, 48, 10, 11}, /* from bpd07933.pdf */ |
| 900 | PCL_COLOR_CMY, |
| 901 | PCL_PRINTER_DJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE, |
| 902 | dj340_papersizes, |
| 903 | basic_papertypes, |
| 904 | dj340_papersources, |
| 905 | }, |
| 906 | /* Deskjet 400 */ |
| 907 | { 400, |
| 908 | 17 * 72 / 2, 14 * 72, |
| 909 | 1, 1, /* Min paper size */ |
| 910 | PCL_RES_150_150 | PCL_RES_300_300, |
| 911 | {7, 41, 18, 18}, |
| 912 | {7, 41, 10, 10}, /* Check/Fix */ |
| 913 | PCL_COLOR_CMY, |
| 914 | PCL_PRINTER_DJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE, |
| 915 | dj400_papersizes, |
| 916 | basic_papertypes, |
| 917 | emptylist, |
| 918 | }, |
| 919 | /* Deskjet 500, 520. Lexmark 4076 */ |
| 920 | { 500, |
| 921 | 17 * 72 / 2, 14 * 72, |
| 922 | 1, 1, /* Min paper size */ |
| 923 | PCL_RES_150_150 | PCL_RES_300_300, |
| 924 | {7, 41, 18, 18}, |
| 925 | {7, 41, 10, 10}, /* Check/Fix */ |
| 926 | PCL_COLOR_NONE, |
| 927 | PCL_PRINTER_DJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE, |
| 928 | dj500_papersizes, |
| 929 | basic_papertypes, |
| 930 | dj_papersources, |
| 931 | }, |
| 932 | /* Deskjet 500C */ |
| 933 | { 501, |
| 934 | 17 * 72 / 2, 14 * 72, |
| 935 | 1, 1, /* Min paper size */ |
| 936 | PCL_RES_150_150 | PCL_RES_300_300, |
| 937 | {7, 33, 18, 18}, |
| 938 | {7, 33, 10, 10}, /* Check/Fix */ |
| 939 | PCL_COLOR_CMY, |
| 940 | PCL_PRINTER_DJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE, |
| 941 | dj500_papersizes, |
| 942 | basic_papertypes, |
| 943 | dj_papersources, |
| 944 | }, |
| 945 | /* Deskjet 540C */ |
| 946 | { 540, |
| 947 | 17 * 72 / 2, 14 * 72, |
| 948 | 1, 1, /* Min paper size */ |
| 949 | PCL_RES_150_150 | PCL_RES_300_300, |
| 950 | {7, 33, 18, 18}, |
| 951 | {7, 33, 10, 10}, /* Check/Fix */ |
| 952 | PCL_COLOR_CMY, |
| 953 | PCL_PRINTER_DJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_MEDIATYPE | |
| 954 | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_BLANKLINE, |
| 955 | dj540_papersizes, |
| 956 | basic_papertypes, |
| 957 | dj_papersources, |
| 958 | }, |
| 959 | /* Deskjet 550C, 560C */ |
| 960 | { 550, |
| 961 | 17 * 72 / 2, 14 * 72, |
| 962 | 1, 1, /* Min paper size */ |
| 963 | PCL_RES_150_150 | PCL_RES_300_300, |
| 964 | {3, 33, 18, 18}, |
| 965 | {5, 33, 10, 10}, |
| 966 | PCL_COLOR_CMYK, |
| 967 | PCL_PRINTER_DJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE, |
| 968 | /* The 550/560 support COM10 and DL envelope, but the control codes |
| 969 | are negative, indicating landscape mode. This needs thinking about! */ |
| 970 | dj340_papersizes, |
| 971 | basic_papertypes, |
| 972 | dj_papersources, |
| 973 | }, |
| 974 | /* Deskjet 600/600C */ |
| 975 | { 600, |
| 976 | 17 * 72 / 2, 14 * 72, |
| 977 | 5 * 72, 583 * 72 / 100, /* Min paper size */ |
| 978 | PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_300 | PCL_RES_600_600_MONO, |
| 979 | {0, 33, 18, 18}, |
| 980 | {0, 33, 10, 10}, /* Check/Fix */ |
| 981 | PCL_COLOR_CMY, |
| 982 | PCL_PRINTER_DJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_MEDIATYPE | |
| 983 | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_BLANKLINE, |
| 984 | dj600_papersizes, |
| 985 | basic_papertypes, |
| 986 | emptylist, |
| 987 | }, |
| 988 | /* Deskjet 6xx series */ |
| 989 | { 601, |
| 990 | 17 * 72 / 2, 14 * 72, |
| 991 | 1, 1, /* Min paper size */ |
| 992 | PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_300 | PCL_RES_600_600_MONO, |
| 993 | {0, 33, 18, 18}, |
| 994 | {0, 33, 10, 10}, /* Check/Fix */ |
| 995 | PCL_COLOR_CMYK, |
| 996 | PCL_PRINTER_DJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_MEDIATYPE | |
| 997 | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_BLANKLINE, |
| 998 | dj600_papersizes, |
| 999 | basic_papertypes, |
| 1000 | emptylist, |
| 1001 | }, |
| 1002 | /* Deskjet 69x series (Photo Capable) */ |
| 1003 | { 690, |
| 1004 | 17 * 72 / 2, 14 * 72, |
| 1005 | 1, 1, /* Min paper size */ |
| 1006 | PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_300 | PCL_RES_600_600, |
| 1007 | {0, 33, 18, 18}, |
| 1008 | {0, 33, 10, 10}, /* Check/Fix */ |
| 1009 | PCL_COLOR_CMYK | PCL_COLOR_CMYKcm, |
| 1010 | PCL_PRINTER_DJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_MEDIATYPE | |
| 1011 | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_BLANKLINE, |
| 1012 | dj600_papersizes, |
| 1013 | basic_papertypes, |
| 1014 | emptylist, |
| 1015 | }, |
| 1016 | /* Deskjet 850/855/870/890 (C-RET) */ |
| 1017 | { 800, |
| 1018 | 17 * 72 / 2, 14 * 72, |
| 1019 | 1, 1, /* Min paper size */ |
| 1020 | PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600_MONO, |
| 1021 | {3, 33, 18, 18}, |
| 1022 | {5, 33, 10, 10}, |
| 1023 | PCL_COLOR_CMYK | PCL_COLOR_CMYK4, |
| 1024 | PCL_PRINTER_DJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_MEDIATYPE | |
| 1025 | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_BLANKLINE, |
| 1026 | dj600_papersizes, |
| 1027 | basic_papertypes, |
| 1028 | emptylist, |
| 1029 | }, |
| 1030 | /* Deskjet 810C, 812C, 840C, 842C, 845C, 895C (C-RET) */ |
| 1031 | { 840, |
| 1032 | 17 * 72 / 2, 14 * 72, |
| 1033 | 1, 1, /* Min paper size */ |
| 1034 | PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_300 | PCL_RES_600_600, |
| 1035 | {0, 33, 18, 18}, |
| 1036 | {0, 33, 10, 10}, /* Check/Fix */ |
| 1037 | PCL_COLOR_CMYK | PCL_COLOR_CMYK4b, |
| 1038 | PCL_PRINTER_DJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_MEDIATYPE | |
| 1039 | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_BLANKLINE, |
| 1040 | dj600_papersizes, |
| 1041 | basic_papertypes, |
| 1042 | emptylist, |
| 1043 | }, |
| 1044 | /* Deskjet 900 series, 1220C, PhotoSmart P1000/P1100 */ |
| 1045 | { 900, |
| 1046 | 17 * 72 / 2, 14 * 72, |
| 1047 | 1, 1, /* Min paper size */ |
| 1048 | PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600 /* | PCL_RES_1200_600 | PCL_RES_2400_600 */, |
| 1049 | {3, 33, 18, 18}, |
| 1050 | {5, 33, 10, 10}, /* Oliver Vecernik */ |
| 1051 | PCL_COLOR_CMYK, |
| 1052 | PCL_PRINTER_DJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_MEDIATYPE | |
| 1053 | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_BLANKLINE | PCL_PRINTER_DUPLEX, |
| 1054 | dj600_papersizes, |
| 1055 | basic_papertypes, |
| 1056 | emptylist, |
| 1057 | }, |
| 1058 | /* Deskjet 1220C (or other large format 900) */ |
| 1059 | { 901, |
| 1060 | 13 * 72, 19 * 72, |
| 1061 | 1, 1, /* Min paper size */ |
| 1062 | PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600 /* | PCL_RES_1200_600 | PCL_RES_2400_600 */, |
| 1063 | {3, 33, 18, 18}, |
| 1064 | {5, 33, 10, 10}, |
| 1065 | PCL_COLOR_CMYK, |
| 1066 | PCL_PRINTER_DJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_MEDIATYPE | |
| 1067 | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_BLANKLINE, |
| 1068 | dj1220_papersizes, |
| 1069 | basic_papertypes, |
| 1070 | emptylist, |
| 1071 | }, |
| 1072 | /* Deskjet 1100C, 1120C */ |
| 1073 | { 1100, |
| 1074 | 13 * 72, 19 * 72, |
| 1075 | 1, 1, /* Min paper size */ |
| 1076 | PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600_MONO, |
| 1077 | {3, 33, 18, 18}, |
| 1078 | {5, 33, 10, 10}, |
| 1079 | PCL_COLOR_CMYK | PCL_COLOR_CMYK4, |
| 1080 | PCL_PRINTER_DJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_MEDIATYPE | |
| 1081 | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_BLANKLINE, |
| 1082 | dj1100_papersizes, |
| 1083 | basic_papertypes, |
| 1084 | dj_papersources, |
| 1085 | }, |
| 1086 | /* Deskjet 1200C */ |
| 1087 | { 1200, |
| 1088 | 17 * 72 / 2, 14 * 72, |
| 1089 | 1, 1, /* Min paper size */ |
| 1090 | PCL_RES_150_150 | PCL_RES_300_300, |
| 1091 | {12, 12, 18, 18}, |
| 1092 | {12, 12, 10, 10}, /* Check/Fix */ |
| 1093 | PCL_COLOR_CMY, |
| 1094 | PCL_PRINTER_DJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_MEDIATYPE | |
| 1095 | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_BLANKLINE | PCL_PRINTER_COPIES, |
| 1096 | dj1200_papersizes, |
| 1097 | basic_papertypes, |
| 1098 | dj_papersources, |
| 1099 | }, |
| 1100 | /* Deskjet 1600C */ |
| 1101 | { 1600, |
| 1102 | 17 * 72 / 2, 14 * 72, |
| 1103 | 1, 1, /* Min paper size */ |
| 1104 | PCL_RES_150_150 | PCL_RES_300_300, |
| 1105 | {12, 12, 18, 18}, |
| 1106 | {12, 12, 10, 10}, /* Check/Fix */ |
| 1107 | PCL_COLOR_CMYK, |
| 1108 | PCL_PRINTER_DJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_MEDIATYPE | |
| 1109 | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_BLANKLINE | PCL_PRINTER_COPIES, |
| 1110 | dj1200_papersizes, |
| 1111 | basic_papertypes, |
| 1112 | dj_papersources, |
| 1113 | }, |
| 1114 | /* Deskjet 2000 */ |
| 1115 | { 2000, |
| 1116 | 17 * 72 / 2, 14 * 72, |
| 1117 | 1, 1, /* Min paper size */ |
| 1118 | PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600, |
| 1119 | {0, 35, 18, 18}, /* Michel Goraczko */ |
| 1120 | {0, 35, 10, 10}, /* Check/Fix */ |
| 1121 | PCL_COLOR_CMYK, |
| 1122 | PCL_PRINTER_DJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_MEDIATYPE | |
| 1123 | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_BLANKLINE, |
| 1124 | dj2000_papersizes, |
| 1125 | new_papertypes, |
| 1126 | dj_papersources, |
| 1127 | }, |
| 1128 | /* Deskjet 2500 */ |
| 1129 | { 2500, |
| 1130 | 13 * 72, 19 * 72, |
| 1131 | 1, 1, /* Min paper size */ |
| 1132 | PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600, |
| 1133 | {12, 12, 18, 18}, |
| 1134 | {12, 12, 10, 10}, /* Check/Fix */ |
| 1135 | PCL_COLOR_CMYK, |
| 1136 | PCL_PRINTER_DJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_MEDIATYPE | |
| 1137 | PCL_PRINTER_CUSTOM_SIZE | PCL_PRINTER_BLANKLINE, |
| 1138 | dj2500_papersizes, |
| 1139 | new_papertypes, |
| 1140 | dj2500_papersources, |
| 1141 | }, |
| 1142 | /* LaserJet II series */ |
| 1143 | { 2, |
| 1144 | 17 * 72 / 2, 14 * 72, |
| 1145 | 1, 1, /* Min paper size */ |
| 1146 | PCL_RES_150_150 | PCL_RES_300_300, |
| 1147 | {12, 12, 18, 18}, |
| 1148 | {12, 12, 10, 10}, /* Check/Fix */ |
| 1149 | PCL_COLOR_NONE, |
| 1150 | PCL_PRINTER_LJ, |
| 1151 | ljsmall_papersizes, |
| 1152 | emptylist, |
| 1153 | laserjet_papersources, |
| 1154 | }, |
| 1155 | /* LaserJet IIP (TIFF but no blankline) */ |
| 1156 | { 21, |
| 1157 | 17 * 72 / 2, 14 * 72, |
| 1158 | 1, 1, /* Min paper size */ |
| 1159 | PCL_RES_150_150 | PCL_RES_300_300, |
| 1160 | {12, 12, 18, 18}, |
| 1161 | {12, 12, 10, 10}, /* Check/Fix */ |
| 1162 | PCL_COLOR_NONE, |
| 1163 | PCL_PRINTER_LJ | PCL_PRINTER_TIFF, |
| 1164 | ljsmall_papersizes, |
| 1165 | emptylist, |
| 1166 | laserjet_papersources, |
| 1167 | }, |
| 1168 | /* Some laser printers don't have expanded A4 margins */ |
| 1169 | { 22, |
| 1170 | 17 * 72 / 2, 14 * 72, |
| 1171 | 1, 1, /* Min paper size */ |
| 1172 | PCL_RES_150_150 | PCL_RES_300_300, |
| 1173 | {12, 12, 18, 18}, |
| 1174 | {12, 12, 18, 18}, /* Check/Fix */ |
| 1175 | PCL_COLOR_NONE, |
| 1176 | PCL_PRINTER_LJ, |
| 1177 | ljsmall_papersizes, |
| 1178 | emptylist, |
| 1179 | laserjet_papersources, |
| 1180 | }, |
| 1181 | /* PCL-4 with large paper */ |
| 1182 | { 23, |
| 1183 | 13 * 72, 19 * 72, |
| 1184 | 1, 1, /* Min paper size */ |
| 1185 | PCL_RES_150_150 | PCL_RES_300_300, |
| 1186 | {12, 12, 18, 18}, |
| 1187 | {12, 12, 10, 10}, /* Check/Fix */ |
| 1188 | PCL_COLOR_NONE, |
| 1189 | PCL_PRINTER_LJ, |
| 1190 | ljbig_papersizes, |
| 1191 | emptylist, |
| 1192 | laserjet_papersources, |
| 1193 | }, |
| 1194 | /* PCL-4 with large paper, no expanded A4 margins */ |
| 1195 | { 24, |
| 1196 | 13 * 72, 19 * 72, |
| 1197 | 1, 1, /* Min paper size */ |
| 1198 | PCL_RES_150_150 | PCL_RES_300_300, |
| 1199 | {12, 12, 18, 18}, |
| 1200 | {12, 12, 18, 18}, /* Check/Fix */ |
| 1201 | PCL_COLOR_NONE, |
| 1202 | PCL_PRINTER_LJ, |
| 1203 | ljbig_papersizes, |
| 1204 | emptylist, |
| 1205 | laserjet_papersources, |
| 1206 | }, |
| 1207 | /* LaserJet III series */ |
| 1208 | { 3, |
| 1209 | 17 * 72 / 2, 14 * 72, |
| 1210 | 1, 1, /* Min paper size */ |
| 1211 | PCL_RES_150_150 | PCL_RES_300_300, |
| 1212 | {12, 12, 18, 18}, |
| 1213 | {12, 12, 10, 10}, /* Check/Fix */ |
| 1214 | PCL_COLOR_NONE, |
| 1215 | PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_COPIES, |
| 1216 | ljsmall_papersizes, |
| 1217 | emptylist, |
| 1218 | laserjet_papersources, |
| 1219 | }, |
| 1220 | /* LaserJet III series */ |
| 1221 | { 31, |
| 1222 | 17 * 72 / 2, 14 * 72, |
| 1223 | 1, 1, /* Min paper size */ |
| 1224 | PCL_RES_150_150 | PCL_RES_300_300, |
| 1225 | {12, 12, 18, 18}, |
| 1226 | {12, 12, 10, 10}, /* Check/Fix */ |
| 1227 | PCL_COLOR_NONE, |
| 1228 | PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_COPIES, |
| 1229 | ljsmall_papersizes, |
| 1230 | emptylist, |
| 1231 | laserjet_papersources, |
| 1232 | }, |
| 1233 | /* Some laser printers don't have expanded A4 margins */ |
| 1234 | { 32, |
| 1235 | 17 * 72 / 2, 14 * 72, |
| 1236 | 1, 1, /* Min paper size */ |
| 1237 | PCL_RES_150_150 | PCL_RES_300_300, |
| 1238 | {12, 12, 18, 18}, |
| 1239 | {12, 12, 18, 18}, /* Check/Fix */ |
| 1240 | PCL_COLOR_NONE, |
| 1241 | PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_COPIES, |
| 1242 | ljsmall_papersizes, |
| 1243 | emptylist, |
| 1244 | laserjet_papersources, |
| 1245 | }, |
| 1246 | /* PCL-5 with large paper */ |
| 1247 | { 33, |
| 1248 | 13 * 72, 19 * 72, |
| 1249 | 1, 1, /* Min paper size */ |
| 1250 | PCL_RES_150_150 | PCL_RES_300_300, |
| 1251 | {12, 12, 18, 18}, |
| 1252 | {12, 12, 10, 10}, /* Check/Fix */ |
| 1253 | PCL_COLOR_NONE, |
| 1254 | PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_COPIES, |
| 1255 | ljbig_papersizes, |
| 1256 | emptylist, |
| 1257 | laserjet_papersources, |
| 1258 | }, |
| 1259 | /* PCL-5 with large paper, no expanded margins */ |
| 1260 | { 34, |
| 1261 | 13 * 72, 19 * 72, |
| 1262 | 1, 1, /* Min paper size */ |
| 1263 | PCL_RES_150_150 | PCL_RES_300_300, |
| 1264 | {12, 12, 18, 18}, |
| 1265 | {12, 12, 18, 18}, /* Check/Fix */ |
| 1266 | PCL_COLOR_NONE, |
| 1267 | PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_COPIES, |
| 1268 | ljbig_papersizes, |
| 1269 | emptylist, |
| 1270 | laserjet_papersources, |
| 1271 | }, |
| 1272 | /* PCL-5 with tabloid paper, no expanded margins */ |
| 1273 | { 35, |
| 1274 | 118 * 72 / 10, 17 * 72, |
| 1275 | 1, 1, /* Min paper size */ |
| 1276 | PCL_RES_150_150 | PCL_RES_300_300, |
| 1277 | {12, 12, 18, 18}, |
| 1278 | {12, 12, 18, 18}, /* Check/Fix */ |
| 1279 | PCL_COLOR_NONE, |
| 1280 | PCL_PRINTER_LJ | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_COPIES, |
| 1281 | ljtabloid_papersizes, |
| 1282 | emptylist, |
| 1283 | laserjet_papersources, |
| 1284 | }, |
| 1285 | /* LaserJet 4L */ |
| 1286 | { 4, |
| 1287 | 17 * 72 / 2, 14 * 72, |
| 1288 | 1, 1, /* Min paper size */ |
| 1289 | PCL_RES_150_150 | PCL_RES_300_300, |
| 1290 | {12, 12, 18, 18}, |
| 1291 | {12, 12, 10, 10}, /* Check/Fix */ |
| 1292 | PCL_COLOR_NONE, |
| 1293 | PCL_PRINTER_LJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_COPIES, |
| 1294 | ljsmall_papersizes, |
| 1295 | emptylist, |
| 1296 | laserjet_papersources, |
| 1297 | }, |
| 1298 | /* LaserJet 4V */ |
| 1299 | { 5, |
| 1300 | 13 * 72, 19 * 72, |
| 1301 | 1, 1, /* Min paper size */ |
| 1302 | PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600, |
| 1303 | {12, 12, 18, 18}, |
| 1304 | {12, 12, 10, 10}, /* Check/Fix */ |
| 1305 | PCL_COLOR_NONE, |
| 1306 | PCL_PRINTER_LJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | PCL_PRINTER_COPIES, |
| 1307 | ljbig_papersizes, |
| 1308 | emptylist, |
| 1309 | laserjet_papersources, |
| 1310 | }, |
| 1311 | /* LaserJet 4Si */ |
| 1312 | { 51, |
| 1313 | 13 * 72, 19 * 72, |
| 1314 | 1, 1, /* Min paper size */ |
| 1315 | PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600, |
| 1316 | {12, 12, 18, 18}, |
| 1317 | {12, 12, 10, 10}, /* Check/Fix */ |
| 1318 | PCL_COLOR_NONE, |
| 1319 | PCL_PRINTER_LJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | |
| 1320 | PCL_PRINTER_DUPLEX | PCL_PRINTER_COPIES, |
| 1321 | ljbig_papersizes, |
| 1322 | emptylist, |
| 1323 | laserjet_papersources, |
| 1324 | }, |
| 1325 | /* LaserJet 4 series (except as above), 5 series, 6 series */ |
| 1326 | { 6, |
| 1327 | 17 * 72 / 2, 14 * 72, |
| 1328 | 1, 1, /* Min paper size */ |
| 1329 | PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600, |
| 1330 | {12, 12, 18, 18}, |
| 1331 | {12, 12, 10, 10}, /* Check/Fix */ |
| 1332 | PCL_COLOR_NONE, |
| 1333 | PCL_PRINTER_LJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | |
| 1334 | PCL_PRINTER_DUPLEX | PCL_PRINTER_COPIES, |
| 1335 | ljsmall_papersizes, |
| 1336 | emptylist, |
| 1337 | laserjet_papersources, |
| 1338 | }, |
| 1339 | /* PCL-5c/5e/6/XL with large paper */ |
| 1340 | { 61, |
| 1341 | 13 * 72, 19 * 72, |
| 1342 | 1, 1, /* Min paper size */ |
| 1343 | PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600, |
| 1344 | {12, 12, 18, 18}, |
| 1345 | {12, 12, 10, 10}, /* Check/Fix */ |
| 1346 | PCL_COLOR_NONE, |
| 1347 | PCL_PRINTER_LJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | |
| 1348 | PCL_PRINTER_DUPLEX | PCL_PRINTER_COPIES, |
| 1349 | ljbig_papersizes, |
| 1350 | emptylist, |
| 1351 | laserjet_papersources, |
| 1352 | }, |
| 1353 | /* Some laser printers don't have expanded A4 margins */ |
| 1354 | { 62, |
| 1355 | 17 * 72 / 2, 14 * 72, |
| 1356 | 1, 1, /* Min paper size */ |
| 1357 | PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600, |
| 1358 | {12, 12, 18, 18}, |
| 1359 | {12, 12, 18, 18}, /* Check/Fix */ |
| 1360 | PCL_COLOR_NONE, |
| 1361 | PCL_PRINTER_LJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | |
| 1362 | PCL_PRINTER_DUPLEX | PCL_PRINTER_COPIES, |
| 1363 | ljsmall_papersizes, |
| 1364 | emptylist, |
| 1365 | laserjet_papersources, |
| 1366 | }, |
| 1367 | /* PCL-5c/5e/6/XL with large paper, no expanded A4 margins */ |
| 1368 | { 63, |
| 1369 | 13 * 72, 19 * 72, |
| 1370 | 1, 1, /* Min paper size */ |
| 1371 | PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600, |
| 1372 | {12, 12, 18, 18}, |
| 1373 | {12, 12, 18, 18}, /* Check/Fix */ |
| 1374 | PCL_COLOR_NONE, |
| 1375 | PCL_PRINTER_LJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | |
| 1376 | PCL_PRINTER_DUPLEX | PCL_PRINTER_COPIES, |
| 1377 | ljbig_papersizes, |
| 1378 | emptylist, |
| 1379 | laserjet_papersources, |
| 1380 | }, |
| 1381 | /* PCL-5c/5e/6/XL with tabloid paper, no expanded A4 margins */ |
| 1382 | { 64, |
| 1383 | 118 * 72 / 10, 17 * 72, |
| 1384 | 1, 1, /* Min paper size */ |
| 1385 | PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600, |
| 1386 | {12, 12, 18, 18}, |
| 1387 | {12, 12, 18, 18}, /* Check/Fix */ |
| 1388 | PCL_COLOR_NONE, |
| 1389 | PCL_PRINTER_LJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | |
| 1390 | PCL_PRINTER_DUPLEX | PCL_PRINTER_COPIES, |
| 1391 | ljtabloid_papersizes, |
| 1392 | emptylist, |
| 1393 | laserjet_papersources, |
| 1394 | }, |
| 1395 | /* LaserJet 5Si */ |
| 1396 | { 7, |
| 1397 | 13 * 72, 19 * 72, |
| 1398 | 1, 1, /* Min paper size */ |
| 1399 | PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600, |
| 1400 | {12, 12, 18, 18}, |
| 1401 | {12, 12, 10, 10}, /* Check/Fix */ |
| 1402 | PCL_COLOR_NONE, |
| 1403 | PCL_PRINTER_LJ | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | |
| 1404 | PCL_PRINTER_DUPLEX | PCL_PRINTER_COPIES, |
| 1405 | ljbig_papersizes, |
| 1406 | emptylist, |
| 1407 | laserjet_papersources, |
| 1408 | }, |
| 1409 | /* Color laser printer, small format */ |
| 1410 | { 50000, |
| 1411 | 17 * 72 / 2, 14 * 72, |
| 1412 | 1, 1, /* Min paper size */ |
| 1413 | PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600, |
| 1414 | {12, 12, 18, 18}, |
| 1415 | {12, 12, 10, 10}, /* Check/Fix */ |
| 1416 | PCL_COLOR_RGB, |
| 1417 | PCL_PRINTER_LJ_COLOR | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | |
| 1418 | PCL_PRINTER_DUPLEX | PCL_PRINTER_COPIES, |
| 1419 | ljsmall_papersizes, |
| 1420 | emptylist, |
| 1421 | laserjet_papersources, |
| 1422 | }, |
| 1423 | /* Color laser printer, large format */ |
| 1424 | { 50001, |
| 1425 | 13 * 72, 19 * 72, |
| 1426 | 1, 1, /* Min paper size */ |
| 1427 | PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600, |
| 1428 | {12, 12, 18, 18}, |
| 1429 | {12, 12, 10, 10}, /* Check/Fix */ |
| 1430 | PCL_COLOR_RGB, |
| 1431 | PCL_PRINTER_LJ_COLOR | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | |
| 1432 | PCL_PRINTER_DUPLEX | PCL_PRINTER_COPIES, |
| 1433 | ljbig_papersizes, |
| 1434 | emptylist, |
| 1435 | laserjet_papersources, |
| 1436 | }, |
| 1437 | /* Color laser printer, small format, no expanded A4 margins */ |
| 1438 | { 50002, |
| 1439 | 17 * 72 / 2, 14 * 72, |
| 1440 | 1, 1, /* Min paper size */ |
| 1441 | PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600, |
| 1442 | {12, 12, 18, 18}, |
| 1443 | {12, 12, 18, 18}, /* Check/Fix */ |
| 1444 | PCL_COLOR_RGB, |
| 1445 | PCL_PRINTER_LJ_COLOR | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | |
| 1446 | PCL_PRINTER_DUPLEX | PCL_PRINTER_COPIES, |
| 1447 | ljsmall_papersizes, |
| 1448 | emptylist, |
| 1449 | laserjet_papersources, |
| 1450 | }, |
| 1451 | /* Color laser printer with large paper, no expanded A4 margins */ |
| 1452 | { 50003, |
| 1453 | 13 * 72, 19 * 72, |
| 1454 | 1, 1, /* Min paper size */ |
| 1455 | PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600, |
| 1456 | {12, 12, 18, 18}, |
| 1457 | {12, 12, 18, 18}, /* Check/Fix */ |
| 1458 | PCL_COLOR_RGB, |
| 1459 | PCL_PRINTER_LJ_COLOR | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | |
| 1460 | PCL_PRINTER_DUPLEX | PCL_PRINTER_COPIES, |
| 1461 | ljbig_papersizes, |
| 1462 | emptylist, |
| 1463 | laserjet_papersources, |
| 1464 | }, |
| 1465 | /* Color laser printer with tabloid paper, no expanded A4 margins */ |
| 1466 | { 50004, |
| 1467 | 118 * 72 / 10, 17 * 72, /* 11.8*17 */ |
| 1468 | 1, 1, /* Min paper size */ |
| 1469 | PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600, |
| 1470 | {12, 12, 18, 18}, |
| 1471 | {12, 12, 18, 18}, /* Check/Fix */ |
| 1472 | PCL_COLOR_RGB, |
| 1473 | PCL_PRINTER_LJ_COLOR | PCL_PRINTER_NEW_ERG | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | |
| 1474 | PCL_PRINTER_DUPLEX | PCL_PRINTER_COPIES, |
| 1475 | ljtabloid_papersizes, |
| 1476 | emptylist, |
| 1477 | laserjet_papersources, |
| 1478 | }, |
| 1479 | /* Special case the Color LaserJet 5 */ |
| 1480 | { 50012, |
| 1481 | 17 * 72 / 2, 14 * 72, |
| 1482 | 1, 1, /* Min paper size */ |
| 1483 | PCL_RES_150_150 | PCL_RES_300_300 | PCL_RES_600_600, |
| 1484 | {12, 12, 18, 18}, |
| 1485 | {12, 12, 18, 18}, /* Check/Fix */ |
| 1486 | PCL_COLOR_RGB, |
| 1487 | PCL_PRINTER_LJ_COLOR | PCL_PRINTER_TIFF | PCL_PRINTER_BLANKLINE | |
| 1488 | PCL_PRINTER_DUPLEX | PCL_PRINTER_COPIES, |
| 1489 | ljsmall_papersizes, |
| 1490 | emptylist, |
| 1491 | laserjet_papersources, |
| 1492 | }, |
| 1493 | }; |
| 1494 | |
| 1495 | static const char UNUSED standard_sat_adjustment[] = |
| 1496 | "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" |
| 1497 | "<gutenprint>\n" |
| 1498 | "<curve wrap=\"wrap\" type=\"linear\" gamma=\"0\">\n" |
| 1499 | "<sequence count=\"48\" lower-bound=\"0\" upper-bound=\"4\">\n" |
| 1500 | /* C */ "1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 " /* B */ |
| 1501 | /* B */ "1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 " /* M */ |
| 1502 | /* M */ "1.00 0.95 0.90 0.90 0.90 0.90 0.90 0.90 " /* R */ |
| 1503 | /* R */ "0.90 0.95 0.95 1.00 1.00 1.00 1.00 1.00 " /* Y */ |
| 1504 | /* Y */ "1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 " /* G */ |
| 1505 | /* G */ "1.00 1.00 1.00 1.00 1.00 1.00 1.00 1.00 " /* C */ |
| 1506 | "</sequence>\n" |
| 1507 | "</curve>\n" |
| 1508 | "</gutenprint>\n"; |
| 1509 | |
| 1510 | static const char standard_lum_adjustment[] = |
| 1511 | "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" |
| 1512 | "<gutenprint>\n" |
| 1513 | "<curve wrap=\"wrap\" type=\"linear\" gamma=\"0\">\n" |
| 1514 | "<sequence count=\"48\" lower-bound=\"0\" upper-bound=\"4\">\n" |
| 1515 | /* C */ "0.65 0.67 0.70 0.72 0.77 0.80 0.82 0.85 " /* B */ |
| 1516 | /* B */ "0.87 0.86 0.82 0.79 0.79 0.82 0.85 0.88 " /* M */ |
| 1517 | /* M */ "0.92 0.95 0.96 0.97 0.97 0.97 0.96 0.96 " /* R */ |
| 1518 | /* R */ "0.96 0.97 0.97 0.98 0.99 1.00 1.00 1.00 " /* Y */ |
| 1519 | /* Y */ "1.00 0.97 0.95 0.94 0.93 0.92 0.90 0.86 " /* G */ |
| 1520 | /* G */ "0.79 0.76 0.71 0.68 0.68 0.68 0.68 0.66 " /* C */ |
| 1521 | "</sequence>\n" |
| 1522 | "</curve>\n" |
| 1523 | "</gutenprint>\n"; |
| 1524 | |
| 1525 | static const char standard_hue_adjustment[] = |
| 1526 | "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" |
| 1527 | "<gutenprint>\n" |
| 1528 | "<curve wrap=\"wrap\" type=\"linear\" gamma=\"0\">\n" |
| 1529 | "<sequence count=\"48\" lower-bound=\"-6\" upper-bound=\"6\">\n" |
| 1530 | /* C */ "0.00 0.06 0.10 0.10 0.06 -.01 -.09 -.17 " /* B */ |
| 1531 | /* B */ "-.25 -.33 -.38 -.38 -.36 -.34 -.34 -.34 " /* M */ |
| 1532 | /* M */ "-.34 -.34 -.36 -.40 -.50 -.40 -.30 -.20 " /* R */ |
| 1533 | /* R */ "-.12 -.07 -.04 -.02 0.00 0.00 0.00 0.00 " /* Y */ |
| 1534 | /* Y */ "0.00 0.00 0.00 -.05 -.10 -.15 -.22 -.24 " /* G */ |
| 1535 | /* G */ "-.26 -.30 -.33 -.28 -.25 -.20 -.13 -.06 " /* C */ |
| 1536 | "</sequence>\n" |
| 1537 | "</curve>\n" |
| 1538 | "</gutenprint>\n"; |
| 1539 | |
| 1540 | static const stp_parameter_t the_parameters[] = |
| 1541 | { |
| 1542 | { |
| 1543 | "PageSize", N_("Page Size"), "Color=No,Category=Basic Printer Setup", |
| 1544 | N_("Size of the paper being printed to"), |
| 1545 | STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_CORE, |
| 1546 | STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0 |
| 1547 | }, |
| 1548 | { |
| 1549 | "MediaType", N_("Media Type"), "Color=Yes,Category=Basic Printer Setup", |
| 1550 | N_("Type of media (plain paper, photo paper, etc.)"), |
| 1551 | STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE, |
| 1552 | STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0 |
| 1553 | }, |
| 1554 | { |
| 1555 | "InputSlot", N_("Media Source"), "Color=No,Category=Basic Printer Setup", |
| 1556 | N_("Source (input slot) of the media"), |
| 1557 | STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE, |
| 1558 | STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0 |
| 1559 | }, |
| 1560 | { |
| 1561 | "Quality", N_("Print Quality"), "Color=Yes,Category=Basic Output Adjustment", |
| 1562 | N_("Print Quality"), |
| 1563 | STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE, |
| 1564 | STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 0, 0 |
| 1565 | }, |
| 1566 | { |
| 1567 | "Resolution", N_("Resolution"), "Color=Yes,Category=Basic Printer Setup", |
| 1568 | N_("Resolution of the print"), |
| 1569 | STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE, |
| 1570 | STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0 |
| 1571 | }, |
| 1572 | { |
| 1573 | "InkType", N_("Ink Type"), "Color=Yes,Category=Advanced Printer Setup", |
| 1574 | N_("Type of ink in the printer"), |
| 1575 | STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE, |
| 1576 | STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0 |
| 1577 | }, |
| 1578 | { |
| 1579 | "InkChannels", N_("Ink Channels"), "Color=Yes,Category=Advanced Printer Functionality", |
| 1580 | N_("Ink Channels"), |
| 1581 | STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE, |
| 1582 | STP_PARAMETER_LEVEL_INTERNAL, 0, 0, STP_CHANNEL_NONE, 0, 0 |
| 1583 | }, |
| 1584 | { |
| 1585 | "PrintingMode", N_("Printing Mode"), "Color=Yes,Category=Core Parameter", |
| 1586 | N_("Printing Output Mode"), |
| 1587 | STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_CORE, |
| 1588 | STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0 |
| 1589 | }, |
| 1590 | { |
| 1591 | "Duplex", N_("Double-Sided Printing"), "Color=No,Category=Basic Printer Setup", |
| 1592 | N_("Duplex/Tumble Setting"), |
| 1593 | STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE, |
| 1594 | STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0 |
| 1595 | }, |
| 1596 | { |
| 1597 | "Orientation", N_("Orientation"), "Color=No,Category=Basic Printer Setup", |
| 1598 | N_("Orientation, Portrait, Landscape, Upside Down, Seascape"), |
| 1599 | STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE, |
| 1600 | STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0, |
| 1601 | }, |
| 1602 | { |
| 1603 | "LabelSeparator", N_("Paper Sensor Type"), |
| 1604 | "Color=No,Category=Basic Printer Setup", |
| 1605 | N_("Gap, Mark on Top, Mark on Bottom, Notch, Continuous"), |
| 1606 | STP_PARAMETER_TYPE_STRING_LIST, STP_PARAMETER_CLASS_FEATURE, |
| 1607 | STP_PARAMETER_LEVEL_BASIC, 1, 1, STP_CHANNEL_NONE, 1, 0, |
| 1608 | }, |
| 1609 | { |
| 1610 | "Darkness", N_("Darkness"), "Color=No,Category=Basic Printer Setup", |
| 1611 | N_("Darkness Adjust, from -20 to 20"), |
| 1612 | STP_PARAMETER_TYPE_INT, STP_PARAMETER_CLASS_FEATURE, |
| 1613 | STP_PARAMETER_LEVEL_BASIC, 0, 1, STP_CHANNEL_NONE, 1, 0 |
| 1614 | }, |
| 1615 | { |
| 1616 | "NativeCopies", N_("Printer Generates Copies Natively"), "Color=No,Category=Job Mode", |
| 1617 | N_("Printer Generates Copies"), |
| 1618 | STP_PARAMETER_TYPE_BOOLEAN, STP_PARAMETER_CLASS_FEATURE, |
| 1619 | STP_PARAMETER_LEVEL_INTERNAL, 1, 0, STP_CHANNEL_NONE, 0, 1 |
| 1620 | }, |
| 1621 | }; |
| 1622 | |
| 1623 | static const unsigned int the_parameter_count = |
| 1624 | sizeof(the_parameters) / sizeof(const stp_parameter_t); |
| 1625 | |
| 1626 | typedef struct |
| 1627 | { |
| 1628 | const stp_parameter_t param; |
| 1629 | double min; |
| 1630 | double max; |
| 1631 | double defval; |
| 1632 | int color_only; |
| 1633 | } float_param_t; |
| 1634 | |
| 1635 | static const float_param_t float_parameters[] = |
| 1636 | { |
| 1637 | { |
| 1638 | { |
| 1639 | "CyanDensity", N_("Cyan Density"), "Color=Yes,Category=Output Level Adjustment", |
| 1640 | N_("Adjust the cyan density"), |
| 1641 | STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, |
| 1642 | STP_PARAMETER_LEVEL_ADVANCED, 0, 1, 1, 1, 0 |
| 1643 | }, 0.0, 2.0, 1.0, 1 |
| 1644 | }, |
| 1645 | { |
| 1646 | { |
| 1647 | "MagentaDensity", N_("Magenta Density"), "Color=Yes,Category=Output Level Adjustment", |
| 1648 | N_("Adjust the magenta density"), |
| 1649 | STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, |
| 1650 | STP_PARAMETER_LEVEL_ADVANCED, 0, 1, 2, 1, 0 |
| 1651 | }, 0.0, 2.0, 1.0, 1 |
| 1652 | }, |
| 1653 | { |
| 1654 | { |
| 1655 | "YellowDensity", N_("Yellow Density"), "Color=Yes,Category=Output Level Adjustment", |
| 1656 | N_("Adjust the yellow density"), |
| 1657 | STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, |
| 1658 | STP_PARAMETER_LEVEL_ADVANCED, 0, 1, 3, 1, 0 |
| 1659 | }, 0.0, 2.0, 1.0, 1 |
| 1660 | }, |
| 1661 | { |
| 1662 | { |
| 1663 | "RedDensity", N_("Red Density"), "Color=Yes,Category=Output Level Adjustment", |
| 1664 | N_("Adjust the red density"), |
| 1665 | STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, |
| 1666 | STP_PARAMETER_LEVEL_ADVANCED, 0, 1, 5, 1, 0 |
| 1667 | }, 0.0, 1.0, 1.0, 1 |
| 1668 | }, |
| 1669 | { |
| 1670 | { |
| 1671 | "GreenDensity", N_("Green Density"), "Color=Yes,Category=Output Level Adjustment", |
| 1672 | N_("Adjust the green density"), |
| 1673 | STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, |
| 1674 | STP_PARAMETER_LEVEL_ADVANCED, 0, 1, 5, 1, 0 |
| 1675 | }, 0.0, 1.0, 1.0, 1 |
| 1676 | }, |
| 1677 | { |
| 1678 | { |
| 1679 | "BlueDensity", N_("Blue Density"), "Color=Yes,Category=Output Level Adjustment", |
| 1680 | N_("Adjust the blue density"), |
| 1681 | STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, |
| 1682 | STP_PARAMETER_LEVEL_ADVANCED, 0, 1, 4, 1, 0 |
| 1683 | }, 0.0, 1.0, 1.0, 1 |
| 1684 | }, |
| 1685 | { |
| 1686 | { |
| 1687 | "BlackDensity", N_("Black Density"), "Color=Yes,Category=Output Level Adjustment", |
| 1688 | N_("Adjust the black density"), |
| 1689 | STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, |
| 1690 | STP_PARAMETER_LEVEL_ADVANCED, 0, 1, 0, 1, 0 |
| 1691 | }, 0.0, 2.0, 1.0, 1 |
| 1692 | }, |
| 1693 | { |
| 1694 | { |
| 1695 | "LightCyanTrans", N_("Light Cyan Transition"), "Color=Yes,Category=Advanced Ink Adjustment", |
| 1696 | N_("Light Cyan Transition"), |
| 1697 | STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, |
| 1698 | STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, STP_CHANNEL_NONE, 1, 0 |
| 1699 | }, 0.0, 5.0, 1.0, 1 |
| 1700 | }, |
| 1701 | { |
| 1702 | { |
| 1703 | "LightMagentaTrans", N_("Light Magenta Transition"), "Color=Yes,Category=Advanced Ink Adjustment", |
| 1704 | N_("Light Magenta Transition"), |
| 1705 | STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, |
| 1706 | STP_PARAMETER_LEVEL_ADVANCED4, 0, 1, STP_CHANNEL_NONE, 1, 0 |
| 1707 | }, 0.0, 5.0, 1.0, 1 |
| 1708 | }, |
| 1709 | { |
| 1710 | { |
| 1711 | "HorizOffset", N_("Horizontal Offset"), |
| 1712 | "Color=No,Category=Basic Output Adjustment", |
| 1713 | N_("Adjust horizontal position"), |
| 1714 | STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, |
| 1715 | STP_PARAMETER_LEVEL_ADVANCED3, 1, 1, STP_CHANNEL_NONE, 1, 0, |
| 1716 | }, 0.0, 4.0, 0.0, 0 |
| 1717 | }, |
| 1718 | { |
| 1719 | { |
| 1720 | "VertOffset", N_("Vertical Offset"), |
| 1721 | "Color=No,Category=Basic Output Adjustment", |
| 1722 | N_("Adjust vertical position"), |
| 1723 | STP_PARAMETER_TYPE_DOUBLE, STP_PARAMETER_CLASS_OUTPUT, |
| 1724 | STP_PARAMETER_LEVEL_ADVANCED3, 1, 1, STP_CHANNEL_NONE, 1, 0, |
| 1725 | }, 0.0, 10.0, 0.0, 0 |
| 1726 | }, |
| 1727 | }; |
| 1728 | |
| 1729 | static const unsigned int float_parameter_count = |
| 1730 | sizeof(float_parameters) / sizeof(const float_param_t); |
| 1731 | |
| 1732 | /* |
| 1733 | * Convert a name into it's option value |
| 1734 | */ |
| 1735 | |
| 1736 | static int pcl_string_to_val(const stp_vars_t *v, |
| 1737 | const char *string, /* I: String */ |
| 1738 | const pcl_t *options, /* I: Options */ |
| 1739 | int num_options) /* I: Num options */ |
| 1740 | { |
| 1741 | |
| 1742 | int i; |
| 1743 | int code = -1; |
| 1744 | |
| 1745 | /* |
| 1746 | * Look up the string in the table and convert to the code. |
| 1747 | */ |
| 1748 | |
| 1749 | for (i=0; i<num_options; i++) { |
| 1750 | if (!strcmp(string, options[i].pcl_name)) { |
| 1751 | code=options[i].pcl_code; |
| 1752 | break; |
| 1753 | } |
| 1754 | } |
| 1755 | |
| 1756 | stp_dprintf(STP_DBG_PCL, v, "String: %s, Code: %d\n", string, code); |
| 1757 | |
| 1758 | return(code); |
| 1759 | } |
| 1760 | |
| 1761 | /* |
| 1762 | * Convert a value into it's option name |
| 1763 | */ |
| 1764 | |
| 1765 | static const char * pcl_val_to_string(const stp_vars_t *v, |
| 1766 | int code, /* I: Code */ |
| 1767 | const pcl_t *options, /* I: Options */ |
| 1768 | int num_options) /* I: Num options */ |
| 1769 | { |
| 1770 | |
| 1771 | int i; |
| 1772 | const char *string = "<null>"; |
| 1773 | |
| 1774 | /* |
| 1775 | * Look up the code in the table and convert to the string. |
| 1776 | */ |
| 1777 | |
| 1778 | for (i=0; i<num_options; i++) { |
| 1779 | if (code == options[i].pcl_code) { |
| 1780 | string=options[i].pcl_name; |
| 1781 | break; |
| 1782 | } |
| 1783 | } |
| 1784 | |
| 1785 | stp_dprintf(STP_DBG_PCL, v, "Code: %d, String: %s\n", code, string); |
| 1786 | |
| 1787 | return(string); |
| 1788 | } |
| 1789 | |
| 1790 | static const char * pcl_val_to_text(const stp_vars_t *v, |
| 1791 | int code, /* I: Code */ |
| 1792 | const pcl_t *options, /* I: Options */ |
| 1793 | int num_options) /* I: Num options */ |
| 1794 | { |
| 1795 | |
| 1796 | int i; |
| 1797 | const char *string = "<null>"; |
| 1798 | |
| 1799 | /* |
| 1800 | * Look up the code in the table and convert to the string. |
| 1801 | */ |
| 1802 | |
| 1803 | for (i=0; i<num_options; i++) { |
| 1804 | if (code == options[i].pcl_code) { |
| 1805 | string=gettext(options[i].pcl_text); |
| 1806 | break; |
| 1807 | } |
| 1808 | } |
| 1809 | |
| 1810 | stp_dprintf(STP_DBG_PCL, v, "Code: %d, String: %s\n", code, string); |
| 1811 | |
| 1812 | return(string); |
| 1813 | } |
| 1814 | |
| 1815 | static const double dot_sizes[] = { 0.5, 0.832, 1.0 }; |
| 1816 | static const double dot_sizes_cret[] = { 1.0, 1.0, 1.0 }; |
| 1817 | |
| 1818 | static const stp_dotsize_t variable_dotsizes[] = |
| 1819 | { |
| 1820 | { 0x1, 0.5 }, |
| 1821 | { 0x2, 0.67 }, |
| 1822 | { 0x3, 1.0 } |
| 1823 | }; |
| 1824 | |
| 1825 | static const stp_shade_t variable_shades[] = |
| 1826 | { |
| 1827 | { 0.38, 3, variable_dotsizes }, |
| 1828 | { 1.0, 3, variable_dotsizes } |
| 1829 | }; |
| 1830 | |
| 1831 | /* |
| 1832 | * pcl_get_model_capabilities() - Return struct of model capabilities |
| 1833 | */ |
| 1834 | |
| 1835 | static const pcl_cap_t * /* O: Capabilities */ |
| 1836 | pcl_get_model_capabilities(const stp_vars_t *v) /* I: Model */ |
| 1837 | { |
| 1838 | int i; |
| 1839 | int model = stp_get_model_id(v); |
| 1840 | int models= sizeof(pcl_model_capabilities) / sizeof(pcl_cap_t); |
| 1841 | for (i=0; i<models; i++) { |
| 1842 | if (pcl_model_capabilities[i].model == model) { |
| 1843 | return &(pcl_model_capabilities[i]); |
| 1844 | } |
| 1845 | } |
| 1846 | stp_eprintf(v, "pcl: model %d not found in capabilities list.\n",model); |
| 1847 | return &(pcl_model_capabilities[0]); |
| 1848 | } |
| 1849 | |
| 1850 | /* |
| 1851 | * Determine the current resolution based on quality and resolution settings |
| 1852 | */ |
| 1853 | |
| 1854 | static void |
| 1855 | pcl_describe_resolution(const stp_vars_t *v, stp_resolution_t *x, stp_resolution_t *y) |
| 1856 | { |
| 1857 | unsigned int i; |
| 1858 | const char *resolution = stp_get_string_parameter(v, "Resolution"); |
| 1859 | const char *quality; |
| 1860 | const pcl_cap_t *caps = NULL; |
| 1861 | if (resolution) |
| 1862 | { |
| 1863 | for (i = 0; i < NUM_RESOLUTIONS; i++) |
| 1864 | { |
| 1865 | if (!strcmp(resolution, pcl_resolutions[i].pcl_name)) |
| 1866 | { |
| 1867 | *x = pcl_resolutions[i].p0; |
| 1868 | *y = pcl_resolutions[i].p1; |
| 1869 | return; |
| 1870 | } |
| 1871 | } |
| 1872 | } |
| 1873 | quality = stp_get_string_parameter(v, "Quality"); |
| 1874 | caps = pcl_get_model_capabilities(v); |
| 1875 | if (quality && strcmp(quality, "None") == 0) |
| 1876 | quality = "Standard"; |
| 1877 | if (quality) |
| 1878 | { |
| 1879 | for (i = 0; i < NUM_QUALITIES; i++) |
| 1880 | { |
| 1881 | if ((caps->resolutions & pcl_qualities[i].pcl_code) && |
| 1882 | !strcmp(quality, pcl_qualities[i].pcl_name)) |
| 1883 | { |
| 1884 | *x = (stp_dimension_t) pcl_qualities[i].p0; |
| 1885 | *y = (stp_dimension_t) pcl_qualities[i].p1; |
| 1886 | return; |
| 1887 | } |
| 1888 | } |
| 1889 | } |
| 1890 | *x = -1; |
| 1891 | *y = -1; |
| 1892 | } |
| 1893 | |
| 1894 | /* |
| 1895 | * Convert Media size name into PCL media code for printer |
| 1896 | */ |
| 1897 | |
| 1898 | static int pcl_convert_media_size(const stp_vars_t *v, |
| 1899 | const char *media_size) |
| 1900 | { |
| 1901 | |
| 1902 | unsigned int i; |
| 1903 | int media_code = 0; |
| 1904 | const pcl_cap_t *caps; |
| 1905 | |
| 1906 | /* |
| 1907 | * First look up the media size in the table and convert to the code. |
| 1908 | */ |
| 1909 | |
| 1910 | media_code = pcl_string_to_val(v, media_size, pcl_media_sizes, |
| 1911 | NUM_PRINTER_PAPER_SIZES); |
| 1912 | |
| 1913 | stp_dprintf(STP_DBG_PCL, v, "Media Size: %s, Code: %d\n", media_size, media_code); |
| 1914 | |
| 1915 | /* |
| 1916 | * Now see if the printer supports the code found. |
| 1917 | */ |
| 1918 | |
| 1919 | if (media_code != -1) { |
| 1920 | int model = stp_get_model_id(v); |
| 1921 | caps = pcl_get_model_capabilities(v); |
| 1922 | |
| 1923 | for (i=0; (i<NUM_PRINTER_PAPER_SIZES) && (caps->paper_sizes[i] != -1); i++) { |
| 1924 | if (media_code == (int) caps->paper_sizes[i]) |
| 1925 | return(media_code); /* Is supported */ |
| 1926 | } |
| 1927 | |
| 1928 | stp_dprintf(STP_DBG_PCL, v, "Media Code %d not supported by printer model %d.\n", |
| 1929 | media_code, model); |
| 1930 | return(-1); /* Not supported */ |
| 1931 | } |
| 1932 | else |
| 1933 | return(-1); /* Not supported */ |
| 1934 | } |
| 1935 | |
| 1936 | |
| 1937 | static const stp_param_string_t ink_types[] = |
| 1938 | { |
| 1939 | { "CMYK", N_ ("Color + Black Cartridges") }, |
| 1940 | { "Photo", N_ ("Color + Photo Cartridges") } |
| 1941 | }; |
| 1942 | |
| 1943 | /* |
| 1944 | * Duplex support - modes available |
| 1945 | * Note that the internal names MUST match those in cups/genppd.c else the |
| 1946 | * PPD files will not be generated correctly |
| 1947 | */ |
| 1948 | |
| 1949 | static const stp_param_string_t duplex_types[] = |
| 1950 | { |
| 1951 | { "None", N_ ("Off") }, |
| 1952 | { "DuplexNoTumble", N_ ("Long Edge (Standard)") }, |
| 1953 | { "DuplexTumble", N_ ("Short Edge (Flip)") } |
| 1954 | }; |
| 1955 | #define NUM_DUPLEX (sizeof (duplex_types) / sizeof (stp_param_string_t)) |
| 1956 | |
| 1957 | /* |
| 1958 | * Orientation support - modes available |
| 1959 | * Note that the internal names MUST match those in cups/genppd.c else the |
| 1960 | * PPD files will not be generated correctly |
| 1961 | */ |
| 1962 | |
| 1963 | static const stp_param_string_t orientation_types[] = |
| 1964 | { |
| 1965 | { "Portrait", N_ ("Portrait") }, |
| 1966 | { "Landscape", N_ ("Landscape") }, |
| 1967 | { "UpsideDown", N_ ("Reverse Portrait") }, |
| 1968 | { "Seascape", N_ ("Reverse Landscape") }, |
| 1969 | }; |
| 1970 | #define NUM_ORIENTATION (sizeof (orientation_types) / sizeof (stp_param_string_t)) |
| 1971 | |
| 1972 | /* |
| 1973 | * Label Separator Support for D-O printers, modes available |
| 1974 | */ |
| 1975 | |
| 1976 | static const stp_param_string_t label_separator_types[] = |
| 1977 | { |
| 1978 | { "IGNORE", N_ ("Keep Previous") }, |
| 1979 | { "GAP", N_ ("Gap") }, |
| 1980 | { "TOP", N_ ("Mark on Top") }, |
| 1981 | { "BOTTOM", N_ ("Mark on Bottom") }, |
| 1982 | { "NOTCH", N_ ("Notch") }, |
| 1983 | { "NONE", N_ ("Continuous") }, |
| 1984 | }; |
| 1985 | #define NUM_LABEL_SEPARATOR (sizeof (label_separator_types) / sizeof (stp_param_string_t)) |
| 1986 | |
| 1987 | /* |
| 1988 | * 'pcl_papersize_valid()' - Is the paper size valid for this printer. |
| 1989 | */ |
| 1990 | |
| 1991 | static int |
| 1992 | pcl_papersize_valid(const stp_vars_t *v, |
| 1993 | const stp_papersize_t *pt) |
| 1994 | { |
| 1995 | |
| 1996 | const pcl_cap_t *caps = pcl_get_model_capabilities(v); |
| 1997 | |
| 1998 | #ifdef PCL_NO_CUSTOM_PAPERSIZES |
| 1999 | int use_custom = 0; |
| 2000 | #else |
| 2001 | int use_custom = ((caps->stp_printer_type & PCL_PRINTER_CUSTOM_SIZE) |
| 2002 | == PCL_PRINTER_CUSTOM_SIZE); |
| 2003 | #endif |
| 2004 | |
| 2005 | unsigned int pwidth = pt->width; |
| 2006 | unsigned int pheight = pt->height; |
| 2007 | |
| 2008 | /* |
| 2009 | * This function decides whether a paper size is allowed for the |
| 2010 | * current printer. The DeskJet feed mechanisms set a minimum and |
| 2011 | * maximum size for the paper, BUT some of the directly supported |
| 2012 | * media sizes are less than this minimum (eg card and envelopes) |
| 2013 | * So, we allow supported sizes though, but clamp custom sizes |
| 2014 | * to the min and max sizes. |
| 2015 | */ |
| 2016 | |
| 2017 | /* |
| 2018 | * Is it a valid name? |
| 2019 | */ |
| 2020 | |
| 2021 | if (strlen(pt->name) <= 0) |
| 2022 | return(0); |
| 2023 | |
| 2024 | /* |
| 2025 | * Is it a valid type? |
| 2026 | */ |
| 2027 | if (pt->paper_size_type != PAPERSIZE_TYPE_STANDARD && |
| 2028 | pt->paper_size_type != PAPERSIZE_TYPE_ENVELOPE) |
| 2029 | return(0); |
| 2030 | |
| 2031 | /* |
| 2032 | * Is it a recognized supported name? |
| 2033 | */ |
| 2034 | |
| 2035 | if (pcl_convert_media_size(v, pt->name) != -1) |
| 2036 | return(1); |
| 2037 | |
| 2038 | /* |
| 2039 | * If we are not allowed to use custom paper sizes, we are done |
| 2040 | */ |
| 2041 | |
| 2042 | if (use_custom == 0) |
| 2043 | return(0); |
| 2044 | |
| 2045 | /* |
| 2046 | * We are allowed custom paper sizes. Check that the name contains |
| 2047 | * d-o if this is the Datamax O'Neil label printer and not custom paper |
| 2048 | */ |
| 2049 | |
| 2050 | if (caps->stp_printer_type & PCL_PRINTER_LABEL) { |
| 2051 | if (strcmp(pt->name, "Custom")) { |
| 2052 | if (NULL != strstr(pt->name, "d-o")) { |
| 2053 | return(1); |
| 2054 | } else { |
| 2055 | return(0); |
| 2056 | } |
| 2057 | } |
| 2058 | } |
| 2059 | |
| 2060 | |
| 2061 | /* |
| 2062 | * We are allowed custom paper sizes. Check that the size is within |
| 2063 | * limits. |
| 2064 | */ |
| 2065 | |
| 2066 | if (pwidth <= caps->custom_max_width && |
| 2067 | pheight <= caps->custom_max_height && |
| 2068 | (pheight >= caps->custom_min_height || pheight == 0) && |
| 2069 | (pwidth >= caps->custom_min_width || pwidth == 0)) |
| 2070 | return(1); |
| 2071 | |
| 2072 | return(0); |
| 2073 | } |
| 2074 | |
| 2075 | /* |
| 2076 | * 'pcl_parameters()' - Return the parameter values for the given parameter. |
| 2077 | */ |
| 2078 | |
| 2079 | static stp_parameter_list_t |
| 2080 | pcl_list_parameters(const stp_vars_t *v) |
| 2081 | { |
| 2082 | stp_parameter_list_t *ret = stp_parameter_list_create(); |
| 2083 | stp_parameter_list_t *tmp_list; |
| 2084 | |
| 2085 | unsigned int i; |
| 2086 | |
| 2087 | /* Set up dithering */ |
| 2088 | tmp_list = stp_dither_list_parameters(v); |
| 2089 | stp_parameter_list_append(ret, tmp_list); |
| 2090 | stp_parameter_list_destroy(tmp_list); |
| 2091 | |
| 2092 | for (i = 0; i < the_parameter_count; i++) |
| 2093 | stp_parameter_list_add_param(ret, &(the_parameters[i])); |
| 2094 | for (i = 0; i < float_parameter_count; i++) |
| 2095 | stp_parameter_list_add_param(ret, &(float_parameters[i].param)); |
| 2096 | return ret; |
| 2097 | } |
| 2098 | |
| 2099 | static void |
| 2100 | pcl_parameters(const stp_vars_t *v, const char *name, |
| 2101 | stp_parameter_t *description) |
| 2102 | { |
| 2103 | int model = stp_get_model_id(v); |
| 2104 | unsigned int i; |
| 2105 | const pcl_cap_t *caps; |
| 2106 | description->p_type = STP_PARAMETER_TYPE_INVALID; |
| 2107 | |
| 2108 | if (name == NULL) |
| 2109 | return; |
| 2110 | |
| 2111 | stp_dprintf(STP_DBG_PCL, v, "pcl_parameters(): Name = %s\n", name); |
| 2112 | |
| 2113 | caps = pcl_get_model_capabilities(v); |
| 2114 | |
| 2115 | stp_dprintf(STP_DBG_PCL, v, "Printer model = %d\n", model); |
| 2116 | stp_dprintf(STP_DBG_PCL, v, "PageWidth = %d, PageHeight = %d\n", caps->custom_max_width, caps->custom_max_height); |
| 2117 | stp_dprintf(STP_DBG_PCL, v, "MinPageWidth = %d, MinPageHeight = %d\n", caps->custom_min_width, caps->custom_min_height); |
| 2118 | stp_dprintf(STP_DBG_PCL, v, "Normal Margins: top = %d, bottom = %d, left = %d, right = %d\n", |
| 2119 | caps->normal_margins.top_margin, caps->normal_margins.bottom_margin, |
| 2120 | caps->normal_margins.left_margin, caps->normal_margins.right_margin); |
| 2121 | stp_dprintf(STP_DBG_PCL, v, "A4 Margins: top = %d, bottom = %d, left = %d, right = %d\n", |
| 2122 | caps->a4_margins.top_margin, caps->a4_margins.bottom_margin, |
| 2123 | caps->a4_margins.left_margin, caps->a4_margins.right_margin); |
| 2124 | stp_dprintf(STP_DBG_PCL, v, "Resolutions: %d\n", caps->resolutions); |
| 2125 | stp_dprintf(STP_DBG_PCL, v, "ColorType = %d, PrinterType = %d\n", caps->color_type, caps->stp_printer_type); |
| 2126 | |
| 2127 | for (i = 0; i < the_parameter_count; i++) |
| 2128 | if (strcmp(name, the_parameters[i].name) == 0) |
| 2129 | { |
| 2130 | stp_fill_parameter_settings(description, &(the_parameters[i])); |
| 2131 | break; |
| 2132 | } |
| 2133 | description->deflt.str = NULL; |
| 2134 | |
| 2135 | for (i = 0; i < float_parameter_count; i++) |
| 2136 | if (strcmp(name, float_parameters[i].param.name) == 0) |
| 2137 | { |
| 2138 | stp_fill_parameter_settings(description, |
| 2139 | &(float_parameters[i].param)); |
| 2140 | description->deflt.dbl = float_parameters[i].defval; |
| 2141 | description->bounds.dbl.upper = float_parameters[i].max; |
| 2142 | description->bounds.dbl.lower = float_parameters[i].min; |
| 2143 | break; |
| 2144 | } |
| 2145 | |
| 2146 | if (strcmp(name, "PageSize") == 0) |
| 2147 | { |
| 2148 | const stp_papersize_list_t *paper_sizes = |
| 2149 | ((caps->stp_printer_type & PCL_PRINTER_LABEL) ? |
| 2150 | stpi_get_papersize_list_named("labels", "") : |
| 2151 | stpi_get_standard_papersize_list()); |
| 2152 | const stp_papersize_list_item_t *ptli = |
| 2153 | stpi_papersize_list_get_start(paper_sizes); |
| 2154 | description->bounds.str = stp_string_list_create(); |
| 2155 | while (ptli) |
| 2156 | { |
| 2157 | const stp_papersize_t *pt = stpi_paperlist_item_get_data(ptli); |
| 2158 | if (strlen(pt->name) > 0 && pcl_papersize_valid(v, pt)) |
| 2159 | stp_string_list_add_string(description->bounds.str, |
| 2160 | pt->name, gettext(pt->text)); |
| 2161 | ptli = stpi_paperlist_item_next(ptli); |
| 2162 | } |
| 2163 | description->deflt.str = |
| 2164 | stp_string_list_param(description->bounds.str, 0)->name; |
| 2165 | } |
| 2166 | else if (strcmp(name, "MediaType") == 0) |
| 2167 | { |
| 2168 | description->bounds.str = stp_string_list_create(); |
| 2169 | if (caps->paper_types[0] != -1) |
| 2170 | { |
| 2171 | for (i=0; (i < NUM_PRINTER_PAPER_TYPES) && (caps->paper_types[i] != -1); i++) |
| 2172 | stp_string_list_add_string(description->bounds.str, |
| 2173 | pcl_val_to_string(v, caps->paper_types[i], |
| 2174 | pcl_media_types, |
| 2175 | NUM_PRINTER_PAPER_TYPES), |
| 2176 | pcl_val_to_text(v, caps->paper_types[i], |
| 2177 | pcl_media_types, |
| 2178 | NUM_PRINTER_PAPER_TYPES)); |
| 2179 | description->deflt.str = |
| 2180 | stp_string_list_param(description->bounds.str, 0)->name; |
| 2181 | } |
| 2182 | else |
| 2183 | description->is_active = 0; |
| 2184 | } |
| 2185 | else if (strcmp(name, "InputSlot") == 0) |
| 2186 | { |
| 2187 | description->bounds.str = stp_string_list_create(); |
| 2188 | if (caps->paper_sources[0] != -1) |
| 2189 | { |
| 2190 | for (i=0; (i < NUM_PRINTER_PAPER_SOURCES) && (caps->paper_sources[i] != -1); i++) |
| 2191 | stp_string_list_add_string(description->bounds.str, |
| 2192 | pcl_val_to_string(v, caps->paper_sources[i], |
| 2193 | pcl_media_sources, |
| 2194 | NUM_PRINTER_PAPER_SOURCES), |
| 2195 | pcl_val_to_text(v, caps->paper_sources[i], |
| 2196 | pcl_media_sources, |
| 2197 | NUM_PRINTER_PAPER_SOURCES)); |
| 2198 | description->deflt.str = |
| 2199 | stp_string_list_param(description->bounds.str, 0)->name; |
| 2200 | } |
| 2201 | else |
| 2202 | description->is_active = 0; |
| 2203 | } |
| 2204 | else if (strcmp(name, "Resolution") == 0) |
| 2205 | { |
| 2206 | description->bounds.str = stp_string_list_create(); |
| 2207 | stp_string_list_add_string(description->bounds.str, "None", _("Default")); |
| 2208 | description->deflt.str = "None"; |
| 2209 | for (i = 0; i < NUM_RESOLUTIONS; i++) |
| 2210 | if (caps->resolutions & pcl_resolutions[i].pcl_code) |
| 2211 | { |
| 2212 | stp_string_list_add_string |
| 2213 | (description->bounds.str, |
| 2214 | pcl_val_to_string(v, pcl_resolutions[i].pcl_code, |
| 2215 | pcl_resolutions, NUM_RESOLUTIONS), |
| 2216 | pcl_val_to_text(v, pcl_resolutions[i].pcl_code, |
| 2217 | pcl_resolutions, NUM_RESOLUTIONS)); |
| 2218 | } |
| 2219 | } |
| 2220 | else if (strcmp(name, "Quality") == 0) |
| 2221 | { |
| 2222 | int has_standard_quality = 0; |
| 2223 | description->bounds.str = stp_string_list_create(); |
| 2224 | stp_string_list_add_string(description->bounds.str, "None", |
| 2225 | _("Manual Control")); |
| 2226 | for (i = 0; i < NUM_QUALITIES; i++) |
| 2227 | if (caps->resolutions & pcl_qualities[i].pcl_code) |
| 2228 | { |
| 2229 | const char *qual = |
| 2230 | pcl_val_to_string(v, pcl_qualities[i].pcl_code, |
| 2231 | pcl_qualities, NUM_QUALITIES); |
| 2232 | if (! stp_string_list_is_present(description->bounds.str, qual)) |
| 2233 | stp_string_list_add_string |
| 2234 | (description->bounds.str, qual, |
| 2235 | pcl_val_to_text(v, pcl_qualities[i].pcl_code, |
| 2236 | pcl_qualities, NUM_QUALITIES)); |
| 2237 | if (strcmp(qual, "Standard") == 0) |
| 2238 | has_standard_quality = 1; |
| 2239 | } |
| 2240 | if (has_standard_quality) |
| 2241 | description->deflt.str = "Standard"; |
| 2242 | else |
| 2243 | description->deflt.str = "None"; |
| 2244 | } |
| 2245 | else if (strcmp(name, "InkType") == 0) |
| 2246 | { |
| 2247 | description->bounds.str = stp_string_list_create(); |
| 2248 | if (caps->color_type & PCL_COLOR_CMYKcm) |
| 2249 | { |
| 2250 | description->deflt.str = ink_types[0].name; |
| 2251 | stp_string_list_add_string(description->bounds.str, |
| 2252 | ink_types[0].name,gettext(ink_types[0].text)); |
| 2253 | stp_string_list_add_string(description->bounds.str, |
| 2254 | ink_types[1].name,gettext(ink_types[1].text)); |
| 2255 | } |
| 2256 | else |
| 2257 | description->is_active = 0; |
| 2258 | } |
| 2259 | else if (strcmp(name, "Duplex") == 0) |
| 2260 | { |
| 2261 | int offer_duplex=0; |
| 2262 | |
| 2263 | description->bounds.str = stp_string_list_create(); |
| 2264 | |
| 2265 | /* |
| 2266 | * Don't offer the Duplex/Tumble options if the JobMode parameter is |
| 2267 | * set to "Page" Mode. |
| 2268 | * "Page" mode is set by the Gimp Plugin, which only outputs one page at a |
| 2269 | * time, so Duplex/Tumble is meaningless. |
| 2270 | */ |
| 2271 | |
| 2272 | if (stp_get_string_parameter(v, "JobMode")) |
| 2273 | offer_duplex = strcmp(stp_get_string_parameter(v, "JobMode"), "Page"); |
| 2274 | else |
| 2275 | offer_duplex=1; |
| 2276 | |
| 2277 | if (offer_duplex) |
| 2278 | { |
| 2279 | if (caps->stp_printer_type & PCL_PRINTER_DUPLEX) |
| 2280 | { |
| 2281 | description->deflt.str = duplex_types[0].name; |
| 2282 | for (i=0; i < NUM_DUPLEX; i++) |
| 2283 | { |
| 2284 | stp_string_list_add_string(description->bounds.str, |
| 2285 | duplex_types[i].name,gettext(duplex_types[i].text)); |
| 2286 | } |
| 2287 | } |
| 2288 | else |
| 2289 | description->is_active = 0; /* Not supported by printer */ |
| 2290 | } |
| 2291 | else |
| 2292 | description->is_active = 0; /* Not in "Job" mode */ |
| 2293 | } |
| 2294 | else if (strcmp(name, "Orientation") == 0) |
| 2295 | { |
| 2296 | if (caps->stp_printer_type & PCL_PRINTER_LABEL) |
| 2297 | { |
| 2298 | description->bounds.str = stp_string_list_create(); |
| 2299 | description->deflt.str = orientation_types[0].name; |
| 2300 | for (i=0; i < NUM_ORIENTATION; i++) |
| 2301 | { |
| 2302 | stp_string_list_add_string(description->bounds.str, |
| 2303 | orientation_types[i].name,gettext(orientation_types[i].text)); |
| 2304 | } |
| 2305 | } |
| 2306 | else |
| 2307 | { |
| 2308 | description->is_active = 0; |
| 2309 | } |
| 2310 | } |
| 2311 | else if (strcmp(name, "LabelSeparator") == 0) |
| 2312 | { |
| 2313 | if (caps->stp_printer_type & PCL_PRINTER_LABEL) |
| 2314 | { |
| 2315 | description->bounds.str = stp_string_list_create(); |
| 2316 | description->deflt.str = label_separator_types[0].name; |
| 2317 | for (i=0; i < NUM_LABEL_SEPARATOR; i++) |
| 2318 | { |
| 2319 | stp_string_list_add_string(description->bounds.str, |
| 2320 | label_separator_types[i].name, gettext(label_separator_types[i].text)); |
| 2321 | } |
| 2322 | } |
| 2323 | else |
| 2324 | { |
| 2325 | description->is_active = 0; |
| 2326 | } |
| 2327 | } |
| 2328 | else if (strcmp(name, "Darkness") == 0) |
| 2329 | { |
| 2330 | if (caps->stp_printer_type & PCL_PRINTER_LABEL) |
| 2331 | { |
| 2332 | description->deflt.integer = 0; |
| 2333 | description->bounds.integer.lower = -20; |
| 2334 | description->bounds.integer.upper = 20; |
| 2335 | } |
| 2336 | else |
| 2337 | { |
| 2338 | description->is_active = 0; |
| 2339 | } |
| 2340 | } |
| 2341 | else if (strcmp(name, "CyanDensity") == 0 || |
| 2342 | strcmp(name, "MagentaDensity") == 0 || |
| 2343 | strcmp(name, "YellowDensity") == 0 || |
| 2344 | strcmp(name, "BlackDensity") == 0) |
| 2345 | { |
| 2346 | if ((caps->color_type & ~PCL_COLOR_RGB) != PCL_COLOR_NONE && |
| 2347 | stp_check_string_parameter(v, "PrintingMode", STP_PARAMETER_DEFAULTED) && |
| 2348 | strcmp(stp_get_string_parameter(v, "PrintingMode"), "Color") == 0) |
| 2349 | description->is_active = 1; |
| 2350 | else |
| 2351 | description->is_active = 0; |
| 2352 | } |
| 2353 | else if (strcmp(name, "RedDensity") == 0 || |
| 2354 | strcmp(name, "GreenDensity") == 0 || |
| 2355 | strcmp(name, "BlueDensity") == 0) |
| 2356 | { |
| 2357 | if (caps->color_type & PCL_COLOR_RGB && |
| 2358 | stp_check_string_parameter(v, "PrintingMode", STP_PARAMETER_DEFAULTED) && |
| 2359 | strcmp(stp_get_string_parameter(v, "PrintingMode"), "Color") == 0) |
| 2360 | description->is_active = 1; |
| 2361 | else |
| 2362 | description->is_active = 0; |
| 2363 | } |
| 2364 | else if (strcmp(name, "LightCyanTrans") == 0 || |
| 2365 | strcmp(name, "LightMagentaTrans") == 0) |
| 2366 | { |
| 2367 | if (caps->color_type & PCL_COLOR_CMYKcm && |
| 2368 | stp_check_string_parameter(v, "PrintingMode", STP_PARAMETER_DEFAULTED) && |
| 2369 | strcmp(stp_get_string_parameter(v, "PrintingMode"), "Color") == 0) |
| 2370 | description->is_active = 1; |
| 2371 | else |
| 2372 | description->is_active = 0; |
| 2373 | } |
| 2374 | else if (strcmp(name, "HorizOffset") == 0 || |
| 2375 | strcmp(name, "VertOffset") == 0) |
| 2376 | { |
| 2377 | if (caps->stp_printer_type & PCL_PRINTER_LABEL) |
| 2378 | { |
| 2379 | description->is_active = 1; |
| 2380 | } |
| 2381 | else |
| 2382 | { |
| 2383 | description->is_active = 0; |
| 2384 | } |
| 2385 | } |
| 2386 | else if (strcmp(name, "InkChannels") == 0) |
| 2387 | { |
| 2388 | if (caps->color_type & PCL_COLOR_CMYKcm) |
| 2389 | description->deflt.integer = 6; |
| 2390 | else if (caps->color_type == PCL_COLOR_NONE) |
| 2391 | description->deflt.integer = 1; |
| 2392 | else if (caps->color_type & PCL_COLOR_RGB) |
| 2393 | description->deflt.integer = 3; |
| 2394 | else |
| 2395 | description->deflt.integer = 4; |
| 2396 | description->bounds.integer.lower = -1; |
| 2397 | description->bounds.integer.upper = -1; |
| 2398 | } |
| 2399 | else if (strcmp(name, "PrintingMode") == 0) |
| 2400 | { |
| 2401 | description->bounds.str = stp_string_list_create(); |
| 2402 | if (caps->color_type != PCL_COLOR_NONE) |
| 2403 | stp_string_list_add_string |
| 2404 | (description->bounds.str, "Color", _("Color")); |
| 2405 | stp_string_list_add_string |
| 2406 | (description->bounds.str, "BW", _("Black and White")); |
| 2407 | description->deflt.str = |
| 2408 | stp_string_list_param(description->bounds.str, 0)->name; |
| 2409 | } |
| 2410 | else if (strcmp(name, "NativeCopies") == 0) |
| 2411 | { |
| 2412 | description->deflt.boolean = caps->stp_printer_type & PCL_PRINTER_COPIES; |
| 2413 | description->is_active = 1; |
| 2414 | } |
| 2415 | } |
| 2416 | |
| 2417 | |
| 2418 | /* |
| 2419 | * 'pcl_imageable_area()' - Return the imageable area of the page. |
| 2420 | */ |
| 2421 | static void |
| 2422 | internal_imageable_area(const stp_vars_t *v, /* I */ |
| 2423 | int use_paper_margins, |
| 2424 | stp_dimension_t *left, /* O - Left position in points */ |
| 2425 | stp_dimension_t *right, /* O - Right position in points */ |
| 2426 | stp_dimension_t *bottom, /* O - Bottom position in points */ |
| 2427 | stp_dimension_t *top) /* O - Top position in points */ |
| 2428 | { |
| 2429 | stp_dimension_t width, height; /* Size of page */ |
| 2430 | const pcl_cap_t *caps; /* Printer caps */ |
| 2431 | int pcl_media_size; /* Converted media size */ |
| 2432 | const char *media_size = stp_get_string_parameter(v, "PageSize"); |
| 2433 | const stp_papersize_t *pp = NULL; |
| 2434 | stp_dimension_t left_margin = 0; |
| 2435 | stp_dimension_t right_margin = 0; |
| 2436 | stp_dimension_t bottom_margin = 0; |
| 2437 | stp_dimension_t top_margin = 0; |
| 2438 | const stp_papersize_list_t *papersize_list = stpi_get_standard_papersize_list(); |
| 2439 | |
| 2440 | caps = pcl_get_model_capabilities(v); |
| 2441 | |
| 2442 | stp_default_media_size(v, &width, &height); |
| 2443 | |
| 2444 | /* If we are using A4 paper, then the margins are different than any |
| 2445 | * other paper size. This is because HP wanted to have the same printable |
| 2446 | * width for A4 as for letter. Go figure. |
| 2447 | */ |
| 2448 | |
| 2449 | if (!media_size) |
| 2450 | media_size = ""; |
| 2451 | if (strlen(media_size) == 0 && |
| 2452 | ((pp = stpi_get_papersize_by_size(papersize_list, stp_get_page_height(v), |
| 2453 | stp_get_page_width(v))) != NULL)) |
| 2454 | media_size = pp->name; |
| 2455 | |
| 2456 | stp_dprintf(STP_DBG_PCL, v, "pcl_imageable_area(): media_size: '%s'\n", |
| 2457 | media_size); |
| 2458 | |
| 2459 | pcl_media_size = pcl_convert_media_size(v, media_size); |
| 2460 | if (media_size) |
| 2461 | pp = stp_describe_papersize(v, media_size); |
| 2462 | if (pp && use_paper_margins) |
| 2463 | { |
| 2464 | left_margin = pp->left; |
| 2465 | right_margin = pp->right; |
| 2466 | bottom_margin = pp->bottom; |
| 2467 | top_margin = pp->top; |
| 2468 | } |
| 2469 | |
| 2470 | if (pcl_media_size == PCL_PAPERSIZE_A4) |
| 2471 | { |
| 2472 | left_margin = MAX(left_margin, caps->a4_margins.left_margin); |
| 2473 | right_margin = MAX(right_margin, caps->a4_margins.right_margin); |
| 2474 | top_margin = MAX(top_margin, caps->a4_margins.top_margin); |
| 2475 | bottom_margin = MAX(bottom_margin, caps->a4_margins.bottom_margin); |
| 2476 | } |
| 2477 | else |
| 2478 | { |
| 2479 | left_margin = MAX(left_margin, caps->normal_margins.left_margin); |
| 2480 | right_margin = MAX(right_margin, caps->normal_margins.right_margin); |
| 2481 | top_margin = MAX(top_margin, caps->normal_margins.top_margin); |
| 2482 | bottom_margin = MAX(bottom_margin, caps->normal_margins.bottom_margin); |
| 2483 | } |
| 2484 | *left = left_margin; |
| 2485 | *right = width - right_margin; |
| 2486 | *top = top_margin; |
| 2487 | *bottom = height - bottom_margin; |
| 2488 | } |
| 2489 | |
| 2490 | static void |
| 2491 | pcl_imageable_area(const stp_vars_t *v, /* I */ |
| 2492 | stp_dimension_t *left, /* O - Left position in points */ |
| 2493 | stp_dimension_t *right, /* O - Right position in points */ |
| 2494 | stp_dimension_t *bottom, /* O - Bottom position in points */ |
| 2495 | stp_dimension_t *top) /* O - Top position in points */ |
| 2496 | { |
| 2497 | internal_imageable_area(v, 1, left, right, bottom, top); |
| 2498 | } |
| 2499 | |
| 2500 | static void |
| 2501 | pcl_limit(const stp_vars_t *v, /* I */ |
| 2502 | stp_dimension_t *width, |
| 2503 | stp_dimension_t *height, |
| 2504 | stp_dimension_t *min_width, |
| 2505 | stp_dimension_t *min_height) |
| 2506 | { |
| 2507 | const pcl_cap_t *caps= pcl_get_model_capabilities(v); |
| 2508 | *width = caps->custom_max_width; |
| 2509 | *height = caps->custom_max_height; |
| 2510 | *min_width = caps->custom_min_width; |
| 2511 | *min_height = caps->custom_min_height; |
| 2512 | } |
| 2513 | |
| 2514 | static const char * |
| 2515 | pcl_describe_output(const stp_vars_t *v) |
| 2516 | { |
| 2517 | int printing_color = 0; |
| 2518 | const pcl_cap_t *caps = pcl_get_model_capabilities(v); |
| 2519 | const char *print_mode = stp_get_string_parameter(v, "PrintingMode"); |
| 2520 | stp_resolution_t xdpi, ydpi; |
| 2521 | |
| 2522 | pcl_describe_resolution(v, &xdpi, &ydpi); |
| 2523 | if (!print_mode || strcmp(print_mode, "Color") == 0) |
| 2524 | printing_color = 1; |
| 2525 | if (((caps->resolutions & PCL_RES_600_600_MONO) == PCL_RES_600_600_MONO) && |
| 2526 | printing_color && xdpi == 600 && ydpi == 600) |
| 2527 | printing_color = 0; |
| 2528 | if (printing_color) |
| 2529 | { |
| 2530 | if ((caps->color_type & PCL_COLOR_RGB) == PCL_COLOR_RGB) |
| 2531 | return "RGB"; |
| 2532 | else if ((caps->color_type & PCL_COLOR_CMY) == PCL_COLOR_CMY) |
| 2533 | return "CMY"; |
| 2534 | else |
| 2535 | return "CMYK"; |
| 2536 | } |
| 2537 | else |
| 2538 | return "Grayscale"; |
| 2539 | } |
| 2540 | |
| 2541 | static const stp_papersize_t * |
| 2542 | pcl_describe_papersize(const stp_vars_t *v, const char *name) |
| 2543 | { |
| 2544 | const pcl_cap_t *caps= pcl_get_model_capabilities(v); |
| 2545 | if (caps->stp_printer_type & PCL_PRINTER_LABEL) |
| 2546 | return stpi_get_listed_papersize(name, "labels"); |
| 2547 | else |
| 2548 | return stpi_get_listed_papersize(name, "standard"); |
| 2549 | } |
| 2550 | |
| 2551 | /* |
| 2552 | * 'pcl_print()' - Print an image to an HP printer. |
| 2553 | */ |
| 2554 | |
| 2555 | static void |
| 2556 | pcl_printfunc(stp_vars_t *v) |
| 2557 | { |
| 2558 | pcl_privdata_t *pd = (pcl_privdata_t *) stp_get_component_data(v, "Driver"); |
| 2559 | int do_blank = pd->do_blank; |
| 2560 | unsigned char *black = stp_dither_get_channel(v, STP_ECOLOR_K, 0); |
| 2561 | unsigned char *cyan = stp_dither_get_channel(v, STP_ECOLOR_C, 0); |
| 2562 | unsigned char *lcyan = stp_dither_get_channel(v, STP_ECOLOR_C, 1); |
| 2563 | unsigned char *magenta = stp_dither_get_channel(v, STP_ECOLOR_M, 0); |
| 2564 | unsigned char *lmagenta = stp_dither_get_channel(v, STP_ECOLOR_M, 1); |
| 2565 | unsigned char *yellow = stp_dither_get_channel(v, STP_ECOLOR_Y, 0); |
| 2566 | int len_c = stp_dither_get_last_position(v, STP_ECOLOR_C, 0); |
| 2567 | int len_lc = stp_dither_get_last_position(v, STP_ECOLOR_C, 1); |
| 2568 | int len_m = stp_dither_get_last_position(v, STP_ECOLOR_M, 0); |
| 2569 | int len_lm = stp_dither_get_last_position(v, STP_ECOLOR_M, 1); |
| 2570 | int len_y = stp_dither_get_last_position(v, STP_ECOLOR_Y, 0); |
| 2571 | int len_k = stp_dither_get_last_position(v, STP_ECOLOR_K, 0); |
| 2572 | int is_blank = (do_blank && (len_c == -1) && (len_lc == -1) && |
| 2573 | (len_m == -1) && (len_lm == -1) && (len_y == -1) && |
| 2574 | (len_k == -1)); |
| 2575 | int height = pd->height; |
| 2576 | const char *print_mode = stp_get_string_parameter(v, "PrintingMode"); |
| 2577 | |
| 2578 | if (is_blank && (pd->blank_lines != 0)) /* repeated blank line */ |
| 2579 | { |
| 2580 | pd->blank_lines++; |
| 2581 | } |
| 2582 | else /* Not blank, or is first one */ |
| 2583 | { |
| 2584 | if (! is_blank) |
| 2585 | { |
| 2586 | if (pd->blank_lines > 1) /* Output accumulated lines */ |
| 2587 | { |
| 2588 | pd->blank_lines--; /* correct for one already output */ |
| 2589 | stp_dprintf(STP_DBG_PCL, v, "Blank Lines = %d\n", pd->blank_lines); |
| 2590 | stp_zprintf(v, "\033*b%dY", pd->blank_lines); |
| 2591 | pd->blank_lines=0; |
| 2592 | } |
| 2593 | } |
| 2594 | else |
| 2595 | { |
| 2596 | pd->blank_lines++; |
| 2597 | } |
| 2598 | |
| 2599 | if (pd->do_cret) |
| 2600 | { |
| 2601 | /* |
| 2602 | * 4-level (CRet) dithers... |
| 2603 | */ |
| 2604 | if (strcmp(print_mode, "BW") == 0) |
| 2605 | { |
| 2606 | (*(pd->writefunc))(v, black + height / 2, height / 2, 0); |
| 2607 | (*(pd->writefunc))(v, black, height / 2, 1); |
| 2608 | } |
| 2609 | else |
| 2610 | { |
| 2611 | if(pd->do_cretb) |
| 2612 | { |
| 2613 | /* (*(pd->writefunc))(v, black + height / 2, 0, 0); */ |
| 2614 | (*(pd->writefunc))(v, black, height/2, 0); |
| 2615 | } |
| 2616 | else |
| 2617 | { |
| 2618 | (*(pd->writefunc))(v, black + height / 2, height / 2, 0); |
| 2619 | (*(pd->writefunc))(v, black, height / 2, 0); |
| 2620 | } |
| 2621 | (*(pd->writefunc))(v, cyan + height / 2, height / 2, 0); |
| 2622 | (*(pd->writefunc))(v, cyan, height / 2, 0); |
| 2623 | (*(pd->writefunc))(v, magenta + height / 2, height / 2, 0); |
| 2624 | (*(pd->writefunc))(v, magenta, height / 2, 0); |
| 2625 | (*(pd->writefunc))(v, yellow + height / 2, height / 2, 0); |
| 2626 | if (pd->do_6color) |
| 2627 | { |
| 2628 | (*(pd->writefunc))(v, yellow, height / 2, 0); |
| 2629 | (*(pd->writefunc))(v, lcyan + height / 2, height / 2, 0); |
| 2630 | (*(pd->writefunc))(v, lcyan, height / 2, 0); |
| 2631 | (*(pd->writefunc))(v, lmagenta + height / 2, height / 2, 0); |
| 2632 | (*(pd->writefunc))(v, lmagenta, height / 2, 1); /* Last plane set on light magenta */ |
| 2633 | } |
| 2634 | else |
| 2635 | (*(pd->writefunc))(v, yellow, height / 2, 1); /* Last plane set on yellow */ |
| 2636 | } |
| 2637 | } |
| 2638 | else |
| 2639 | { |
| 2640 | /* |
| 2641 | * Standard 2-level dithers... |
| 2642 | */ |
| 2643 | |
| 2644 | if (strcmp(print_mode, "BW") == 0) |
| 2645 | { |
| 2646 | (*(pd->writefunc))(v, black, height, 1); |
| 2647 | } |
| 2648 | else |
| 2649 | { |
| 2650 | if (black != NULL) |
| 2651 | (*(pd->writefunc))(v, black, height, 0); |
| 2652 | (*(pd->writefunc))(v, cyan, height, 0); |
| 2653 | (*(pd->writefunc))(v, magenta, height, 0); |
| 2654 | if (pd->do_6color) |
| 2655 | { |
| 2656 | (*(pd->writefunc))(v, yellow, height, 0); |
| 2657 | (*(pd->writefunc))(v, lcyan, height, 0); |
| 2658 | (*(pd->writefunc))(v, lmagenta, height, 1); /* Last plane set on light magenta */ |
| 2659 | } |
| 2660 | else |
| 2661 | (*(pd->writefunc))(v, yellow, height, 1); /* Last plane set on yellow */ |
| 2662 | } |
| 2663 | } |
| 2664 | } |
| 2665 | } |
| 2666 | |
| 2667 | static double |
| 2668 | get_double_param(stp_vars_t *v, const char *param) |
| 2669 | { |
| 2670 | if (param && stp_check_float_parameter(v, param, STP_PARAMETER_ACTIVE)) |
| 2671 | return stp_get_float_parameter(v, param); |
| 2672 | else |
| 2673 | return 1.0; |
| 2674 | } |
| 2675 | |
| 2676 | static void |
| 2677 | initialize_lj_color(stp_vars_t *v) |
| 2678 | { |
| 2679 | /* Magic initialization sequence */ |
| 2680 | stp_zprintf(v, "\033*v6W%c%c%c%c%c%c", 0, 3, 8, 8, 8, 8); /* RTL config */ |
| 2681 | stp_puts("\033*t3J", v); /* Render alg (best) */ |
| 2682 | stp_zprintf(v, "\033*o3W%c%c%c", 6, 4, 6); /* Driver config */ |
| 2683 | stp_puts("\033*v255A", v); /* Color comp 1) */ |
| 2684 | stp_puts("\033*v255B", v); /* Color comp 2) */ |
| 2685 | stp_puts("\033*v255C", v); /* Color comp 3) */ |
| 2686 | stp_puts("\033*v0I", v); /* Assign color idx 0 (white)*/ |
| 2687 | stp_puts("\033*v255A", v); /* Color comp 1) */ |
| 2688 | stp_puts("\033*v0B", v); /* Color comp 2) */ |
| 2689 | stp_puts("\033*v0C", v); /* Color comp 3) */ |
| 2690 | stp_puts("\033*v6I", v); /* Assign color idx 1 (red) */ |
| 2691 | stp_puts("\033*v0A", v); /* Color comp 1) */ |
| 2692 | stp_puts("\033*v255B", v); /* Color comp 2) */ |
| 2693 | stp_puts("\033*v0C", v); /* Color comp 3) */ |
| 2694 | stp_puts("\033*v5I", v); /* Assign color idx 5 (green) */ |
| 2695 | stp_puts("\033*v0A", v); /* Color comp 1) */ |
| 2696 | stp_puts("\033*v0B", v); /* Color comp 2) */ |
| 2697 | stp_puts("\033*v255C", v); /* Color comp 3) */ |
| 2698 | stp_puts("\033*v4I", v); /* Assign color idx 4 (blue) */ |
| 2699 | stp_puts("\033*v255A", v); /* Color comp 1) */ |
| 2700 | stp_puts("\033*v255B", v); /* Color comp 2) */ |
| 2701 | stp_puts("\033*v0C", v); /* Color comp 3) */ |
| 2702 | stp_puts("\033*v3I", v); /* Assign color idx 3 (yellow) */ |
| 2703 | stp_puts("\033*v255A", v); /* Color comp 1) */ |
| 2704 | stp_puts("\033*v0B", v); /* Color comp 2) */ |
| 2705 | stp_puts("\033*v255C", v); /* Color comp 3) */ |
| 2706 | stp_puts("\033*v2I", v); /* Assign color idx 2 (green)*/ |
| 2707 | stp_puts("\033*v0A", v); /* Color comp 1) */ |
| 2708 | stp_puts("\033*v255B", v); /* Color comp 2) */ |
| 2709 | stp_puts("\033*v255C", v); /* Color comp 3) */ |
| 2710 | stp_puts("\033*v1I", v); /* Assign color idx 1 (magenta) */ |
| 2711 | stp_puts("\033*v0A", v); /* Color comp 1) */ |
| 2712 | stp_puts("\033*v0B", v); /* Color comp 2) */ |
| 2713 | stp_puts("\033*v0C", v); /* Color comp 3) */ |
| 2714 | stp_puts("\033*v7I", v); /* Assign color idx (black) */ |
| 2715 | stp_puts("\033*v7S", v); /* Set Foreground Color (black) */ |
| 2716 | } |
| 2717 | |
| 2718 | static int |
| 2719 | pcl_do_print(stp_vars_t *v, stp_image_t *image) |
| 2720 | { |
| 2721 | pcl_privdata_t privdata; |
| 2722 | int status = 1; |
| 2723 | const char *media_size = stp_get_string_parameter(v, "PageSize"); |
| 2724 | const char *media_type = stp_get_string_parameter(v, "MediaType"); |
| 2725 | const char *media_source = stp_get_string_parameter(v, "InputSlot"); |
| 2726 | const char *ink_type = stp_get_string_parameter(v, "InkType"); |
| 2727 | const char *print_mode = stp_get_string_parameter(v, "PrintingMode"); |
| 2728 | const char *duplex_mode = stp_get_string_parameter(v, "Duplex"); |
| 2729 | const char *orientation_mode = stp_get_string_parameter(v, "Orientation"); |
| 2730 | const char *label_separator_mode = stp_get_string_parameter(v, "LabelSeparator"); |
| 2731 | double h_offset = get_double_param(v, "HorizOffset"); |
| 2732 | double v_offset = get_double_param(v, "VertOffset"); |
| 2733 | int page_number = stp_get_int_parameter(v, "PageNumber"); |
| 2734 | int printing_color = 0; |
| 2735 | int top = (int) stp_get_top(v) + .5; |
| 2736 | int left = (int) stp_get_left(v) + .5; |
| 2737 | unsigned int y; /* Looping vars */ |
| 2738 | stp_resolution_t xdpi, ydpi; /* Resolution */ |
| 2739 | unsigned char *black, /* Black bitmap data */ |
| 2740 | *cyan, /* Cyan bitmap data */ |
| 2741 | *magenta, /* Magenta bitmap data */ |
| 2742 | *yellow, /* Yellow bitmap data */ |
| 2743 | *lcyan, /* Light Cyan bitmap data */ |
| 2744 | *lmagenta; /* Light Magenta bitmap data */ |
| 2745 | stp_dimension_t page_left, |
| 2746 | page_top, |
| 2747 | page_right, |
| 2748 | page_bottom; |
| 2749 | unsigned int out_width, /* Width of image on page */ |
| 2750 | out_height; /* Height of image on page */ |
| 2751 | unsigned errdiv, /* Error dividend */ |
| 2752 | errmod, /* Error modulus */ |
| 2753 | errval, /* Current error value */ |
| 2754 | errline, /* Current raster line */ |
| 2755 | errlast; /* Last raster line loaded */ |
| 2756 | unsigned zero_mask = 0; |
| 2757 | int image_height; |
| 2758 | int image_width; |
| 2759 | const pcl_cap_t *caps; /* Printer capabilities */ |
| 2760 | int planes = 3; /* # of output planes */ |
| 2761 | int pcl_media_size; /* PCL media size code */ |
| 2762 | const double *dot_sizes_use; |
| 2763 | const stp_papersize_t *pp; |
| 2764 | int the_top_margin, /* Corrected top margin */ |
| 2765 | the_left_margin; /* Corrected left margin */ |
| 2766 | int manual_feed_left_adjust = 0; |
| 2767 | int extra_left_margin = 0; |
| 2768 | double density; |
| 2769 | int label = 0; |
| 2770 | const stp_papersize_list_t *paper_sizes = stpi_get_standard_papersize_list(); |
| 2771 | |
| 2772 | if (!stp_verify(v)) |
| 2773 | { |
| 2774 | stp_eprintf(v, "Print options not verified; cannot print.\n"); |
| 2775 | return 0; |
| 2776 | } |
| 2777 | if (strcmp(print_mode, "Color") == 0) |
| 2778 | printing_color = 1; |
| 2779 | |
| 2780 | (void) memset(&privdata, 0, sizeof(privdata)); |
| 2781 | |
| 2782 | caps = pcl_get_model_capabilities(v); |
| 2783 | |
| 2784 | /* |
| 2785 | * Setup a read-only pixel region for the entire image... |
| 2786 | */ |
| 2787 | |
| 2788 | stp_image_init(image); |
| 2789 | image_height = stp_image_height(image); |
| 2790 | |
| 2791 | /* |
| 2792 | * Figure out the output resolution... |
| 2793 | */ |
| 2794 | |
| 2795 | pcl_describe_resolution(v, &xdpi, &ydpi); |
| 2796 | |
| 2797 | stp_dprintf(STP_DBG_PCL, v,"pcl: resolution=%dx%d\n",(int)xdpi,(int)ydpi); |
| 2798 | if (xdpi <= 0 || ydpi <= 0) |
| 2799 | { |
| 2800 | stp_eprintf(v, "No resolution found; cannot print.\n"); |
| 2801 | return 0; |
| 2802 | } |
| 2803 | |
| 2804 | if (printing_color && (caps->stp_printer_type & PCL_PRINTER_LJ_COLOR)) { |
| 2805 | privdata.nodither = 1; |
| 2806 | } |
| 2807 | /* |
| 2808 | * Choose the correct color conversion function... |
| 2809 | */ |
| 2810 | if (((caps->resolutions & PCL_RES_600_600_MONO) == PCL_RES_600_600_MONO) && |
| 2811 | printing_color && xdpi == 600 && ydpi == 600) |
| 2812 | { |
| 2813 | stp_eprintf(v, "600x600 resolution only available in MONO\n"); |
| 2814 | stp_set_string_parameter(v, "PrintingMode", "BW"); |
| 2815 | printing_color = 0; |
| 2816 | } |
| 2817 | |
| 2818 | privdata.do_cret = (xdpi >= 300 && |
| 2819 | ((caps->color_type & PCL_COLOR_CMYK4) == PCL_COLOR_CMYK4)); |
| 2820 | privdata.do_cretb = (xdpi >= 600 && ydpi >= 600 && |
| 2821 | ((caps->color_type & PCL_COLOR_CMYK4b) == PCL_COLOR_CMYK4b) && |
| 2822 | printing_color); |
| 2823 | if (privdata.do_cretb){ |
| 2824 | privdata.do_cret = 1; |
| 2825 | dot_sizes_use=dot_sizes_cret; |
| 2826 | }else{ |
| 2827 | dot_sizes_use=dot_sizes; |
| 2828 | } |
| 2829 | |
| 2830 | stp_dprintf(STP_DBG_PCL, v, "privdata.do_cret = %d\n", privdata.do_cret); |
| 2831 | stp_dprintf(STP_DBG_PCL, v, "privdata.do_cretb = %d\n", privdata.do_cretb); |
| 2832 | |
| 2833 | if (ink_type && printing_color) |
| 2834 | privdata.do_6color = (strcmp(ink_type, "Photo") == 0); |
| 2835 | else |
| 2836 | privdata.do_6color = 0; |
| 2837 | |
| 2838 | stp_dprintf(STP_DBG_PCL, v, "privdata.do_6color = %d\n", privdata.do_6color); |
| 2839 | |
| 2840 | /* |
| 2841 | * Compute the output size... |
| 2842 | */ |
| 2843 | |
| 2844 | out_width = (int) stp_get_width(v) + .5; |
| 2845 | out_height = (int) stp_get_height(v) + .5; |
| 2846 | |
| 2847 | internal_imageable_area(v, 0, &page_left, &page_right, |
| 2848 | &page_bottom, &page_top); |
| 2849 | left -= page_left; |
| 2850 | top -= page_top; |
| 2851 | |
| 2852 | image_height = stp_image_height(image); |
| 2853 | image_width = stp_image_width(image); |
| 2854 | |
| 2855 | /* |
| 2856 | * Set media size here because it is needed by the margin calculation code. |
| 2857 | */ |
| 2858 | |
| 2859 | if (!media_size) |
| 2860 | media_size = ""; |
| 2861 | if (strlen(media_size) == 0 && |
| 2862 | ((pp = stpi_get_papersize_by_size(paper_sizes, stp_get_page_height(v), |
| 2863 | stp_get_page_width(v))) != NULL)) |
| 2864 | media_size = pp->name; |
| 2865 | |
| 2866 | pcl_media_size = pcl_convert_media_size(v, media_size); |
| 2867 | |
| 2868 | stp_dprintf(STP_DBG_PCL, v,"pcl_media_size = %d, media_size = %s\n", pcl_media_size, media_size); |
| 2869 | |
| 2870 | /* |
| 2871 | * If the media size requested is unknown, try it as a custom size. |
| 2872 | * |
| 2873 | * Warning: The margins may need to be fixed for this! |
| 2874 | */ |
| 2875 | |
| 2876 | if (pcl_media_size == -1) { |
| 2877 | stp_dprintf(STP_DBG_PCL, v, "Paper size %s is not directly supported by printer.\n", |
| 2878 | media_size); |
| 2879 | stp_dprintf(STP_DBG_PCL, v, "Trying as custom pagesize (watch the margins!)\n"); |
| 2880 | pcl_media_size = PCL_PAPERSIZE_CUSTOM; /* Custom */ |
| 2881 | } |
| 2882 | |
| 2883 | stp_dprintf(STP_DBG_PCL, v, "Duplex: %s, Page_Number: %d\n", duplex_mode, page_number); |
| 2884 | privdata.duplex=0; |
| 2885 | privdata.tumble=0; |
| 2886 | privdata.copies=1; |
| 2887 | |
| 2888 | /* |
| 2889 | * Duplex |
| 2890 | */ |
| 2891 | |
| 2892 | if (duplex_mode) |
| 2893 | { |
| 2894 | if (caps->stp_printer_type & PCL_PRINTER_DUPLEX) |
| 2895 | { |
| 2896 | if ((strcmp(duplex_mode, "DuplexTumble") == 0) || (strcmp(duplex_mode, "DuplexNoTumble") == 0)) |
| 2897 | privdata.duplex=1; |
| 2898 | if ((strcmp(duplex_mode, "DuplexTumble") == 0)) |
| 2899 | privdata.tumble=1; |
| 2900 | } |
| 2901 | } |
| 2902 | |
| 2903 | /* |
| 2904 | * Multiple copies! |
| 2905 | */ |
| 2906 | |
| 2907 | if (stp_check_boolean_parameter(v, "NativeCopies", STP_PARAMETER_ACTIVE) && |
| 2908 | stp_get_boolean_parameter(v, "NativeCopies") && |
| 2909 | stp_check_int_parameter(v, "NumCopies", STP_PARAMETER_ACTIVE)) |
| 2910 | privdata.copies = stp_get_int_parameter(v, "NumCopies"); |
| 2911 | |
| 2912 | /* |
| 2913 | * Label (PJL) settings and Orientation |
| 2914 | */ |
| 2915 | |
| 2916 | if ((caps->stp_printer_type & PCL_PRINTER_LABEL)) { |
| 2917 | label = 1; |
| 2918 | privdata.orientation = 0; |
| 2919 | if ((strncmp(orientation_mode, "Landscape", 9) == 0)) |
| 2920 | privdata.orientation = 1; |
| 2921 | else if ((strncmp(orientation_mode, "UpsideDown", 10) == 0)) |
| 2922 | privdata.orientation = 2; |
| 2923 | else if ((strncmp(orientation_mode, "Seascape", 8) == 0)) |
| 2924 | privdata.orientation = 3; |
| 2925 | |
| 2926 | /* |
| 2927 | * Label Separator mode |
| 2928 | */ |
| 2929 | privdata.label_separator = 0; |
| 2930 | if ((strncmp(label_separator_mode, "GAP", 3) == 0)) |
| 2931 | privdata.label_separator = 1; |
| 2932 | if ((strncmp(label_separator_mode, "TOP", 3) == 0)) |
| 2933 | privdata.label_separator = 2; |
| 2934 | if ((strncmp(label_separator_mode, "BOTTOM", 6) == 0)) |
| 2935 | privdata.label_separator = 3; |
| 2936 | if ((strncmp(label_separator_mode, "NOTCH", 5) == 0)) |
| 2937 | privdata.label_separator = 4; |
| 2938 | if ((strncmp(label_separator_mode, "NONE", 10) == 0)) |
| 2939 | privdata.label_separator = 5; |
| 2940 | |
| 2941 | /* |
| 2942 | * Print Offsets |
| 2943 | */ |
| 2944 | privdata.h_offset = (int) (h_offset * 720.0); |
| 2945 | privdata.v_offset = (int) (v_offset * 720.0); |
| 2946 | |
| 2947 | /* |
| 2948 | * Darkness Mode |
| 2949 | */ |
| 2950 | if (stp_check_int_parameter(v, "Darkness", STP_PARAMETER_ACTIVE)) |
| 2951 | { |
| 2952 | privdata.darkness = stp_get_int_parameter(v, "Darkness"); |
| 2953 | } |
| 2954 | else |
| 2955 | { |
| 2956 | privdata.darkness = 30; |
| 2957 | } |
| 2958 | } |
| 2959 | |
| 2960 | |
| 2961 | /* |
| 2962 | * Send PCL initialization commands... |
| 2963 | */ |
| 2964 | |
| 2965 | if ((privdata.duplex == 0) || ((page_number & 1) == 0)) |
| 2966 | { |
| 2967 | int pcl_media_type, /* PCL media type code */ |
| 2968 | pcl_media_source; /* PCL media source code */ |
| 2969 | |
| 2970 | stp_dprintf(STP_DBG_PCL, v, "Normal init\n"); |
| 2971 | |
| 2972 | if (label) |
| 2973 | { |
| 2974 | if (privdata.darkness > -21 && privdata.darkness < 21) |
| 2975 | { |
| 2976 | stp_puts("\033%-12345X@PJL JOB NAME=\"JOB_CONFIG\" SECURITY=\"0x0000FFFF\"\n", v); |
| 2977 | stp_zprintf(v, "@PJL DEFAULT DARKNESS=%d\n", privdata.darkness); |
| 2978 | stp_puts("@PJL EOJ\n", v); |
| 2979 | stp_puts("\033%-12345X\n", v); |
| 2980 | } |
| 2981 | if (privdata.do_cretb) |
| 2982 | stp_puts("\033*rbC", v); /* End raster graphics */ |
| 2983 | stp_puts("\033E", v); /* PCL reset */ |
| 2984 | if (privdata.do_cretb) |
| 2985 | stp_zprintf(v, "\033%%-12345X@PJL ENTER LANGUAGE=PCL3GUI\n"); |
| 2986 | |
| 2987 | stp_zprintf(v, "\033%%-12345X@PJL SET RESOLUTION=%d\n" |
| 2988 | "@PJL SET PAPERWIDTH=%d\n" |
| 2989 | "@PJL SET PAPERLENGTH=%d\n" |
| 2990 | "@PJL SET VERTICALOFFSET=%d\n" |
| 2991 | "@PJL SET HORIZONTALOFFSET=%d\n" |
| 2992 | "@PJL ENTER LANGUAGE=PCL\n", (int) xdpi, out_width*10, |
| 2993 | out_height*10, privdata.v_offset, privdata.h_offset); |
| 2994 | |
| 2995 | if ( privdata.label_separator != 0) { |
| 2996 | stp_zprintf(v, "\033%%-12345X@PJL JOB SETUP = \"ON\" " |
| 2997 | "NAME = \"JOB_MEDIACONFIG\"\n" |
| 2998 | "@PJL DEFAULT PAPERSENSORTYPE=%s\n" |
| 2999 | "@PJL RESET\n@PJL EOJ\n", label_separator_mode); |
| 3000 | } |
| 3001 | |
| 3002 | stp_zprintf(v, "\033&l%dA", pcl_media_size); /* Set media size we calculated above */ |
| 3003 | |
| 3004 | stp_zprintf(v, "\033&l%dO", privdata.orientation); |
| 3005 | stp_puts("\033*r0F",v); /* Presentation mode */ |
| 3006 | stp_puts("\033&l6D\033&k12H",v); /* 6 lines per inch, 10 chars per inch */ |
| 3007 | } |
| 3008 | else |
| 3009 | { |
| 3010 | if (privdata.do_cretb) |
| 3011 | stp_puts("\033*rbC", v); /* End raster graphics */ |
| 3012 | stp_puts("\033E", v); /* PCL reset */ |
| 3013 | if (privdata.do_cretb) |
| 3014 | stp_zprintf(v, "\033%%-12345X@PJL ENTER LANGUAGE=PCL3GUI\n"); |
| 3015 | |
| 3016 | stp_puts("\033&l6D\033&k12H",v); /* 6 lines per inch, 10 chars per inch */ |
| 3017 | stp_puts("\033&l0O",v); /* Portrait */ |
| 3018 | |
| 3019 | stp_zprintf(v, "\033&l%dA", pcl_media_size); /* Set media size we calculated above */ |
| 3020 | } |
| 3021 | |
| 3022 | stp_zprintf(v, "\033&l%dP", ((int) stp_get_page_height(v)) / 12); |
| 3023 | /* Length of "forms" in "lines" */ |
| 3024 | stp_puts("\033&l0L", v); /* Turn off perforation skip */ |
| 3025 | if (! label) { |
| 3026 | stp_puts("\033&l0E", v); /* Reset top margin to 0 */ |
| 3027 | } |
| 3028 | |
| 3029 | /* |
| 3030 | * Convert media source string to the code, if specified. |
| 3031 | */ |
| 3032 | |
| 3033 | if (media_source && strlen(media_source) != 0) { |
| 3034 | pcl_media_source = pcl_string_to_val(v, media_source, pcl_media_sources, |
| 3035 | sizeof(pcl_media_sources) / sizeof(pcl_t)); |
| 3036 | |
| 3037 | stp_dprintf(STP_DBG_PCL, v,"pcl_media_source = %d, media_source = %s\n", pcl_media_source, |
| 3038 | media_source); |
| 3039 | |
| 3040 | if (pcl_media_source == -1) |
| 3041 | stp_dprintf(STP_DBG_PCL, v, "Unknown media source %s, ignored.\n", media_source); |
| 3042 | else if (pcl_media_source != PCL_PAPERSOURCE_STANDARD) { |
| 3043 | |
| 3044 | /* Correct the value by taking the modulus */ |
| 3045 | |
| 3046 | if ((pcl_media_source & PAPERSOURCE_ADJ_GUIDE) == |
| 3047 | PAPERSOURCE_ADJ_GUIDE) |
| 3048 | { |
| 3049 | manual_feed_left_adjust = 1; |
| 3050 | stp_dprintf(STP_DBG_PCL, v, "Adjusting left margin for manual feed.\n"); |
| 3051 | } |
| 3052 | pcl_media_source = pcl_media_source % PAPERSOURCE_MOD; |
| 3053 | stp_zprintf(v, "\033&l%dH", pcl_media_source); |
| 3054 | } |
| 3055 | } |
| 3056 | |
| 3057 | /* |
| 3058 | * Convert media type string to the code, if specified. |
| 3059 | */ |
| 3060 | |
| 3061 | if (media_type && strlen(media_type) != 0) { |
| 3062 | pcl_media_type = pcl_string_to_val(v, media_type, pcl_media_types, |
| 3063 | sizeof(pcl_media_types) / sizeof(pcl_t)); |
| 3064 | |
| 3065 | stp_dprintf(STP_DBG_PCL, v,"pcl_media_type = %d, media_type = %s\n", pcl_media_type, |
| 3066 | media_type); |
| 3067 | |
| 3068 | if (pcl_media_type == -1) { |
| 3069 | stp_dprintf(STP_DBG_PCL, v, "Unknown media type %s, set to PLAIN.\n", media_type); |
| 3070 | pcl_media_type = PCL_PAPERTYPE_PLAIN; |
| 3071 | } |
| 3072 | |
| 3073 | /* |
| 3074 | * The HP812C doesn't like glossy paper being selected when using 600x600 |
| 3075 | * C-RET (PhotoRET II). So we use Premium paper instead. |
| 3076 | * |
| 3077 | */ |
| 3078 | |
| 3079 | if (privdata.do_cretb && pcl_media_type == PCL_PAPERTYPE_GLOSSY) { |
| 3080 | stp_dprintf(STP_DBG_PCL, v, "Media type GLOSSY, set to PREMIUM for PhotoRET II.\n"); |
| 3081 | pcl_media_type = PCL_PAPERTYPE_PREMIUM; |
| 3082 | } |
| 3083 | } |
| 3084 | else |
| 3085 | pcl_media_type = PCL_PAPERTYPE_PLAIN; |
| 3086 | |
| 3087 | /* |
| 3088 | * Set DJ print quality to "best" if resolution >= 300 |
| 3089 | */ |
| 3090 | |
| 3091 | if (caps->stp_printer_type & PCL_PRINTER_LJ_COLOR) |
| 3092 | stp_zprintf(v, "\033&l%dM", pcl_media_type); |
| 3093 | else if ((xdpi >= 300) && ((caps->stp_printer_type & PCL_PRINTER_DJ) == PCL_PRINTER_DJ)) |
| 3094 | { |
| 3095 | if ((caps->stp_printer_type & PCL_PRINTER_MEDIATYPE) == PCL_PRINTER_MEDIATYPE) |
| 3096 | { |
| 3097 | stp_puts("\033*o1M", v); /* Quality = presentation */ |
| 3098 | stp_zprintf(v, "\033&l%dM", pcl_media_type); |
| 3099 | } |
| 3100 | else |
| 3101 | { |
| 3102 | stp_puts("\033*r2Q", v); /* Quality (high) */ |
| 3103 | stp_puts("\033*o2Q", v); /* Shingling (4 passes) */ |
| 3104 | |
| 3105 | /* Depletion depends on media type and cart type. */ |
| 3106 | |
| 3107 | if ((pcl_media_type == PCL_PAPERTYPE_PLAIN) |
| 3108 | || (pcl_media_type == PCL_PAPERTYPE_BOND)) { |
| 3109 | if ((caps->color_type & PCL_COLOR_CMY) == PCL_COLOR_CMY) |
| 3110 | stp_puts("\033*o2D", v); /* Depletion 25% */ |
| 3111 | else |
| 3112 | stp_puts("\033*o5D", v); /* Depletion 50% with gamma correction */ |
| 3113 | } |
| 3114 | |
| 3115 | else if ((pcl_media_type == PCL_PAPERTYPE_PREMIUM) |
| 3116 | || (pcl_media_type == PCL_PAPERTYPE_GLOSSY) |
| 3117 | || (pcl_media_type == PCL_PAPERTYPE_TRANS)) |
| 3118 | stp_puts("\033*o1D", v); /* Depletion none */ |
| 3119 | } |
| 3120 | } |
| 3121 | |
| 3122 | /* Number of copies */ |
| 3123 | if (privdata.copies > 1) |
| 3124 | stp_zprintf(v,"\033&l%dX", privdata.copies); |
| 3125 | |
| 3126 | /* |
| 3127 | * Duplex |
| 3128 | */ |
| 3129 | if (privdata.duplex) |
| 3130 | stp_zprintf(v,"\033&l%dS", privdata.duplex + privdata.tumble); |
| 3131 | } |
| 3132 | else |
| 3133 | { |
| 3134 | stp_dprintf(STP_DBG_PCL, v, "Back face init\n"); |
| 3135 | stp_puts("\033&a2G", v); |
| 3136 | } |
| 3137 | |
| 3138 | /* |
| 3139 | * See if we need to use the CRD (Configure Raster Data) command, because we're |
| 3140 | * doing something interesting on a DeskJet. |
| 3141 | * (I hate long complicated if statements, the compiler will sort it out!). |
| 3142 | */ |
| 3143 | |
| 3144 | privdata.use_crd = 0; |
| 3145 | if ((caps->stp_printer_type & PCL_PRINTER_DJ) == PCL_PRINTER_DJ) |
| 3146 | { |
| 3147 | if (xdpi != ydpi) /* Different X and Y Resolutions */ |
| 3148 | privdata.use_crd = 1; |
| 3149 | if (privdata.do_cret) /* Resolution Enhancement */ |
| 3150 | privdata.use_crd = 1; |
| 3151 | if (privdata.do_6color) /* Photo Ink printing */ |
| 3152 | privdata.use_crd = 1; |
| 3153 | if (privdata.duplex) /* Duplexing */ |
| 3154 | privdata.use_crd = 1; |
| 3155 | } |
| 3156 | |
| 3157 | if (privdata.use_crd) |
| 3158 | /* Set resolution using CRD */ |
| 3159 | { |
| 3160 | |
| 3161 | /* |
| 3162 | * If duplexing on a CRD printer, we need to use the (re)load media command. |
| 3163 | */ |
| 3164 | |
| 3165 | if (privdata.duplex) |
| 3166 | stp_puts("\033&l-2H",v); /* Load media */ |
| 3167 | |
| 3168 | /* |
| 3169 | * Send configure image data command with horizontal and |
| 3170 | * vertical resolutions as well as a color count... |
| 3171 | */ |
| 3172 | |
| 3173 | if (printing_color) |
| 3174 | if (caps->color_type & (PCL_COLOR_CMY | PCL_COLOR_RGB)) |
| 3175 | planes = 3; |
| 3176 | else |
| 3177 | if (privdata.do_6color) |
| 3178 | planes = 6; |
| 3179 | else |
| 3180 | planes = 4; |
| 3181 | else |
| 3182 | planes = 1; |
| 3183 | |
| 3184 | stp_zprintf(v, "\033*g%dW", 2 + (planes * 6)); |
| 3185 | stp_putc(2, v); /* Format 2 (Complex Direct Planar) */ |
| 3186 | stp_putc(planes, v); /* # output planes */ |
| 3187 | |
| 3188 | if (planes != 3) { /* Black resolution */ |
| 3189 | stp_send_command(v, "", "HHH", xdpi, ydpi, (privdata.do_cretb || !privdata.do_cret) ? 2 : 4); |
| 3190 | } |
| 3191 | |
| 3192 | if (planes != 1) { /* Cyan, magenta, yellow resolutions */ |
| 3193 | stp_send_command(v, "", "HHH", xdpi, ydpi, privdata.do_cret ? 4 : 2); |
| 3194 | stp_send_command(v, "", "HHH", xdpi, ydpi, privdata.do_cret ? 4 : 2); |
| 3195 | stp_send_command(v, "", "HHH", xdpi, ydpi, privdata.do_cret ? 4 : 2); |
| 3196 | } |
| 3197 | if (planes == 6) /* LC, LM resolutions */ |
| 3198 | { |
| 3199 | stp_send_command(v, "", "HHH", xdpi, ydpi, privdata.do_cret ? 4 : 2); |
| 3200 | stp_send_command(v, "", "HHH", xdpi, ydpi, privdata.do_cret ? 4 : 2); |
| 3201 | } |
| 3202 | } |
| 3203 | else |
| 3204 | { |
| 3205 | stp_zprintf(v, "\033*t%dR", (int) xdpi); /* Simple resolution */ |
| 3206 | if (printing_color && ! (caps->stp_printer_type & PCL_PRINTER_LJ_COLOR)) |
| 3207 | { |
| 3208 | if ((caps->color_type & PCL_COLOR_CMY) == PCL_COLOR_CMY) |
| 3209 | stp_puts("\033*r-3U", v); /* Simple CMY color */ |
| 3210 | else |
| 3211 | stp_puts("\033*r-4U", v); /* Simple KCMY color */ |
| 3212 | } |
| 3213 | } |
| 3214 | |
| 3215 | if ((caps->stp_printer_type & PCL_PRINTER_TIFF) == PCL_PRINTER_TIFF && |
| 3216 | !(stp_get_debug_level() & STP_DBG_NO_COMPRESSION)) |
| 3217 | { |
| 3218 | stp_puts("\033*b2M", v); /* Mode 2 (TIFF) */ |
| 3219 | } |
| 3220 | else |
| 3221 | { |
| 3222 | stp_puts("\033*b0M", v); /* Mode 0 (no compression) */ |
| 3223 | } |
| 3224 | |
| 3225 | /* |
| 3226 | * Convert image size to printer resolution and setup the page for printing... |
| 3227 | */ |
| 3228 | |
| 3229 | out_width = xdpi * out_width / 72; |
| 3230 | out_height = ydpi * out_height / 72; |
| 3231 | |
| 3232 | if (pcl_media_size == PCL_PAPERSIZE_A4) |
| 3233 | { |
| 3234 | the_left_margin = caps->a4_margins.left_margin; |
| 3235 | the_top_margin = caps->a4_margins.top_margin; |
| 3236 | } |
| 3237 | else |
| 3238 | { |
| 3239 | the_left_margin = caps->normal_margins.left_margin; |
| 3240 | the_top_margin = caps->normal_margins.top_margin; |
| 3241 | } |
| 3242 | |
| 3243 | stp_dprintf(STP_DBG_PCL, v, "left %d margin %d top %d margin %d width %d height %d\n", |
| 3244 | left, the_left_margin, top, the_top_margin, out_width, out_height); |
| 3245 | |
| 3246 | if (manual_feed_left_adjust) |
| 3247 | { |
| 3248 | unsigned wdelta = caps->custom_max_width - stp_get_page_width(v); |
| 3249 | if (wdelta > 0) |
| 3250 | { |
| 3251 | /* |
| 3252 | * Why 3? I would expect it would be 2 here, but it appears |
| 3253 | * that at least one printer (LJ 1022) actually partially |
| 3254 | * adjusts the margin itself. Adjusting the left margin by 1/3 |
| 3255 | * of the difference between the maximum width and the actual |
| 3256 | * width experimentally yields correct results -- rlk 20081014 |
| 3257 | */ |
| 3258 | stp_dprintf(STP_DBG_PCL, v, |
| 3259 | " Adjusting manual feed left margin by %d\n", wdelta / 3); |
| 3260 | extra_left_margin += wdelta / 3; |
| 3261 | } |
| 3262 | } |
| 3263 | |
| 3264 | if (!privdata.do_cretb) { |
| 3265 | stp_zprintf(v, "\033&a%dH", 10 * (left + extra_left_margin)); /* Set left raster position */ |
| 3266 | stp_zprintf(v, "\033&a%dV", 10 * (top + the_top_margin)); |
| 3267 | /* Set top raster position */ |
| 3268 | } |
| 3269 | stp_zprintf(v, "\033*r%dS", out_width); /* Set raster width */ |
| 3270 | stp_zprintf(v, "\033*r%dT", out_height); /* Set raster height */ |
| 3271 | |
| 3272 | if (printing_color && caps->stp_printer_type & PCL_PRINTER_LJ_COLOR) |
| 3273 | { |
| 3274 | privdata.row_buf = stp_malloc(out_width * out_height); |
| 3275 | initialize_lj_color(v); |
| 3276 | } |
| 3277 | |
| 3278 | if (privdata.do_cretb) |
| 3279 | { |
| 3280 | /* Move to top left of printed area */ |
| 3281 | stp_zprintf(v, "\033*p%dY", (top + the_top_margin)*4); /* Measured in dots. */ |
| 3282 | stp_zprintf(v, "\033*p%dX", (left + extra_left_margin)*4); |
| 3283 | } |
| 3284 | stp_puts("\033*r1A", v); /* Start GFX */ |
| 3285 | |
| 3286 | /* |
| 3287 | * Allocate memory for the raster data... |
| 3288 | */ |
| 3289 | |
| 3290 | privdata.height = (out_width + 7) / 8; |
| 3291 | if (privdata.do_cret) |
| 3292 | privdata.height *= 2; |
| 3293 | else if (printing_color && caps->stp_printer_type & PCL_PRINTER_LJ_COLOR) |
| 3294 | privdata.height = out_width * 3; |
| 3295 | |
| 3296 | if (!printing_color) |
| 3297 | { |
| 3298 | black = stp_malloc(privdata.height); |
| 3299 | cyan = NULL; |
| 3300 | magenta = NULL; |
| 3301 | yellow = NULL; |
| 3302 | lcyan = NULL; |
| 3303 | lmagenta = NULL; |
| 3304 | } |
| 3305 | else |
| 3306 | { |
| 3307 | cyan = stp_malloc(privdata.height); |
| 3308 | magenta = stp_malloc(privdata.height); |
| 3309 | yellow = stp_malloc(privdata.height); |
| 3310 | |
| 3311 | if (caps->color_type & (PCL_COLOR_CMY | PCL_COLOR_RGB)) |
| 3312 | black = NULL; |
| 3313 | else |
| 3314 | black = stp_malloc(privdata.height); |
| 3315 | if (privdata.do_6color) |
| 3316 | { |
| 3317 | lcyan = stp_malloc(privdata.height); |
| 3318 | lmagenta = stp_malloc(privdata.height); |
| 3319 | } |
| 3320 | else |
| 3321 | { |
| 3322 | lcyan = NULL; |
| 3323 | lmagenta = NULL; |
| 3324 | } |
| 3325 | } |
| 3326 | |
| 3327 | if (black) |
| 3328 | { |
| 3329 | if (cyan) |
| 3330 | stp_set_string_parameter(v, "STPIOutputType", "KCMY"); |
| 3331 | else |
| 3332 | stp_set_string_parameter(v, "STPIOutputType", "Grayscale"); |
| 3333 | } |
| 3334 | else if (caps->color_type & PCL_COLOR_RGB) |
| 3335 | stp_set_string_parameter(v, "STPIOutputType", "RGB"); |
| 3336 | else |
| 3337 | stp_set_string_parameter(v, "STPIOutputType", "CMY"); |
| 3338 | |
| 3339 | /* Allocate buffer for pcl_mode2 tiff compression */ |
| 3340 | |
| 3341 | if ((caps->stp_printer_type & PCL_PRINTER_TIFF) == PCL_PRINTER_TIFF && |
| 3342 | !(stp_get_debug_level() & STP_DBG_NO_COMPRESSION)) |
| 3343 | { |
| 3344 | privdata.comp_buf = stp_malloc((privdata.height + 128 + 7) * 129 / 128); |
| 3345 | privdata.writefunc = pcl_mode2; |
| 3346 | } |
| 3347 | else |
| 3348 | { |
| 3349 | privdata.comp_buf = NULL; |
| 3350 | privdata.writefunc = pcl_mode0; |
| 3351 | } |
| 3352 | |
| 3353 | /* Set up dithering for special printers. */ |
| 3354 | |
| 3355 | #if 1 /* Leave alone for now */ |
| 3356 | if (!stp_check_float_parameter(v, "GCRLower", STP_PARAMETER_ACTIVE)) |
| 3357 | stp_set_default_float_parameter(v, "GCRLower", .3); |
| 3358 | if (!stp_check_float_parameter(v, "GCRUpper", STP_PARAMETER_ACTIVE)) |
| 3359 | stp_set_default_float_parameter(v, "GCRUpper", .999); |
| 3360 | #endif |
| 3361 | stp_dither_init(v, image, out_width, xdpi, ydpi); |
| 3362 | |
| 3363 | if (privdata.nodither) |
| 3364 | { |
| 3365 | int i = 0; |
| 3366 | stp_channel_reset(v); |
| 3367 | if (black) |
| 3368 | stp_channel_add(v, i++, 0, 1.0); |
| 3369 | if (cyan) |
| 3370 | stp_channel_add(v, i++, 0, 1.0); |
| 3371 | if (magenta) |
| 3372 | stp_channel_add(v, i++, 0, 1.0); |
| 3373 | if (yellow) |
| 3374 | stp_channel_add(v, i++, 0, 1.0); |
| 3375 | } |
| 3376 | else |
| 3377 | { |
| 3378 | if (black) |
| 3379 | { |
| 3380 | stp_dither_add_channel(v, black, STP_ECOLOR_K, 0); |
| 3381 | stp_channel_set_black_channel(v, STP_ECOLOR_K); |
| 3382 | } |
| 3383 | if (cyan) |
| 3384 | stp_dither_add_channel(v, cyan, STP_ECOLOR_C, 0); |
| 3385 | if (lcyan) |
| 3386 | stp_dither_add_channel(v, lcyan, STP_ECOLOR_C, 1); |
| 3387 | if (magenta) |
| 3388 | stp_dither_add_channel(v, magenta, STP_ECOLOR_M, 0); |
| 3389 | if (lmagenta) |
| 3390 | stp_dither_add_channel(v, lmagenta, STP_ECOLOR_M, 1); |
| 3391 | if (yellow) |
| 3392 | stp_dither_add_channel(v, yellow, STP_ECOLOR_Y, 0); |
| 3393 | } |
| 3394 | |
| 3395 | /* Ensure that density does not exceed 1.0 */ |
| 3396 | |
| 3397 | if (!stp_check_float_parameter(v, "Density", STP_PARAMETER_DEFAULTED)) |
| 3398 | { |
| 3399 | stp_set_float_parameter_active(v, "Density", STP_PARAMETER_ACTIVE); |
| 3400 | stp_set_float_parameter(v, "Density", 1.0); |
| 3401 | } |
| 3402 | |
| 3403 | stp_dprintf(STP_DBG_PCL, v, "Density: %f\n", stp_get_float_parameter(v, "Density")); |
| 3404 | if (stp_get_float_parameter(v, "Density") > 1.0) |
| 3405 | stp_set_float_parameter(v, "Density", 1.0); |
| 3406 | density = stp_get_float_parameter(v, "Density"); |
| 3407 | |
| 3408 | if (privdata.do_cret) /* 4-level printing for 800/1120 */ |
| 3409 | { |
| 3410 | if (yellow) |
| 3411 | stp_dither_set_inks_simple(v, STP_ECOLOR_Y, 3, dot_sizes_use, 1.0, 0.08); |
| 3412 | if (black && !privdata.do_cretb) |
| 3413 | stp_dither_set_inks_simple(v, STP_ECOLOR_K, 3, dot_sizes_use, 1.0, 1.0); |
| 3414 | |
| 3415 | /* Note: no printer I know of does both CRet (4-level) and 6 color, but |
| 3416 | what the heck. variable_dither_ranges copied from print-escp2.c */ |
| 3417 | |
| 3418 | if (privdata.do_6color) /* Photo for 69x */ |
| 3419 | { |
| 3420 | stp_dither_set_inks_full(v, STP_ECOLOR_C, 6, variable_shades, 1.0, |
| 3421 | 0.31 / .5); |
| 3422 | stp_dither_set_inks_full(v, STP_ECOLOR_M, 6, variable_shades, 1.0, |
| 3423 | 0.61 / .97); |
| 3424 | } |
| 3425 | else |
| 3426 | { |
| 3427 | if (cyan) |
| 3428 | stp_dither_set_inks_simple(v, STP_ECOLOR_C, 3, dot_sizes_use, 1.0, |
| 3429 | 0.31 / .5); |
| 3430 | if (magenta) |
| 3431 | stp_dither_set_inks_simple(v, STP_ECOLOR_M, 3, dot_sizes_use, 1.0, |
| 3432 | 0.61 / .7); |
| 3433 | } |
| 3434 | } |
| 3435 | else if (privdata.do_6color) |
| 3436 | { |
| 3437 | /* Set light inks for 6 color printers. |
| 3438 | Numbers copied from print-escp2.c */ |
| 3439 | stp_dither_set_inks_full(v, STP_ECOLOR_C, 2, photo_dither_shades, 1.0, |
| 3440 | 0.31 / .5); |
| 3441 | stp_dither_set_inks_full(v, STP_ECOLOR_M, 2, photo_dither_shades, 1.0, |
| 3442 | 0.61 / .7); |
| 3443 | } |
| 3444 | if (black) |
| 3445 | stp_channel_set_density_adjustment(v, STP_ECOLOR_K, 0, |
| 3446 | get_double_param(v, "BlackDensity") * |
| 3447 | density); |
| 3448 | if (cyan) |
| 3449 | stp_channel_set_density_adjustment(v, STP_ECOLOR_C, 0, |
| 3450 | get_double_param(v, "CyanDensity") * |
| 3451 | density); |
| 3452 | if (magenta) |
| 3453 | stp_channel_set_density_adjustment(v, STP_ECOLOR_M, 0, |
| 3454 | get_double_param(v, "MagentaDensity") * |
| 3455 | density); |
| 3456 | if (yellow) |
| 3457 | stp_channel_set_density_adjustment(v, STP_ECOLOR_Y, 0, |
| 3458 | get_double_param(v, "YellowDensity") * |
| 3459 | density); |
| 3460 | if (lcyan) |
| 3461 | stp_channel_set_density_adjustment |
| 3462 | (v, STP_ECOLOR_C, 1, (get_double_param(v, "CyanDensity") * |
| 3463 | get_double_param(v, "LightCyanTrans") * |
| 3464 | density)); |
| 3465 | if (lmagenta) |
| 3466 | stp_channel_set_density_adjustment |
| 3467 | (v, STP_ECOLOR_M, 1, (get_double_param(v, "MagentaDensity") * |
| 3468 | get_double_param(v, "LightMagentaTrans") * |
| 3469 | density)); |
| 3470 | |
| 3471 | |
| 3472 | if (!(caps->color_type & PCL_COLOR_RGB)) |
| 3473 | { |
| 3474 | if (!stp_check_curve_parameter(v, "HueMap", STP_PARAMETER_ACTIVE)) |
| 3475 | { |
| 3476 | stp_curve_t *hue_adjustment = |
| 3477 | stp_curve_create_from_string(standard_hue_adjustment); |
| 3478 | stp_set_curve_parameter(v, "HueMap", hue_adjustment); |
| 3479 | stp_curve_destroy(hue_adjustment); |
| 3480 | } |
| 3481 | if (!stp_check_curve_parameter(v, "LumMap", STP_PARAMETER_ACTIVE)) |
| 3482 | { |
| 3483 | stp_curve_t *lum_adjustment = |
| 3484 | stp_curve_create_from_string(standard_lum_adjustment); |
| 3485 | #if 0 |
| 3486 | /* |
| 3487 | * This would represent a change to the PCL driver in 5.2.12 |
| 3488 | * |
| 3489 | * This call was missing and has represented a bug (if a clearly |
| 3490 | * non-fatal one) in the PCL driver since time immemorial. The |
| 3491 | * non-use of the variable was finally called out by gcc6. In my |
| 3492 | * judgment, fixing the bug and changing the output of many PCL |
| 3493 | * printers (even if it were for the better) would be more problematic |
| 3494 | * than leaving the output as-is. |
| 3495 | * |
| 3496 | * - Robert Krawitz 2016-12-29 |
| 3497 | */ |
| 3498 | stp_set_curve_parameter(v, "LumMap", lum_adjustment); |
| 3499 | #endif |
| 3500 | stp_curve_destroy(lum_adjustment); |
| 3501 | } |
| 3502 | } |
| 3503 | |
| 3504 | if (printing_color && (caps->stp_printer_type & PCL_PRINTER_LJ_COLOR)) |
| 3505 | { |
| 3506 | stp_set_float_parameter(v, "AppGammaScale", 1.0); |
| 3507 | (void) stp_color_init(v, image, 256); |
| 3508 | } |
| 3509 | else |
| 3510 | (void) stp_color_init(v, image, 65536); |
| 3511 | |
| 3512 | errdiv = image_height / out_height; |
| 3513 | errmod = image_height % out_height; |
| 3514 | errval = 0; |
| 3515 | errlast = -1; |
| 3516 | errline = 0; |
| 3517 | privdata.blank_lines = 0; |
| 3518 | #ifndef PCL_DEBUG_DISABLE_BLANKLINE_REMOVAL |
| 3519 | privdata.do_blank = ((caps->stp_printer_type & PCL_PRINTER_BLANKLINE) == |
| 3520 | PCL_PRINTER_BLANKLINE); |
| 3521 | #else |
| 3522 | privdata.do_blank = 0; |
| 3523 | #endif |
| 3524 | stp_allocate_component_data(v, "Driver", NULL, NULL, &privdata); |
| 3525 | |
| 3526 | for (y = 0; y < out_height; y ++) |
| 3527 | { |
| 3528 | int duplicate_line = 1; |
| 3529 | if (errline != errlast) |
| 3530 | { |
| 3531 | errlast = errline; |
| 3532 | duplicate_line = 0; |
| 3533 | if (stp_color_get_row(v, image, errline, &zero_mask)) |
| 3534 | { |
| 3535 | status = 2; |
| 3536 | break; |
| 3537 | } |
| 3538 | } |
| 3539 | if (privdata.nodither) |
| 3540 | { |
| 3541 | if (! duplicate_line) |
| 3542 | { |
| 3543 | unsigned row_errdiv = image_width / out_width; |
| 3544 | unsigned row_errmod = image_width % out_width; |
| 3545 | unsigned row_errval = 0; |
| 3546 | unsigned row_errlast = -1; |
| 3547 | unsigned row_errcol = 0; |
| 3548 | unsigned short *output = stp_channel_get_output(v); |
| 3549 | unsigned char *optr = privdata.row_buf; |
| 3550 | unsigned int x; |
| 3551 | for (x = 0; x < out_width; x++) |
| 3552 | { |
| 3553 | if (row_errcol != row_errlast) |
| 3554 | { |
| 3555 | row_errlast = row_errcol; |
| 3556 | optr[0] = output[(row_errcol * 3) + 0] / (unsigned short) 257; |
| 3557 | optr[1] = output[(row_errcol * 3) + 1] / (unsigned short) 257; |
| 3558 | optr[2] = output[(row_errcol * 3) + 2] / (unsigned short) 257; |
| 3559 | } |
| 3560 | else |
| 3561 | { |
| 3562 | optr[0] = optr[-3]; |
| 3563 | optr[1] = optr[-2]; |
| 3564 | optr[2] = optr[-1]; |
| 3565 | } |
| 3566 | optr += 3; |
| 3567 | row_errval += row_errmod; |
| 3568 | row_errcol += row_errdiv; |
| 3569 | if (row_errval >= out_width) |
| 3570 | { |
| 3571 | row_errval -= out_width; |
| 3572 | row_errcol++; |
| 3573 | } |
| 3574 | } |
| 3575 | } |
| 3576 | (*(privdata.writefunc))(v, privdata.row_buf, privdata.height, 1); |
| 3577 | } |
| 3578 | else |
| 3579 | { |
| 3580 | stp_dither(v, y, duplicate_line, zero_mask, NULL); |
| 3581 | pcl_printfunc(v); |
| 3582 | } |
| 3583 | stp_dprintf(STP_DBG_PCL, v,"pcl_print: y = %d, line = %d, val = %d, mod = %d, height = %d\n", |
| 3584 | y, errline, errval, errmod, out_height); |
| 3585 | errval += errmod; |
| 3586 | errline += errdiv; |
| 3587 | if (errval >= out_height) |
| 3588 | { |
| 3589 | errval -= out_height; |
| 3590 | errline ++; |
| 3591 | } |
| 3592 | } |
| 3593 | |
| 3594 | /* Output trailing blank lines (may not be required?) */ |
| 3595 | |
| 3596 | if (privdata.blank_lines > 1) |
| 3597 | { |
| 3598 | privdata.blank_lines--; /* correct for one already output */ |
| 3599 | stp_dprintf(STP_DBG_PCL, v, "Blank Lines = %d\n", privdata.blank_lines); |
| 3600 | stp_zprintf(v, "\033*b%dY", privdata.blank_lines); |
| 3601 | privdata.blank_lines=0; |
| 3602 | } |
| 3603 | |
| 3604 | stp_image_conclude(image); |
| 3605 | |
| 3606 | /* |
| 3607 | * Cleanup... |
| 3608 | */ |
| 3609 | |
| 3610 | if (black != NULL) |
| 3611 | stp_free(black); |
| 3612 | if (cyan != NULL) |
| 3613 | { |
| 3614 | stp_free(cyan); |
| 3615 | stp_free(magenta); |
| 3616 | stp_free(yellow); |
| 3617 | } |
| 3618 | if (lcyan != NULL) |
| 3619 | { |
| 3620 | stp_free(lcyan); |
| 3621 | stp_free(lmagenta); |
| 3622 | } |
| 3623 | |
| 3624 | if (privdata.comp_buf != NULL) |
| 3625 | stp_free(privdata.comp_buf); |
| 3626 | if (privdata.row_buf != NULL) |
| 3627 | stp_free(privdata.row_buf); |
| 3628 | |
| 3629 | if ((caps->stp_printer_type & PCL_PRINTER_NEW_ERG) == PCL_PRINTER_NEW_ERG) |
| 3630 | stp_puts("\033*rC", v); |
| 3631 | else |
| 3632 | stp_puts("\033*rB", v); |
| 3633 | |
| 3634 | if ((privdata.duplex == 1) && ((page_number & 1) == 0)) |
| 3635 | stp_puts("\014", v); /* Form feed */ |
| 3636 | else |
| 3637 | { |
| 3638 | stp_puts("\033&l0H", v); /* Eject page */ |
| 3639 | if (privdata.do_cretb) |
| 3640 | stp_zprintf(v, "\033%%-12345X\n"); |
| 3641 | stp_puts("\033E", v); /* PCL reset */ |
| 3642 | } |
| 3643 | return status; |
| 3644 | } |
| 3645 | |
| 3646 | static int |
| 3647 | pcl_print(const stp_vars_t *v, stp_image_t *image) |
| 3648 | { |
| 3649 | int status; |
| 3650 | stp_vars_t *nv = stp_vars_create_copy(v); |
| 3651 | status = pcl_do_print(nv, image); |
| 3652 | stp_vars_destroy(nv); |
| 3653 | return status; |
| 3654 | } |
| 3655 | |
| 3656 | static const stp_printfuncs_t print_pcl_printfuncs = |
| 3657 | { |
| 3658 | pcl_list_parameters, |
| 3659 | pcl_parameters, |
| 3660 | stp_default_media_size, |
| 3661 | pcl_imageable_area, |
| 3662 | pcl_imageable_area, |
| 3663 | pcl_limit, |
| 3664 | pcl_print, |
| 3665 | pcl_describe_resolution, |
| 3666 | pcl_describe_output, |
| 3667 | stp_verify_printer_params, |
| 3668 | NULL, |
| 3669 | NULL, |
| 3670 | NULL, |
| 3671 | pcl_describe_papersize |
| 3672 | }; |
| 3673 | |
| 3674 | |
| 3675 | /* |
| 3676 | * 'pcl_mode0()' - Send PCL graphics using mode 0 (no) compression. |
| 3677 | */ |
| 3678 | |
| 3679 | static void |
| 3680 | pcl_mode0(stp_vars_t *v, /* I - Print file or command */ |
| 3681 | unsigned char *line, /* I - Output bitmap data */ |
| 3682 | int height, /* I - Height of bitmap data */ |
| 3683 | int last_plane) /* I - True if this is the last plane */ |
| 3684 | { |
| 3685 | stp_zprintf(v, "\033*b%d%c", height, last_plane ? 'W' : 'V'); |
| 3686 | stp_zfwrite((const char *) line, height, 1, v); |
| 3687 | } |
| 3688 | |
| 3689 | |
| 3690 | /* |
| 3691 | * 'pcl_mode2()' - Send PCL graphics using mode 2 (TIFF) compression. |
| 3692 | */ |
| 3693 | |
| 3694 | static void |
| 3695 | pcl_mode2(stp_vars_t *v, /* I - Print file or command */ |
| 3696 | unsigned char *line, /* I - Output bitmap data */ |
| 3697 | int height, /* I - Height of bitmap data */ |
| 3698 | int last_plane) /* I - True if this is the last plane */ |
| 3699 | { |
| 3700 | pcl_privdata_t *privdata = |
| 3701 | (pcl_privdata_t *) stp_get_component_data(v, "Driver"); |
| 3702 | unsigned char *comp_buf = privdata->comp_buf; |
| 3703 | unsigned char *comp_ptr; /* Current slot in buffer */ |
| 3704 | |
| 3705 | stp_pack_tiff(v, line, height, comp_buf, &comp_ptr, NULL, NULL); |
| 3706 | |
| 3707 | /* |
| 3708 | * Send a line of raster graphics... |
| 3709 | */ |
| 3710 | |
| 3711 | stp_zprintf(v, "\033*b%d%c", (int)(comp_ptr - comp_buf), last_plane ? 'W' : 'V'); |
| 3712 | stp_zfwrite((const char *)comp_buf, comp_ptr - comp_buf, 1, v); |
| 3713 | } |
| 3714 | |
| 3715 | |
| 3716 | static stp_family_t print_pcl_module_data = |
| 3717 | { |
| 3718 | &print_pcl_printfuncs, |
| 3719 | NULL |
| 3720 | }; |
| 3721 | |
| 3722 | |
| 3723 | static int |
| 3724 | print_pcl_module_init(void) |
| 3725 | { |
| 3726 | return stpi_family_register(print_pcl_module_data.printer_list); |
| 3727 | } |
| 3728 | |
| 3729 | |
| 3730 | static int |
| 3731 | print_pcl_module_exit(void) |
| 3732 | { |
| 3733 | return stpi_family_unregister(print_pcl_module_data.printer_list); |
| 3734 | } |
| 3735 | |
| 3736 | |
| 3737 | /* Module header */ |
| 3738 | #define stp_module_version print_pcl_LTX_stp_module_version |
| 3739 | #define stp_module_data print_pcl_LTX_stp_module_data |
| 3740 | |
| 3741 | stp_module_version_t stp_module_version = {0, 0}; |
| 3742 | |
| 3743 | stp_module_t stp_module_data = |
| 3744 | { |
| 3745 | "pcl", |
| 3746 | VERSION, |
| 3747 | "PCL family driver", |
| 3748 | STP_MODULE_CLASS_FAMILY, |
| 3749 | NULL, |
| 3750 | print_pcl_module_init, |
| 3751 | print_pcl_module_exit, |
| 3752 | (void *) &print_pcl_module_data |
| 3753 | }; |