better condition for *bsd* for ffi (trunk & tags)
[luatex.git] / manual / luatex-graphics.tex
blob916d962b2ac4fe85dc1e0ba1b049074a030c5e1b
1 % language=uk
3 \environment luatex-style
4 \environment luatex-logos
6 \startcomponent luatex-graphics
8 \startchapter[reference=graphics,title={The graphic libraries}]
10 \section{The \type {img} library}
12 The \type {img} library can be used as an alternative to \type {\pdfximage} and
13 \type {\pdfrefximage}, and the associated \quote {satellite} commands like \type
14 {\pdfximagebbox}. Image objects can also be used within virtual fonts via the
15 \type {image} command listed in~\in {section} [virtualfonts].
17 \subsection{\type {new}}
19 \startfunctioncall
20 <image> var = img.new()
21 <image> var = img.new(<table> image_spec)
22 \stopfunctioncall
24 This function creates a userdata object of type \quote {image}. The \type
25 {image_spec} argument is optional. If it is given, it must be a table, and that
26 table must contain a \type {filename} key. A number of other keys can also be
27 useful, these are explained below.
29 You can either say
31 \starttyping
32 a = img.new()
33 \stoptyping
35 followed by
37 \starttyping
38 a.filename = "foo.png"
39 \stoptyping
41 or you can put the file name (and some or all of the other keys) into a table
42 directly, like so:
44 \starttyping
45 a = img.new({filename='foo.pdf', page=1})
46 \stoptyping
48 The generated \type {<image>} userdata object allows access to a set of
49 user|-|specified values as well as a set of values that are normally filled in
50 and updated automatically by \LUATEX\ itself. Some of those are derived from the
51 actual image file, others are updated to reflect the \PDF\ output status of the
52 object.
54 There is one required user-specified field: the file name (\type {filename}). It
55 can optionally be augmented by the requested image dimensions (\type {width},
56 \type {depth}, \type {height}), user|-|specified image attributes (\type {attr}),
57 the requested \PDF\ page identifier (\type {page}), the requested boundingbox
58 (\type {pagebox}) for \PDF\ inclusion, the requested color space object (\type
59 {colorspace}).
61 The function \type {img.new} does not access the actual image file, it just
62 creates the \type {<image>} userdata object and initializes some memory
63 structures. The \type {<image>} object and its internal structures are
64 automatically garbage collected.
66 Once the image is scanned, all the values in the \type {<image>} except \type
67 {width}, \type {height} and \type {depth}, become frozen, and you cannot change
68 them any more.
70 You can use \type {pdf.setignoreunknownimages(1)} (or at the \TEX\ end the \type
71 {\pdfvariable} \type {ignoreunknownimages}) to get around a quit when no known
72 image type is found (based on name or preamble). Beware: this will not catch
73 invalid images and we cannot guarantee side effects. A zero dimension image is
74 still included when requested. No special flags are set. A proper workflow will
75 not rely in such a catch but make sure that images are valid.
77 \subsection{\type {keys}}
79 \startfunctioncall
80 <table> keys = img.keys()
81 \stopfunctioncall
83 This function returns a list of all the possible \type {image_spec} keys, both
84 user-supplied and automatic ones.
86 % hahe: i need to add r/w ro column...
87 \starttabulate[|Tl|l|p|]
88 \NC \bf field name \NC \bf type \NC description \NC \NR
89 \NC attr \NC string \NC the image attributes for \LUATEX \NC \NR
90 \NC bbox \NC table \NC table with 4 boundingbox dimensions \type
91 {llx}, \type {lly}, \type {urx} and \type
92 {ury} overruling the \type {pagebox} entry \NC \NR
93 \NC colordepth \NC number \NC the number of bits used by the color space \NC \NR
94 \NC colorspace \NC number \NC the color space object number \NC \NR
95 \NC depth \NC number \NC the image depth for \LUATEX \NC \NR
96 \NC filename \NC string \NC the image file name \NC \NR
97 \NC filepath \NC string \NC the full (expanded) file name of the image\NC \NR
98 \NC height \NC number \NC the image height for \LUATEX \NC \NR
99 \NC imagetype \NC string \NC one of \type {pdf}, \type {png}, \type {jpg},
100 \type {jp2} or \type {jbig2} \NC \NR
101 \NC index \NC number \NC the \PDF\ image name suffix \NC \NR
102 \NC objnum \NC number \NC the \PDF\ image object number \NC \NR
103 \NC page \NC number \NC the identifier for the requested image page \NC \NR
104 \NC pagebox \NC string \NC the requested bounding box, one of
105 \type {none}, \type {media}, \type {crop},
106 \type {bleed}, \type {trim}, \type {art} \NC \NR
107 \NC pages \NC number \NC the total number of available pages \NC \NR
108 \NC rotation \NC number \NC the image rotation from included \PDF\ file,
109 in multiples of 90~deg. \NC \NR
110 \NC stream \NC string \NC the raw stream data for an \type {/Xobject}
111 \type {/Form} object\NC \NR
112 \NC transform \NC number \NC the image transform, integer number 0..7 \NC \NR
113 \NC orientation \NC number \NC the (jpeg) image orientation, integer number 1..8 (0 for unset) \NC \NR
114 \NC width \NC number \NC the image width for \LUATEX \NC \NR
115 \NC xres \NC number \NC the horizontal natural image resolution
116 (in \DPI) \NC \NR
117 \NC xsize \NC number \NC the natural image width \NC \NR
118 \NC yres \NC number \NC the vertical natural image resolution
119 (in \DPI) \NC \NR
120 \NC ysize \NC number \NC the natural image height \NC \NR
121 \NC visiblefileame \NC string \NC when set, this name will find its way in the
122 \PDF\ file as \type {PTEX} specification; when
123 an empty string is assigned nothing is written
124 to file; otherwise the natural filename is
125 taken \NC \NR
126 \stoptabulate
128 A running (undefined) dimension in \type {width}, \type {height}, or \type
129 {depth} is represented as \type {nil} in \LUA, so if you want to load an image at
130 its \quote {natural} size, you do not have to specify any of those three fields.
132 The \type {stream} parameter allows to fabricate an \type {/XObject} \type
133 {/Form} object from a string giving the stream contents, e.g., for a filled
134 rectangle:
136 \startfunctioncall
137 a.stream = "0 0 20 10 re f"
138 \stopfunctioncall
140 When writing the image, an \type {/Xobject} \type {/Form} object is created, like
141 with embedded \PDF\ file writing. The object is written out only once. The \type
142 {stream} key requires that also the \type {bbox} table is given. The \type
143 {stream} key conflicts with the \type {filename} key. The \type {transform} key
144 works as usual also with \type {stream}.
146 The \type {bbox} key needs a table with four boundingbox values, e.g.:
148 \startfunctioncall
149 a.bbox = { "30bp", 0, "225bp", "200bp" }
150 \stopfunctioncall
152 This replaces and overrules any given \type {pagebox} value; with given \type
153 {bbox} the box dimensions coming with an embedded \PDF\ file are ignored. The
154 \type {xsize} and \type {ysize} dimensions are set accordingly, when the image is
155 scaled. The \type {bbox} parameter is ignored for non-\PDF\ images.
157 The \type {transform} allows to mirror and rotate the image in steps of 90~deg.
158 The default value~$0$ gives an unmirrored, unrotated image. Values $1-3$ give
159 counterclockwise rotation by $90$, $180$, or $270$~degrees, whereas with values
160 $4-7$ the image is first mirrored and then rotated counterclockwise by $90$,
161 $180$, or $270$~degrees. The \type {transform} operation gives the same visual
162 result as if you would externally preprocess the image by a graphics tool and
163 then use it by \LUATEX. If a \PDF\ file to be embedded already contains a \type
164 {/Rotate} specification, the rotation result is the combination of the \type
165 {/Rotate} rotation followed by the \type {transform} operation.
167 \subsection{\type {scan}}
169 \startfunctioncall
170 <image> var = img.scan(<image> var)
171 <image> var = img.scan(<table> image_spec)
172 \stopfunctioncall
174 When you say \type {img.scan(a)} for a new image, the file is scanned, and
175 variables such as \type {xsize}, \type {ysize}, image \type {type}, number of
176 \type {pages}, and the resolution are extracted. Each of the \type {width}, \type
177 {height}, \type {depth} fields are set up according to the image dimensions, if
178 they were not given an explicit value already. An image file will never be
179 scanned more than once for a given image variable. With all subsequent \type
180 {img.scan(a)} calls only the dimensions are again set up (if they have been
181 changed by the user in the meantime).
183 For ease of use, you can do right-away a
185 \starttyping
186 <image> a = img.scan { filename = "foo.png" }
187 \stoptyping
189 without a prior \type {img.new}.
191 Nothing is written yet at this point, so you can do \type {a=img.scan}, retrieve
192 the available info like image width and height, and then throw away \type {a}
193 again by saying \type {a=nil}. In that case no image object will be reserved in
194 the PDF, and the used memory will be cleaned up automatically.
196 \subsection{\type {copy}}
198 \startfunctioncall
199 <image> var = img.copy(<image> var)
200 <image> var = img.copy(<table> image_spec)
201 \stopfunctioncall
203 If you say \type {a = b}, then both variables point to the same \type {<image>}
204 object. if you want to write out an image with different sizes, you can do a
205 \type {b = img.copy(a)}.
207 Afterwards, \type {a} and \type {b} still reference the same actual image
208 dictionary, but the dimensions for \type {b} can now be changed from their
209 initial values that were just copies from \type {a}.
211 \subsection{\type {write}}
213 \startfunctioncall
214 <image> var = img.write(<image> var)
215 <image> var = img.write(<table> image_spec)
216 \stopfunctioncall
218 By \type {img.write(a)} a \PDF\ object number is allocated, and a whatsit node of
219 subtype \type {pdf_refximage} is generated and put into the output list. By this
220 the image \type {a} is placed into the page stream, and the image file is written
221 out into an image stream object after the shipping of the current page is
222 finished.
224 Again you can do a terse call like
226 \starttyping
227 img.write { filename = "foo.png" }
228 \stoptyping
230 The \type {<image>} variable is returned in case you want it for later
231 processing.
233 \subsection{\type {immediatewrite}}
235 \startfunctioncall
236 <image> var = img.immediatewrite(<image> var)
237 <image> var = img.immediatewrite(<table> image_spec)
238 \stopfunctioncall
240 By \type {img.immediatewrite(a)} a \PDF\ object number is allocated, and the
241 image file for image \type {a} is written out immediately into the \PDF\ file as
242 an image stream object (like with \type {\immediate}\type {\pdfximage}). The object
243 number of the image stream dictionary is then available by the \type {objnum}
244 key. No \type {pdf_refximage} whatsit node is generated. You will need an
245 \type {img.write(a)} or \type {img.node(a)} call to let the image appear on the
246 page, or reference it by another trick; else you will have a dangling image
247 object in the \PDF\ file.
249 Also here you can do a terse call like
251 \starttyping
252 a = img.immediatewrite { filename = "foo.png" }
253 \stoptyping
255 The \type {<image>} variable is returned and you will most likely need it.
257 \subsection{\type {node}}
259 \startfunctioncall
260 <node> n = img.node(<image> var)
261 <node> n = img.node(<table> image_spec)
262 \stopfunctioncall
264 This function allocates a \PDF\ object number and returns a whatsit node of
265 subtype \type {pdf_refximage}, filled with the image parameters \type {width},
266 \type {height}, \type {depth}, and \type {objnum}. Also here you can do a terse
267 call like:
269 \starttyping
270 n = img.node ({ filename = "foo.png" })
271 \stoptyping
273 This example outputs an image:
275 \starttyping
276 node.write(img.node{filename="foo.png"})
277 \stoptyping
279 \subsection{\type {types}}
281 \startfunctioncall
282 <table> types = img.types()
283 \stopfunctioncall
285 This function returns a list with the supported image file type names, currently
286 these are \type {pdf}, \type {png}, \type {jpg}, \type {jp2} (JPEG~2000), and
287 \type {jbig2}.
289 \subsection{\type {boxes}}
291 \startfunctioncall
292 <table> boxes = img.boxes()
293 \stopfunctioncall
295 This function returns a list with the supported \PDF\ page box names, currently
296 these are \type {media}, \type {crop}, \type {bleed}, \type {trim}, and \type
297 {art}, all in lowercase letters.
299 \section{The \type {mplib} library}
301 The \MP\ library interface registers itself in the table \type {mplib}. It is
302 based on \MPLIB\ version \ctxlua {context(mplib.version())}.
304 \subsection{\type {new}}
306 To create a new \METAPOST\ instance, call
308 \startfunctioncall
309 <mpinstance> mp = mplib.new({...})
310 \stopfunctioncall
312 This creates the \type {mp} instance object. The argument hash can have a number
313 of different fields, as follows:
315 \starttabulate[|lT|l|p|p|]
316 \NC \rmbf name \NC \bf type \NC \bf description \NC \bf default \NC \NR
317 \NC error_line \NC number \NC error line width \NC 79 \NC \NR
318 \NC print_line \NC number \NC line length in ps output \NC 100 \NC \NR
319 \NC random_seed \NC number \NC the initial random seed \NC variable \NC \NR
320 \NC math_mode \NC string \NC the number system to use:
321 \type {double},
322 \type {scaled},
323 \type {binary} or
324 \type {decimal} \NC \type {scaled} \NC \NR
325 \NC interaction \NC string \NC the interaction mode:
326 \type {batch},
327 \type {nonstop},
328 \type {scroll} or
329 \type {errorstop} \NC \type {errorstop} \NC \NR
330 \NC job_name \NC string \NC \type {--jobname} \NC \type {mpout} \NC \NR
331 \NC find_file \NC function \NC a function to find files \NC only local files \NC \NR
332 \stoptabulate
334 The \type {find_file} function should be of this form:
336 \starttyping
337 <string> found = finder (<string> name, <string> mode, <string> type)
338 \stoptyping
340 with:
342 \starttabulate[|lT|l|p|]
343 \NC \bf name \NC \bf the requested file \NC \NR
344 \NC mode \NC the file mode: \type {r} or \type {w} \NC \NR
345 \NC type \NC the kind of file, one of: \type {mp}, \type {tfm}, \type {map},
346 \type {pfb}, \type {enc} \NC \NR
347 \stoptabulate
349 Return either the full path name of the found file, or \type {nil} if the file
350 cannot be found.
352 Note that the new version of \MPLIB\ no longer uses binary mem files, so the way
353 to preload a set of macros is simply to start off with an \type {input} command
354 in the first \type {mp:execute()} call.
356 \subsection{\type {mp:statistics}}
358 You can request statistics with:
360 \startfunctioncall
361 <table> stats = mp:statistics()
362 \stopfunctioncall
364 This function returns the vital statistics for an \MPLIB\ instance. There are
365 four fields, giving the maximum number of used items in each of four allocated
366 object classes:
368 \starttabulate[|lT|l|p|]
369 \NC main_memory \NC number \NC memory size \NC \NR
370 \NC hash_size \NC number \NC hash size\NC \NR
371 \NC param_size \NC number \NC simultaneous macro parameters\NC \NR
372 \NC max_in_open \NC number \NC input file nesting levels\NC \NR
373 \stoptabulate
375 Note that in the new version of \MPLIB, this is informational only. The objects
376 are all allocated dynamically, so there is no chance of running out of space
377 unless the available system memory is exhausted.
379 \subsection{\type {mp:execute}}
381 You can ask the \METAPOST\ interpreter to run a chunk of code by calling
383 \startfunctioncall
384 <table> rettable = mp:execute('metapost language chunk')
385 \stopfunctioncall
387 for various bits of \METAPOST\ language input. Be sure to check the \type
388 {rettable.status} (see below) because when a fatal \METAPOST\ error occurs the
389 \MPLIB\ instance will become unusable thereafter.
391 Generally speaking, it is best to keep your chunks small, but beware that all
392 chunks have to obey proper syntax, like each of them is a small file. For
393 instance, you cannot split a single statement over multiple chunks.
395 In contrast with the normal stand alone \type {mpost} command, there is {\em no}
396 implied \quote{input} at the start of the first chunk.
398 \subsection{\type {mp:finish}}
400 \startfunctioncall
401 <table> rettable = mp:finish()
402 \stopfunctioncall
404 If for some reason you want to stop using an \MPLIB\ instance while processing is
405 not yet actually done, you can call \type {mp:finish}. Eventually, used memory
406 will be freed and open files will be closed by the \LUA\ garbage collector, but
407 an explicit \type {mp:finish} is the only way to capture the final part of the
408 output streams.
410 \subsection{Result table}
412 The return value of \type {mp:execute} and \type {mp:finish} is a table with a
413 few possible keys (only \type {status} is always guaranteed to be present).
415 \starttabulate[|Tl|l|p|]
416 \NC log \NC string \NC output to the \quote {log} stream \NC \NR
417 \NC term \NC string \NC output to the \quote {term} stream \NC \NR
418 \NC error \NC string \NC output to the \quote {error} stream
419 (only used for \quote {out of memory}) \NC \NR
420 \NC status \NC number \NC the return value:
421 \type {0} = good,
422 \type {1} = warning,
423 \type {2} = errors,
424 \type {3} = fatal error \NC \NR
425 \NC fig \NC table \NC an array of generated figures (if any) \NC \NR
426 \stoptabulate
428 When \type {status} equals~3, you should stop using this \MPLIB\ instance
429 immediately, it is no longer capable of processing input.
431 If it is present, each of the entries in the \type {fig} array is a userdata
432 representing a figure object, and each of those has a number of object methods
433 you can call:
435 \starttabulate[|Tl|l|p|]
436 \NC boundingbox \NC function \NC returns the bounding box, as an array of 4
437 values\NC \NR
438 \NC postscript \NC function \NC returns a string that is the ps output of the
439 \type {fig}. this function accepts two optional
440 integer arguments for specifying the values of
441 \type {prologues} (first argument) and \type
442 {procset} (second argument)\NC \NR
443 \NC svg \NC function \NC returns a string that is the svg output of the
444 \type {fig}. This function accepts an optional
445 integer argument for specifying the value of
446 \type {prologues}\NC \NR
447 \NC objects \NC function \NC returns the actual array of graphic objects in
448 this \type {fig} \NC \NR
449 \NC copy_objects \NC function \NC returns a deep copy of the array of graphic
450 objects in this \type {fig} \NC \NR
451 \NC filename \NC function \NC the filename this \type {fig}'s \POSTSCRIPT\
452 output would have written to in stand alone
453 mode \NC \NR
454 \NC width \NC function \NC the \type {fontcharwd} value \NC \NR
455 \NC height \NC function \NC the \type {fontcharht} value \NC \NR
456 \NC depth \NC function \NC the \type {fontchardp} value \NC \NR
457 \NC italcorr \NC function \NC the \type {fontcharit} value \NC \NR
458 \NC charcode \NC function \NC the (rounded) \type {charcode} value \NC \NR
459 \stoptabulate
461 Note: you can call \type {fig:objects()} only once for any one \type {fig}
462 object!
464 When the boundingbox represents a \quote {negated rectangle}, i.e.\ when the
465 first set of coordinates is larger than the second set, the picture is empty.
467 Graphical objects come in various types that each has a different list of
468 accessible values. The types are: \type {fill}, \type {outline}, \type {text},
469 \type {start_clip}, \type {stop_clip}, \type {start_bounds}, \type {stop_bounds},
470 \type {special}.
472 There is helper function (\type {mplib.fields(obj)}) to get the list of
473 accessible values for a particular object, but you can just as easily use the
474 tables given below.
476 All graphical objects have a field \type {type} that gives the object type as a
477 string value; it is not explicit mentioned in the following tables. In the
478 following, \type {number}s are \POSTSCRIPT\ points represented as a floating
479 point number, unless stated otherwise. Field values that are of type \type
480 {table} are explained in the next section.
482 \subsubsection{fill}
484 \starttabulate[|Tl|l|p|]
485 \NC path \NC table \NC the list of knots \NC \NR
486 \NC htap \NC table \NC the list of knots for the reversed trajectory \NC \NR
487 \NC pen \NC table \NC knots of the pen \NC \NR
488 \NC color \NC table \NC the object's color \NC \NR
489 \NC linejoin \NC number \NC line join style (bare number)\NC \NR
490 \NC miterlimit \NC number \NC miterlimit\NC \NR
491 \NC prescript \NC string \NC the prescript text \NC \NR
492 \NC postscript \NC string \NC the postscript text \NC \NR
493 \stoptabulate
495 The entries \type {htap} and \type {pen} are optional.
497 There is helper function (\type {mplib.pen_info(obj)}) that returns a table
498 containing a bunch of vital characteristics of the used pen (all values are
499 floats):
501 \starttabulate[|Tl|l|p|]
502 \NC width \NC number \NC width of the pen \NC \NR
503 \NC sx \NC number \NC $x$ scale \NC \NR
504 \NC rx \NC number \NC $xy$ multiplier \NC \NR
505 \NC ry \NC number \NC $yx$ multiplier \NC \NR
506 \NC sy \NC number \NC $y$ scale \NC \NR
507 \NC tx \NC number \NC $x$ offset \NC \NR
508 \NC ty \NC number \NC $y$ offset \NC \NR
509 \stoptabulate
511 \subsubsection{outline}
513 \starttabulate[|Tl|l|p|]
514 \NC path \NC table \NC the list of knots \NC \NR
515 \NC pen \NC table \NC knots of the pen \NC \NR
516 \NC color \NC table \NC the object's color \NC \NR
517 \NC linejoin \NC number \NC line join style (bare number) \NC \NR
518 \NC miterlimit \NC number \NC miterlimit \NC \NR
519 \NC linecap \NC number \NC line cap style (bare number) \NC \NR
520 \NC dash \NC table \NC representation of a dash list \NC \NR
521 \NC prescript \NC string \NC the prescript text \NC \NR
522 \NC postscript \NC string \NC the postscript text \NC \NR
523 \stoptabulate
525 The entry \type {dash} is optional.
527 \subsubsection{text}
529 \starttabulate[|Tl|l|p|]
530 \NC text \NC string \NC the text \NC \NR
531 \NC font \NC string \NC font tfm name \NC \NR
532 \NC dsize \NC number \NC font size \NC \NR
533 \NC color \NC table \NC the object's color \NC \NR
534 \NC width \NC number \NC \NC \NR
535 \NC height \NC number \NC \NC \NR
536 \NC depth \NC number \NC \NC \NR
537 \NC transform \NC table \NC a text transformation \NC \NR
538 \NC prescript \NC string \NC the prescript text \NC \NR
539 \NC postscript \NC string \NC the postscript text \NC \NR
540 \stoptabulate
542 \subsubsection{special}
544 \starttabulate[|Tl|l|p|]
545 \NC prescript \NC string \NC special text \NC \NR
546 \stoptabulate
548 \subsubsection{start_bounds, start_clip}
550 \starttabulate[|Tl|l|p|]
551 \NC path \NC table \NC the list of knots \NC \NR
552 \stoptabulate
554 \subsubsection{stop_bounds, stop_clip}
556 Here are no fields available.
558 \subsection{Subsidiary table formats}
560 \subsubsection{Paths and pens}
562 Paths and pens (that are really just a special type of paths as far as \MPLIB\ is
563 concerned) are represented by an array where each entry is a table that
564 represents a knot.
566 \starttabulate[|lT|l|p|]
567 \NC left_type \NC string \NC when present: endpoint, but usually absent \NC \NR
568 \NC right_type \NC string \NC like \type {left_type} \NC \NR
569 \NC x_coord \NC number \NC X coordinate of this knot \NC \NR
570 \NC y_coord \NC number \NC Y coordinate of this knot \NC \NR
571 \NC left_x \NC number \NC X coordinate of the precontrol point of this knot \NC \NR
572 \NC left_y \NC number \NC Y coordinate of the precontrol point of this knot \NC \NR
573 \NC right_x \NC number \NC X coordinate of the postcontrol point of this knot \NC \NR
574 \NC right_y \NC number \NC Y coordinate of the postcontrol point of this knot \NC \NR
575 \stoptabulate
577 There is one special case: pens that are (possibly transformed) ellipses have an
578 extra string-valued key \type {type} with value \type {elliptical} besides the
579 array part containing the knot list.
581 \subsubsection{Colors}
583 A color is an integer array with 0, 1, 3 or 4 values:
585 \starttabulate[|Tl|l|p|]
586 \NC 0 \NC marking only \NC no values \NC \NR
587 \NC 1 \NC greyscale \NC one value in the range $(0,1)$, \quote {black} is $0$ \NC \NR
588 \NC 3 \NC \RGB \NC three values in the range $(0,1)$, \quote {black} is $0,0,0$ \NC \NR
589 \NC 4 \NC \CMYK \NC four values in the range $(0,1)$, \quote {black} is $0,0,0,1$ \NC \NR
590 \stoptabulate
592 If the color model of the internal object was \type {uninitialized}, then it was
593 initialized to the values representing \quote {black} in the colorspace \type
594 {defaultcolormodel} that was in effect at the time of the \type {shipout}.
596 \subsubsection{Transforms}
598 Each transform is a six|-|item array.
600 \starttabulate[|Tl|l|p|]
601 \NC 1 \NC number \NC represents x \NC \NR
602 \NC 2 \NC number \NC represents y \NC \NR
603 \NC 3 \NC number \NC represents xx \NC \NR
604 \NC 4 \NC number \NC represents yx \NC \NR
605 \NC 5 \NC number \NC represents xy \NC \NR
606 \NC 6 \NC number \NC represents yy \NC \NR
607 \stoptabulate
609 Note that the translation (index 1 and 2) comes first. This differs from the
610 ordering in \POSTSCRIPT, where the translation comes last.
612 \subsubsection{Dashes}
614 Each \type {dash} is two-item hash, using the same model as \POSTSCRIPT\ for the
615 representation of the dashlist. \type {dashes} is an array of \quote {on} and
616 \quote {off}, values, and \type {offset} is the phase of the pattern.
618 \starttabulate[|Tl|l|p|]
619 \NC dashes \NC hash \NC an array of on-off numbers \NC \NR
620 \NC offset \NC number \NC the starting offset value \NC \NR
621 \stoptabulate
623 \subsection{Character size information}
625 These functions find the size of a glyph in a defined font. The \type {fontname}
626 is the same name as the argument to \type {infont}; the \type {char} is a glyph
627 id in the range 0 to 255; the returned \type {w} is in AFM units.
629 \subsubsection{\type {mp:char_width}}
631 \startfunctioncall
632 <number> w = mp:char_width(<string> fontname, <number> char)
633 \stopfunctioncall
635 \subsubsection{\type {mp:char_height}}
637 \startfunctioncall
638 <number> w = mp:char_height(<string> fontname, <number> char)
639 \stopfunctioncall
641 \subsubsection{\type {mp:char_depth}}
643 \startfunctioncall
644 <number> w = mp:char_depth(<string> fontname, <number> char)
645 \stopfunctioncall
647 \stopchapter