Debian Codegraph @

doc/developer/new-printer.xml

raw symbols SCIP
1 <chapter>
2 <title>Adding a new printer</title>
3 <para>
4 This chapter covers adding a new ESCP/2, PCL, or Canon printer.
5 Writing a new driver module is not covered.
6 </para>
7 <para>
8 The three steps to adding a printer are:
9 <orderedlist>
10 <listitem>
11 <para>
12 Add an entry to <filename>printers.xml</filename>.
13 </para>
14 </listitem>
15 <listitem>
16 <para>
17 Add the appropriate code and data to the appropriate
18 driver module.
19 </para>
20 </listitem>
21 <listitem>
22 <para>
23 Tune the printer.
24 </para>
25 </listitem>
26 </orderedlist>
27 </para>
28 <para>
29 Printer information is stored in two places: in
30 <filename>printers.xml</filename> (which contains the list of
31 printer models available to the the upper-level application),
32 and in the appropriate driver file
33 (<filename>print-escp2.c</filename>,
34 <filename>print-pcl.c</filename>, or
35 <filename>print-canon.c</filename>).
36 </para>
37 <sect1>
38 <title><filename>printers.xml</filename></title>
39 <para>
40 <filename>printers.xml</filename> is an XML file that contains
41 very simple printer definitions. A schema may be used to
42 validate the XML (<filename>src/main/gutenprint.xsd</filename>).
43 This is an example definition:
44 </para>
45 <informalexample>
46 <programlisting>&lt;printer name="EPSON Stylus Color 1500" driver="escp2-1500"&gt;
47 &lt;color value="true"/&gt;
48 &lt;model value="2"/&gt;
49 &lt;gamma value="0.597"/&gt;
50 &lt;density value="1.0"/&gt;
51 &lt;/printer&gt;</programlisting>
52 </informalexample>
53 <para>
54 There are other tags that may be present. The only ones that
55 are mandatory are <literal>&lt;printer&gt;</literal>,
56 <literal>&lt;color&gt;</literal> and
57 <literal>&lt;model&gt;</literal>. The other optional parameters
58 (<literal>&lt;gamma&gt;</literal> and
59 <literal>&lt;density&gt;</literal> in this case) can be used to
60 adjust control settings. This is probably not the right place
61 for them; the printer drivers themselves should contain this
62 information. There's probably no good reason for anything but
63 gamma and density to be in here. Gamma refers to the printer's
64 gamma factor; density is the desired base ink density for the
65 printer. The Epson driver contains the density information for
66 each printer at each resolution internally. An even better
67 driver would adjust density and possibly even gamma for paper
68 type. All the more reason not to have that information here.
69 </para>
70 <para>
71 If you really are curious about what tags are permitted, please
72 see the schema. These are the definitions of the tags that do
73 matter:
74 </para>
75 <variablelist>
76 <title>printdef XML elements</title>
77 <varlistentry>
78 <term><literal>&lt;family&gt;</literal></term>
79 <listitem>
80 <para>
81 This defines what driver module this printer uses. The
82 attribute <literal>name</literal> is the name of the
83 family driver to associate the printers with, for example
84 <literal>escp2</literal>, <literal>pcl</literal>,
85 <literal>canon</literal>, <literal>ps</literal> or
86 <literal>raw</literal>. This tag may only contain
87 <literal>&lt;printer&gt;</literal> elements.
88 </para>
89 </listitem>
90 </varlistentry>
91 <varlistentry>
92 <term><literal>&lt;printer&gt;</literal></term>
93 <listitem>
94 <para>
95 This starts the definition of a printer. It must contain
96 the attributes <literal>name</literal> and
97 <literal>driver</literal>. <literal>name</literal> should
98 be is the full name of the printer, and must be human
99 readable. <literal>driver</literal> should consist of
100 alphanumerics and hyphens, and be fairly short.
101 <literal>name</literal> is what will appear in the
102 user-visible listing of printers, and may be translated
103 into the user's language, while <literal>driver</literal>
104 is what is actually used to key into the list of printers.
105 It is legal to have multiple printers with the same driver
106 name.
107 </para>
108 </listitem>
109 </varlistentry>
110 <varlistentry>
111 <term><literal>&lt;color&gt;</literal></term>
112 <listitem>
113 <para>
114 This tag may not contain any content, but the
115 <literal>value</literal> attribute may be set to
116 <literal>true</literal> or <literal>false</literal>. This
117 indicates that this printer is capable of color, or is not
118 capable of color respectively.
119 </para>
120 </listitem>
121 </varlistentry>
122 <varlistentry>
123 <term><literal>&lt;model&gt;</literal></term>
124 <listitem>
125 <para>
126 This defines a model number. This tag may not contain any
127 content, but the <literal>value</literal> attribute may be
128 set to a positive integer. This is passed into the
129 driver, which may do whatever it cares to with
130 it&mdash;index into a table, compute on, or whatever.
131 This need not be unique.
132 </para>
133 </listitem>
134 </varlistentry>
135 </variablelist>
136 </sect1>
137 <sect1>
138 <title>The driver file</title>
139 <para>
140 Adding a new printer to a driver module
141 <filename>print-canon.c</filename>,
142 <filename>print-escp2.c</filename>,
143 <filename>print-lexmark.c</filename>, or
144 <filename>print-pcl.c</filename> or
145 (<filename>print-ps.c</filename> is really ad hoc) requires a
146 bit more planning. Each driver is somewhat different, but they
147 all generally have a vector of printer definitions, and the code
148 does some special casing based on particular printer
149 capabilities. The PCL and Canon drivers are quite similar; the
150 Canon driver was actually cribbed from the PCL driver, but it
151 then returned the favor.
152 </para>
153 <para>
154 The Epson driver is a little bit different. Canon and PCL
155 printers have some amount of intelligence; a lot of them have
156 specific ink options, and know about specific paper sizes and
157 types, and must be told the right thing. Epson printers have
158 somewhat less intelligence and will more or less do exactly what
159 the host tells it to do in a fairly regular fashion. I actually
160 prefer this; it isn't materially more work for the host to
161 compute things like exact paper sizes and such, it allows a lot
162 more tweaking, and it may be why Epson has been more open with
163 information&mdash;the communication protocol doesn't really
164 contain very much IP, so they have less reason to keep it
165 secret.
166 </para>
167 <para>
168 The sections about PCL and Canon printers need completing.
169 </para>
170 <sect2>
171 <title>Epson inkjet printers</title>
172 <para>
173 The <varname>model_capabilities</varname> vector in
174 <filename>print-escp2.c</filename> contains one entry for each
175 defined printer model. The <literal>model</literal> parameter
176 in <filename>printers.xml</filename> is an index into this
177 table.
178 </para>
179 <para>
180 In general, the new printers have fewer eccentricities than
181 the older printers. That doesn't mean they're simpler, just
182 that they're more consistent.
183 </para>
184 <para>
185 <type>escp2_printer_t</type> is a C struct defined as follows:
186 </para>
187 <informalexample>
188 <programlisting>typedef struct escp2_printer
189 {
190 model_cap_t flags; /* Bitmask of flags, see below */
191 /*****************************************************************************/
192 int nozzles; /* Number of nozzles per color */
193 int min_nozzles; /* Minimum number of nozzles per color */
194 int nozzle_separation; /* Separation between rows, in 1/360" */
195 int black_nozzles; /* Number of black nozzles (may be extra) */
196 int min_black_nozzles; /* # of black nozzles (may be extra) */
197 int black_nozzle_separation; /* Separation between rows */
198 /*****************************************************************************/
199 int xres; /* Normal distance between dots in */
200 /* softweave mode (inverse inches) */
201 int enhanced_xres; /* Distance between dots in highest */
202 /* quality modes */
203 int base_separation; /* Basic unit of row separation */
204 int base_resolution; /* Base hardware spacing (above this */
205 /* always requires multiple passes) */
206 int enhanced_resolution;/* Above this we use the */
207 /* enhanced_xres rather than xres */
208 int resolution_scale; /* Scaling factor for ESC(D command */
209 int max_black_resolution; /* Above this resolution, we */
210 /* must use color parameters */
211 /* rather than (faster) black */
212 /* only parameters*/
213 int max_hres;
214 int max_vres;
215 int min_hres;
216 int min_vres;
217 /*****************************************************************************/
218 int max_paper_width; /* Maximum paper width, in points */
219 int max_paper_height; /* Maximum paper height, in points */
220 int min_paper_width; /* Maximum paper width, in points */
221 int min_paper_height; /* Maximum paper height, in points */
222 /* Softweave: */
223 int left_margin; /* Left margin, points */
224 int right_margin; /* Right margin, points */
225 int top_margin; /* Absolute top margin, points */
226 int bottom_margin; /* Absolute bottom margin, points */
227 /* "Micro"weave: */
228 int m_left_margin; /* Left margin, points */
229 int m_right_margin; /* Right margin, points */
230 int m_top_margin; /* Absolute top margin, points */
231 int m_bottom_margin; /* Absolute bottom margin, points */
232 /*****************************************************************************/
233 int extra_feed; /* Extra distance the paper can be spaced */
234 /* beyond the bottom margin, in 1/360". */
235 /* (maximum useful value is */
236 /* nozzles * nozzle_separation) */
237 int separation_rows; /* Some printers require funky spacing */
238 /* arguments in microweave mode. */
239 int pseudo_separation_rows;/* Some printers require funky */
240 /* spacing arguments in softweave mode */
241
242 int zero_margin_offset; /* Offset to use to achieve */
243 /* zero-margin printing */
244 /*****************************************************************************/
245 /* The stylus 480 and 580 have an unusual arrangement of
246 color jets that need special handling */
247 const int *head_offset;
248 int initial_vertical_offset;
249 int black_initial_vertical_offset;
250
251 /*****************************************************************************/
252 const int *dot_sizes; /* Vector of dot sizes for resolutions */
253 const double *densities; /* List of densities for each printer */
254 const escp2_variable_inklist_t *inks; /* Choices of inks for this printer */
255 /*****************************************************************************/
256 const double *lum_adjustment;
257 const double *hue_adjustment;
258 const double *sat_adjustment;
259 const paperlist_t *paperlist;
260 } escp2_printer_t;</programlisting>
261 </informalexample>
262 <para>
263 The printer definition block is divided into 8 sections.
264 The first section is a set of miscellaneous printer options.
265 These are described in the code, and will not be discussed
266 further here.
267 </para>
268 <para>
269 The second section describes the number of nozzles and the
270 separation between nozzles in base units. The base unit is
271 1/360" for all currently supported printers, but future
272 printers may support a smaller base unit.
273 </para>
274 <para>
275 Many printers have more black nozzles than nozzles of other
276 colors, and when used in black and white mode, it's possible
277 to use these extra nozzles, which speeds up printing. As an
278 example, a printer that is specified to have 48 cyan, magenta,
279 and yellow nozzles, and 144 black nozzles, can use all 144
280 black nozzles when printing black ink only. When printing in
281 color, only 48 nozzles of each color (including black) can be
282 used.
283 </para>
284 <para>
285 Most printers can print using either the number of nozzles
286 available or any smaller number. Some printers require that
287 all of the nozzles be used. Those printers will set
288 <varname>min_nozzles</varname> and/or
289 <varname>min_black_nozzles</varname> to the same value as
290 <varname>nozzles</varname> and/or
291 <varname>black_nozzles</varname>.
292 </para>
293 <para>
294 The third section defines basic units of measure for the
295 printer, including the standard separation between dots, the
296 base nozzle separation, and the minimum and maximum printing
297 resolutions the printer supports. Most of these are fairly
298 self-explanatory, but some are not obvious.
299 </para>
300 <para>
301 Most Epson printers, other than the high-end Stylus Pro
302 models, cannot print dots spaced more closely than 1/360" or
303 1/720" apart (this is the setting for <varname>xres</varname>.
304 This is true even for printers that support resolutions of
305 1440 or 2880 DPI. In these cases, the data must be printed in
306 2, 4, or 8 passes. While the printer can position the head to
307 a resolution of 1/1440" or 1/2880", the head cannot deposit
308 ink that frequently.
309 </para>
310 <para>
311 Some printers can only print in their very best quality (using
312 the smallest dots available) printing at a lower resolution.
313 For example, the Stylus Photo EX can normally print with a dot
314 spacing of 1/720". The smallest dot size cannot be printed
315 with a dot spacing of less than 1/360", however. In this
316 case, we use <varname>enhanced_xres</varname> to specify the
317 resolution to be used in this enhanced mode, and
318 <varname>enhanced_resolution</varname> to specify the printing
319 resolution above which we use the
320 <varname>enhanced_xres</varname>.
321 </para>
322 <para>
323 The <varname>resolution_scale</varname> command is used to
324 specify scaling factors for the dot separation on newer
325 printers. It should always be 14400 with current printers.
326 </para>
327 <para>
328 The fourth section specifies the minimum and maximum paper
329 sizes, and the margins. Some printers allow use of narrower
330 margins when softweave is used; both sets of margins are
331 specified.
332 </para>
333 <para>
334 There is a convenient <function>INCH</function> macro defined
335 to make specification of the
336 <varname>max_paper_width</varname> and
337 <varname>max_paper_height</varname> more legible. It
338 multiplies <constant>72</constant> by the provided expression
339 to get the appropriate number of points. For example, to
340 specify 8.5", <literal>INCH(17/2)</literal> expands to
341 <literal>(72 * 17/2)</literal>, which is evaluated left to
342 right, and hence generates the correct value.
343 </para>
344 <para>
345 The fifth section specifies some miscellaneous values that are
346 required for certain printers. For most printers, the correct
347 values are <constant>1</constant> for
348 <varname>separation_rows</varname> and <constant>0</constant>
349 for the others. Very, very few printers require (or allow)
350 <varname>separation_rows</varname> to be anything but
351 <constant>1</constant> and
352 <varname>pseudo_separation_rows</varname> other than
353 <constant>0</constant>. The Stylus Color 1520, Stylus Color
354 800, Stylus Color 850, and (strangely enough to my mind, since
355 it's a newer printer) Stylus Color 660 seem to be the only
356 exceptions.
357 </para>
358 <para>
359 <varname>zero_margin_offset</varname> is used to specify an
360 additional negative horizontal offset required to print to the
361 edges of the paper on newer Stylus Photo printers. These must
362 be determined empirically; good starting values are
363 <constant>100</constant> for 1440 DPI and
364 <constant>50</constant> for 2880 DPI printers. The goal is to
365 print to the edge of the page, but not over it.
366 </para>
367 <para>
368 The sixth section specifies head offsets for printers that do
369 not have the color jets aligned. Certain printers, such as
370 the Stylus Color 480, have an unusual head arrangement whereby
371 instead of all of the colors being aligned vertically, the
372 nozzles are configured in groups. These printers are easy to
373 determine; if the normal head offset of zero for each color is
374 used, the printing will be vertically out of alignment. Most
375 of these printers require specification of a negative offset
376 for printing to the top edge of the paper; typically these
377 printers do not require such an offset when printing black
378 only.
379 </para>
380 <para>
381 The seventh section specifies the most difficult values to
382 tune, the dot sizes, printing densities, and ink values (for
383 variable dot size enabled printers). These will be described
384 in detail below.
385 </para>
386 <para>
387 The last section specifies luminosity, hue, and saturation
388 adjustment vectors for the printer, and the paper definitions.
389 These are used to adjust the color in
390 <emphasis>Photograph</emphasis> and <emphasis>Solid
391 Colors</emphasis> output modes. These are each vectors of 48
392 (actually 49, as the first value must be duplicated) doubles
393 that remap the luminosity, hue, and saturation respectively.
394 The hue is calculated, and the value used to interpolate
395 between the two closest points in each vector.
396 </para>
397 <para>
398 The paper definitions is a set of paper definitions. The
399 paper definition contains the name of the paper type, special
400 settings that are required for printers to process the paper
401 correctly, and a set of adjustment values. These are not
402 currently discussed here.
403 </para>
404 <para>
405 The lists of dot sizes and densities contain values for 13
406 printing modes: 120/180 DPI using printer weaving (single row;
407 incorrectly referred to as &ldquo;microweave&rdquo;) and
408 &ldquo;soft&rdquo; weaving (the driver determines the exact
409 pattern of dot layout), 360 DPI microweave and softweave,
410 720&times;360 DPI microweave and softweave, 720 DPI microweave
411 and softweave, 1440&times;720 microweave and softweave,
412 2880&times;720 microweave and softweave, and 2880&times;1440
413 softweave only. Printer weaving is referred to as
414 &ldquo;microweave&rdquo; for historical reasons.
415 </para>
416 <para>
417 For the dot sizes, the value for each element in the vector
418 selects the dot size to be used when printing at this (or
419 similar) resolution. The dot sizes are determined by
420 consulting the programming manual for the printer and
421 experimenting as described below. Current Epson printers
422 always use dot sizes less than <constant>16</constant>
423 (<constant>0x10</constant>), to indicate single dot size (each
424 dot is represented by 1 bit, and it's either printed or not),
425 and dot sizes of <constant>16</constant> or greater to
426 indicate variable dot size (each dot is represented by 2 bits,
427 and it can either be not printed or take on 2 or 3 values,
428 representing the relative size of the printed dot). Variable
429 dot sizes permit the use of very small dots (which would be
430 too small to fill the page and produce solid black) in light
431 areas, while allowing the page to be filled with larger dots
432 in darker areas.
433 </para>
434 <para>
435 Even single dot size printers can usually produce dots of
436 different sizes; it's just illegal to actually try to switch
437 dot size during a page. These dots are also much bigger than
438 those used in true variable dot size printing.
439 </para>
440 <para>
441 A dot size of <constant>-1</constant> indicates that this
442 resolution is illegal for the printer in question. Any
443 resolutions that would use this dot size will not be presented
444 to the user. A dot size of <constant>-2</constant> indicates
445 that this resolution is legal, but that the driver is not to
446 attempt to set any dot size. Some very old printers do not
447 support the command to set the dot size.
448 </para>
449 <para>
450 Most printers support a dot size of <constant>0</constant> as
451 a mode-specific default, but it's often a bigger dot than
452 necessary. Printers usually also support some dot sizes
453 between <constant>1</constant> and <constant>3</constant>.
454 Usually <constant>1</constant> is the right dot size for 720
455 and 1440 DPI printing, and <constant>3</constant> works best
456 at 360 DPI.
457 </para>
458 <para>
459 Variable dot size printers usually support 2 or 3 sets of
460 variable dot sizes. Older printers based on a 6 picolitre
461 drop (the 480, 720, 740, 750, 900, and 1200) support two: mode
462 16 (0x10 in hexadecimal) for normal variable dots at 1440 or
463 720 DPI, and mode 17 (0x10) for special larger dots at 360
464 DPI. Newer printers based on 4 picolitre drops normally
465 support three sizes: <constant>0x10</constant> for 4 pl base
466 drops, <constant>0x11</constant> for 6 pl base drops, and
467 <constant>0x12</constant> for special large drops. On these
468 printers, <constant>0x10</constant> usually works best at
469 1440&times;720 and <constant>0x11</constant> works best at
470 720&times;720. Unfortunately, <constant>0x10</constant>
471 doesn't seem to generate quite enough density at
472 720&times;720, because if it did the output would be very
473 smooth. Perhaps it's possible to tweak things&hellip;
474 </para>
475 <para>
476 The list of densities is a list of base density values for all
477 of the above listed modes. &ldquo;Density&rdquo; refers to
478 the amount of ink deposited when a solid color (or solid
479 black) is printed. So if the density is
480 <constant>0.5</constant>, solid black actually prints only
481 half the possible dots. &ldquo;Base density&rdquo; refers to
482 the fact that the density value can be scaled in the GUI or via
483 CUPS options. The density value specified
484 (which is not made visible to the user) is multiplied by the
485 base density to obtain the effective density value. All other
486 things (such as ink drop size) remaining the same, doubling
487 the resolution requires halving the base density. The base
488 density in the density vector may exceed
489 <constant>1</constant>, as many paper types require lower
490 density than the base driver. The driver ensures that the
491 actual density never exceeds <constant>1</constant>.
492 </para>
493 <para>
494 Tuning the density should be done on high quality paper
495 (usually glossy photo paper). The goal is to find the lowest
496 density value that results in solid black (no visible gaps
497 under a fairly high power magnifying glass or loupe). If an
498 appropriate density value is found for 720 DPI, it could be
499 divided by 2 for 1440&times;720, by 4 for 2880&times;720, and
500 by 8 for 2880&times;1440.
501 </para>
502 <para>
503 However, for printers that offer a choice of dot size, this
504 may not be the best strategy. The best choice for dot size is
505 the smallest dot size that allows choosing a density value not
506 greater than <constant>1</constant> that gives full coverage.
507 This dot size may be different for different resolutions.
508 Tuning variable dot size printers is more complicated; the
509 process is described below.
510 </para>
511 <para>
512 The last member is a pointer to a structure containing a list
513 of ink values for variable dot size (or 6 color) inks. We
514 model variable dot size inks as producing a certain
515 &ldquo;value&rdquo; of ink for each available dot size, where
516 the largest dot size has a value of <constant>1</constant>.
517 6-color inks are handled similarly; the light cyan and light
518 magenta inks are treated as a fractional ink value. The
519 combination of variable dot size and 6 color inks, of course,
520 just creates that many more different ink choices.
521 </para>
522 <para>
523 This structure is actually rather complicated; it contains
524 entries for each combination of physical printer resolution
525 (180, 360, 720, and 1440 DPI), ink colors (4, 6, and 7), and
526 single and variable dot sizes (since some printer modes can't
527 handle variable dot size inks). Since there's so much data,
528 it's actually a somewhat deeply nested structure.
529 </para>
530 <itemizedlist>
531 <listitem>
532 <para>
533 An <type>escp2_printer_t</type> contains a pointer
534 (essentially, a reference rather than a copy) to an
535 <type>escp2_variable_inklist_t</type>.
536 </para>
537 </listitem>
538 <listitem>
539 <para>
540 An <type>escp2_variable_inklist_t</type> contains pointers
541 to <type>escp2_variable_inkset_t</type> structures. There
542 is one such pointer for each combination of resolution,
543 dot type, and ink colors as described above. Yes, this is
544 rather inflexible.
545 </para>
546 </listitem>
547 <listitem>
548 <para>
549 An <type>escp2_variable_inkset_t</type> contains pointers
550 to <type>escp2_variable_ink_t</type> structures. There is
551 one such pointer for each of the four colors (C, M, Y, and
552 K).
553 </para>
554 </listitem>
555 <listitem>
556 <para>
557 An <type>escp2_variable_ink_t</type> contains a pointer to
558 the actual list of ink values
559 (<type>simple_dither_range_t</type>), the number of ink
560 values, and a density value to be used for computing the
561 transitions. This density value is actually a scaling
562 value; it is multiplied by the effective density to
563 compute the density to be used for computing the
564 transitions. Normally, this value is
565 <constant>1</constant>, but in some cases it may be
566 possible to get smoother results with a different value
567 (in particular, the single dot size 6-color inks work best
568 with the effective density scaled to
569 <constant>.75</constant> for this purpose). A lower
570 density lowers the transition points, which results in
571 more ink being deposited.
572 </para>
573 </listitem>
574 <listitem>
575 <para>
576 A <type>simple_dither_range_t</type> is a structure containing four values:
577 <itemizedlist>
578 <listitem>
579 <para>
580 The value of the particular ink
581 </para>
582 </listitem>
583 <listitem>
584 <para>
585 The bit pattern used to represent the ink
586 </para>
587 </listitem>
588 <listitem>
589 <para>
590 Whether the ink is light (0) or dark (1), for inks
591 with light and dark variants
592 </para>
593 </listitem>
594 <listitem>
595 <para>
596 The relative amount of ink actually deposited by
597 this dot (not currently used for much; it can be
598 used for ink reduction purposes, to reduce the
599 amount of ink deposited on the paper).
600 </para>
601 </listitem>
602 </itemizedlist>
603 </para>
604 <para>
605 These things are interesting as arrays. From an array of
606 <type>simple_dither_range_t</type>'s, the dither code
607 computes transition values that it looks up at run time to
608 decide what ink to print, as well as whether to print at
609 all.
610 </para>
611 </listitem>
612 </itemizedlist>
613 <para>
614 <emphasis>Really</emphasis> confused now? Yup. You'll
615 probably find it easier to simply read the code.
616 </para>
617 </sect2>
618 <sect2>
619 <title>Tuning the printer</title>
620 <para>
621 Now, how do you use all this to tune a printer? There are a
622 number of ways to do it; this one is my personal favorite.
623 </para>
624 <para>
625 There's a file named <filename>test/cyan-sweep.tif</filename>.
626 This consists of a thin bar of cyan sweeping from white to
627 almost pure cyan, and from pure cyan to black. The first
628 thing to do is to pick the appropriate
629 <type>simple_dither_range_t</type> (or create a whole new
630 <type>escp2_variable_inklist_t</type>) and comment out all but
631 the darkest ink (this means you'll be using the largest dots
632 of dark ink). At 8.5" width (the width of a letter-size piece
633 of paper), the bar will be 1/8" high. Printing it on wider or
634 narrower paper will change the height accordingly. Print it
635 width-wise across a piece of photo quality paper in line art
636 mode using ordered or adaptive hybrid dither. Do not use
637 photographic mode; the colors in photographic mode vary
638 non-linearly depending upon the presence of the three color
639 components, while in line art mode the colors are much purer.
640 Make sure that all the color adjustments are set to defaults
641 (1.0). Use the highest quality version of the print mode
642 you're testing to reduce banding and other artifacts. This is
643 much easier to do with the Gimp than with CUPS.
644 </para>
645 <para>
646 At this stage, you want to look for four things:
647 <orderedlist>
648 <listitem>
649 <para>
650 The black near the center of the line is solid, but not
651 more so than that.
652 </para>
653 </listitem>
654 <listitem>
655 <para>
656 The cyan immediately to the left of the black is
657 <emphasis>almost</emphasis> solid.
658 </para>
659 </listitem>
660 <listitem>
661 <para>
662 The dark cyan at the far right of the page is solid, but
663 not more so. You can try tuning the density so that it
664 isn't quite solid, then nudging up the density until it
665 is.
666 </para>
667 </listitem>
668 <listitem>
669 <para>
670 Both sweeps sweep smoothly from light to dark. In
671 particular, the dark half of the bar shouldn't visibly
672 change color; it should go smoothly from cyan to black.
673 </para>
674 </listitem>
675 </orderedlist>
676 </para>
677 <para>
678 Repeat this stage until you have everything just right. Use
679 the positioning entry boxes in the dialog to position each bar
680 exactly 1/8" further down the page. Adjacent bars will be
681 touching.
682 </para>
683 <para>
684 The next step is to uncomment out the second darkest dot size.
685 If you're using variable dots, use the second largest dot size
686 of the dark ink rather than the largest dot size of the light
687 ink. This will give you two inks.
688 </para>
689 <para>
690 When you recompile the plugin, you simply need to copy the new
691 executable into the correct place. You do not need to exit
692 and restart the Gimp.
693 </para>
694 <para>
695 Print another bar adjacent to the first one. Your goal is to
696 match the bar using a single dot size as closely as possible.
697 You'll find that the dark region of the bar shouldn't change
698 to any great degree, but the light half probably will. If the
699 lighter part of the light half is too dark, you need to
700 increase the value of the smaller dot; if it's too light, you
701 need to decrease the value. The reasoning is that if the
702 value is too low, the ink isn't being given enough credit for
703 its contribution to the darkness of the ink, and vice versa.
704 Repeat until you have a good match. Make sure you let the ink
705 dry fully, which will take a few minutes. Wet ink will look
706 too dark. Don't look at the paper too closely; hold it at a
707 distance. The extra graininess of the largest dot size will
708 probably make it look lighter than it should; if you hold it
709 far enough away so that you can't see the dots, you'll get a
710 more accurate picture of what's going on.
711 </para>
712 <para>
713 After you have what looks like a good match, print another bar
714 using only the largest dot size (or dark ink, for single dot
715 size 6-color printers). You want to ensure that the bars
716 touching each other look identical, or as close as possible to
717 it; your eye won't give you a good reading if the bars are
718 separated from each other. You'll probably have to repeat the
719 procedure.
720 </para>
721 <para>
722 The next step is to comment out all but the largest and
723 third-largest dot size, and repeat the procedure. When they
724 match, use all three dot sizes of dark ink. Again, the goal
725 is to match the single dot size.
726 </para>
727 <para>
728 You'll probably find the match is imperfect. Now you have to
729 figure out what region isn't right, which takes some
730 experimentation. Even small adjustments can make a noticeable
731 difference in what you see. At this stage, it's very
732 important to hold the page far enough from your eye; when you
733 use all three dot sizes, the texture will be much more even,
734 which sometimes makes it look darker and sometimes lighter.
735 </para>
736 <para>
737 After this is calibrated, it's time to calibrate the light ink
738 against the dark ink. To do this, comment out all but the
739 large dot version of the two inks, and repeat the procedure.
740 This is trickier, because the hues of the inks might not be
741 quite identical. Look at the dark half of the bar as well as
742 the light half to see that the hue really doesn't change as
743 you sweep from cyan to black. Sometimes it's easier to judge
744 that way. You may find that it looks blotchy, in which case
745 you should switch from ordered dither to adaptive hybrid.
746 </para>
747 <para>
748 After you have the light and dark inks calibrated against each
749 other, it's time to add everything back in. Usually you don't
750 want to use the largest dot size of light ink. These dots
751 will be much larger than the small dots of dark ink, but
752 they'll still be lighter. This will cause problems when
753 printing mixed colors, since you'll be depositing more ink on
754 lighter regions of the page, and you'll probably get strange
755 color casts that you can't get rid of in neutral tones. I
756 normally use only the smallest one or two dot sizes of light
757 ink.
758 </para>
759 <para>
760 After you've tweaked everything, print the color bar with
761 saturation set to zero. This will print neutral tones using
762 color inks. Your goal here is to look for neutral tonality.
763 If you're using a 6-color printer and get a yellow cast, it
764 means that the values for your light inks are too high
765 (remember, that means they're getting too much credit, so
766 you're not depositing enough cyan and magenta ink, and the
767 yellow dominates). If you get a bluish or bluish-purple cast,
768 your light inks are too low (you're not giving them enough
769 credit, so too much cyan and magenta is deposited, which
770 overwhelms the yellow). Make sure you do this on very white,
771 very high grade inkjet paper that's designed for
772 1440&times;720 DPI or higher; otherwise the ink will spread on
773 contact and you'll get values that aren't really true for high
774 grade paper. You can, of course, calibrate for low grade
775 paper if that's what you're going to use, but that shouldn't
776 be put into the distribution.
777 </para>
778 <para>
779 You can also fully desaturate this bar inside the Gimp and
780 print it as monochrome (don't print the cyan as monochrome;
781 the driver does funny things with luminance), for comparison.
782 You'll find it very hard to get rid of all color casts.
783 </para>
784 <para>
785 There are other ways of tuning printers, but this one works
786 pretty well for me.
787 </para>
788 </sect2>
789 <sect2>
790 <title>Canon inkjet printers</title>
791 <para>
792 Basically, a new Canon printer can be added to
793 <filename>print-canon.c</filename> in a similar way as
794 described above for the epson inkjet printers. The main
795 differences are noted here.
796 </para>
797 <para>
798 In general, Canon printers have more &ldquo;built-in
799 intelligence&ldquo; than Epson printers which results in the
800 fact that the driver only has to tell the printing conditions
801 like resolutions, dot sizes, etc. to the printer and
802 afterwards transfer the raster data line by line for each
803 color used.
804 </para>
805 <para>
806 <type>canon_cap_t</type> is a C struct defined as follows:
807 </para>
808 <informalexample>
809 <programlisting>typedef struct canon_caps {
810 int model; /* model number as used in printers.xml */
811 int max_width; /* maximum printable paper size */
812 int max_height;
813 int base_res; /* base resolution - shall be 150 or 180 */
814 int max_xdpi; /* maximum horizontal resolution */
815 int max_ydpi; /* maximum vertical resolution */
816 int max_quality;
817 int border_left; /* left margin, points */
818 int border_right; /* right margin, points */
819 int border_top; /* absolute top margin, points */
820 int border_bottom; /* absolute bottom margin, points */
821 int inks; /* installable cartridges (CANON_INK_*) */
822 int slots; /* available paperslots */
823 int features; /* special bjl settings */
824 canon_dot_size_t dot_sizes; /* Vector of dot sizes for resolutions */
825 canon_densities_t densities; /* List of densities for each printer */
826 canon_variable_inklist_t *inxs; /* Choices of inks for this printer */
827 } canon_cap_t;</programlisting>
828 </informalexample>
829 <para>
830 Since there are Canon printers which print in resolutions of
831 2<superscript>n</superscript> &times; 150 DPI (e.g. 300, 600,
832 1200) and others which support resolutions of
833 2<superscript>n</superscript> &times; 180 DPI (e.g. 360, 720,
834 1440), there's a base resolution (150 or 180, respectively)
835 given in the <type>canon_cap_t</type>. The structs
836 <type>canon_dot_size_t</type>, <type>canon_densities_t</type>
837 and <type>canon_variable_inklist_t</type> refer to resolutions
838 being multiples of the base resolution.
839 </para>
840 <para>
841 For the Canon driver, the struct <type>canon_dot_size_t</type>
842 holds values for a model's capabilities at a given resolution,
843 or <constant>-1</constant> if the resolution is not supported.
844 <constant>0</constant> if it can be used and
845 <constant>1</constant> if the resolution can be used for
846 variable dot size printing.
847 </para>
848 <para>
849 In <type>canon_densities_t</type> the base densities for each
850 resolution can be specified like for an epson printer. The
851 same holds true for <type>canon_variable_inklist_t</type>.
852 See the descriptions above to learn about how to adjust your
853 model's output to yield nice results.
854 </para>
855 <para>
856 There's a slight difference though in the way the Canon driver
857 and the escp2 driver define their variable inklists: In the
858 Canon driver, you need to define an inklist like this:
859 </para>
860 <informalexample>
861 <programlisting>static const canon_variable_inklist_t canon_ink_myinks[] =
862 {
863 {
864 1,4, /* 1bit/pixel, 4 colors */
865 &amp;ci_CMYK_1, &amp;ci_CMYK_1, &amp;ci_CMYK_1,
866 &amp;ci_CMYK_1, &amp;ci_CMYK_1, &amp;ci_CMYK_1,
867 },
868 {
869 3,4, /* 3bit/pixel, 4 colors */
870 &amp;ci_CMYK_3, &amp;ci_CMYK_3, &amp;ci_CMYK_3,
871 &amp;ci_CMYK_3, &amp;ci_CMYK_3, &amp;ci_CMYK_3,
872 },
873 };</programlisting>
874 </informalexample>
875 <para>
876 where the <literal>&amp;ci_CMYK_1</literal> and
877 <literal>&amp;ci_CMYK_3</literal> entries are references to a
878 previously defined const of type
879 <type>canon_variable_inkset_t</type>.
880 </para>
881 </sect2>
882 </sect1>
883 </chapter>