File Coverage

blib/lib/PDF/Builder/Docs.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 3 66.6
pod n/a
total 8 9 88.8


line stmt bran cond sub pod time code
1             package PDF::Builder::Docs;
2              
3 1     1   2412 use strict;
  1         2  
  1         46  
4 1     1   6 use warnings;
  1         2  
  1         348  
5              
6             our $VERSION = '3.025'; # VERSION
7             our $LAST_UPDATE = '3.025'; # manually update whenever code is changed
8              
9             # originally part of Builder.pm, it was split out due to its length
10              
11             =head1 NAME
12              
13             PDF::Builder::Docs - additional documentation for Builder module
14              
15             =head1 SOME SPECIAL NOTES
16              
17             =head2 Software Development Kit
18              
19             There are four levels of involvement with PDF::Builder. Depending on what you
20             want to do, different kinds of installs are recommended.
21              
22             B<1.> Simply installing PDF::Builder as a prerequisite for running some other
23             package. All you need to do is install the CPAN package for PDF::Builder, and
24             it will load the .pm files into your Perl library. If the other package prereqs
25             PDF::Builder, its installer may download and install PDF::Builder automatically.
26              
27             B<2.> You want to write a Perl program that uses PDF::Builder functions. In
28             addition to installing PDF::Builder from CPAN, you will want documentation on
29             it. Obtain a copy of the product from GitHub
30             (https://github.com/PhilterPaper/Perl-PDF-Builder) or as a gzipped tar file from CPAN.
31             This includes a utility to
32             build (from POD) a library of HTML documents, as well as examples (examples/
33             directory) and contributed sample programs (contrib/ directory).
34              
35             B<3.> You want to modify PDF::Builder files. In addition to the CPAN and GitHub
36             distributions, you I choose to keep a local Git repository for tracking
37             your changes. Depending on whether or not your PDF::Builder copy is being used
38             for production purposes, you may want to do your editing and testing in the Perl
39             library installation (I) or in a different place. The "t" tests (t/
40             directory) and examples provide good regression tests to ensure that you haven't
41             broken anything. If you do your editing on the live code, don't forget when done
42             to copy the changes back into the master version you keep!
43              
44             B<4.> You want to contribute to the development of PDF::Builder. You will need a
45             local Git repository (and a GitHub account), so that when you've got it all
46             done, you can issue a "Pull Request" to bring it to our attention. We can't
47             guarantee that your work will be incorporated into the project, but at least we
48             will look at it. From time to time, a new CPAN version will be issued.
49              
50             If you want to make substantial changes for public use, and can't come to a
51             meeting of minds with us, you can even start your own GitHub project and
52             register a new CPAN project (that's what we did, I PDF::API2). Please
53             don't just assume that we don't want your changes -- at least propose what you
54             want to do in writing, so we can consider it. We're always looking for people to
55             help out and expand PDF::Builder.
56              
57             =head2 Optional Libraries
58              
59             PDF::Builder can make use of some optional libraries, which are not I
60             for a successful installation. If you want improved speed and capabilities for
61             certain functions, you may want to install and use these libraries:
62              
63             B<*> Graphics::TIFF -- PDF::Builder inherited a rather slow, buggy, and limited
64             TIFF image library from PDF::API2. If Graphics::TIFF (available on CPAN, uses
65             libtiff.a) is installed, PDF::Builder will use that instead, unless you specify
66             that it is to use the old, pure Perl library. The only time you might want to
67             consider this is when you need to pass an open filehandle to C
68             instead of a file name. See resolved bug reports RT 84665 and RT 118047, as well
69             as C, for more information.
70              
71             B<*> Image::PNG::Libpng -- PDF::Builder inherited a rather slow and buggy pure
72             Perl PNG image library from PDF::API2. If Image::PNG::Libpng (available on
73             CPAN, uses libpng.a) is installed, PDF::Builder will use that instead, unless
74             you specify that it is to use the old, pure Perl library. Using the new library
75             will give you improved speed, the ability to use 16 bit samples, and the
76             ability to read interlaced PNG files. See resolved bug report RT 124349, as well
77             as C, for more information.
78              
79             B<*> HarfBuzz::Shaper -- This library enables PDF::Builder to handle complex
80             scripts (Arabic, Devanagari, etc.) as well as non-LTR writing systems. It is
81             also useful for Latin and other simple scripts, for ligatures and improved
82             kerning. HarfBuzz::Shaper is based on a set of HarfBuzz libraries, which it
83             will attempt to build if they are not found. See C for more
84             information.
85              
86             B<*> Text::Markdown -- This library is used if you want to format "Markdown"
87             style code in PDF::Builder, via the C method. It translates a certain
88             dialect of Markdown into HTML, which is then further processed.
89              
90             B<*> HTML::TreeBuilder -- This library is used to format HTML input into a
91             data structure which PDF::Builder can interpret, via the C method.
92             Note that if Markdown input is used, it will also need HTML::TreeBuilder to
93             handle the HTML the Markdown is translated to.
94              
95             Note that the installation process will B attempt to install these
96             libraries automatically. If you don't wish to use one or more of them, you are
97             free to not install the optional librarie(s). If you may want to make use of
98             one or more, consider installing them I installing PDF::Builder, so
99             that any t-tests and/or examples that make use of these libraries may be run
100             during installation and checkout of PDF::Builder. Remember, you can I
101             install an optional library later, if you want to make use of it.
102              
103             =head2 Strings (Character Text)
104              
105             Perl, and hence PDF::Builder, use strings that support the full range of
106             Unicode characters. When importing strings into a Perl program, for example
107             by reading text from a file, you must be aware of what their character encoding
108             is. Single-byte encodings (default is 'latin1'), represented as bytes of value
109             0x00 through 0xFF (0..255), will produce different results if you do something
110             that depends on the encoding, such as sorting, searching, or comparing any
111             two non-ASCII characters. This also applies to any characters (text) hard
112             coded into the Perl program.
113              
114             You can always decode the text from external encoding (ASCII, UTF-8, Latin-3,
115             etc.) into the Perl (internal) UTF-8 multibyte encoding. This uses one to four
116             bytes to represent each character. See pragma C and module C for
117             details about decoding text. Note that only TrueType fonts (C) can
118             make direct use of UTF-8-encoded text. Other font types (core, T1, etc.) can
119             only use single-byte encoded text. If your text is ASCII, Latin-1, or CP-1252,
120             you I just leave the Perl strings as the default single-byte encoding.
121              
122             Then, there is the matter of encoding the I to match up with available
123             font character sets. You're not actually I the text on output, but
124             are telling the output system (and Reader) what encoding the output byte stream
125             represents, and what character glyphs they should generate.
126              
127             If you confine your text to plain ASCII (0x00 .. 0x7F byte values) or even
128             Latin-1 or CP-1252 (0x00 .. 0xFF byte values), you can
129             use default (non-UTF-8) Perl strings and use the default output encoding
130             (WinAnsiEncoding), which is more-or-less Windows CP-1252 (a superset
131             in turn, of ISO-8859-1 Latin-1). If your text uses any other characters, you
132             will need to be aware of what encoding your text strings are (in the Perl string
133             and for declaring output glyph generation).
134             See L, L and L in L
135             for additional information.
136              
137             =head3 Some Internal Details
138              
139             Some of the following may be a bit scary or confusing to beginners, so don't
140             be afraid to skip over it until you're ready for it...
141              
142             Perl (and PDF::Builder) internally use strings which are either single-byte
143             (ISO-8859-1/Latin-1) or multibyte UTF-8 encoded (there is an internal flag
144             marking the string as UTF-8 or not).
145             If you work I in ASCII or Latin-1 or CP-1252 (each a superset of the
146             previous), you should be OK in not doing anything special about your string
147             encoding. You can just use the default Perl single byte strings (internally
148             marked as I UTF-8) and the default output encoding (WinAnsiEncoding).
149              
150             If you intend to use input from a variety of sources, you should consider
151             decoding (converting) your text to UTF-8, which will provide an internally
152             consistent representation (and your Perl code itself should be saved in UTF-8,
153             in case you want to use any hard coded non-ASCII characters). In any string,
154             non-ASCII characters (0x80 or higher) would be converted to the Perl UTF-8
155             internal representation, via C<$string = Encode::decode(MY_ENCODING, $input);>.
156             C would be a string like 'latin1', 'cp-1252', 'utf8', etc. Similar
157             capabilities are available for declaring a I to be in a certain encoding.
158              
159             Be aware that if you use UTF-8 encoding for your text, that only TrueType font
160             output (C) can handle it directly. Corefont and Type1 output will
161             require that the text will have to be converted back into a single-byte encoding
162             (using C), which may need to be declared with C (for
163             C or C). If you have any characters I found in the
164             selected single-byte I (but I found in the font itself), you
165             will need to use C to break up the font glyphs into 256 character
166             planes, map such characters to 0x00 .. 0xFF in the appropriate plane, and
167             switch between font planes as necessary.
168              
169             Core and Type1 fonts (output) use the byte values in the string (single-byte
170             encoding only!) and provide a byte-to-glyph mapping record for each plane.
171             TrueType outputs a group of four hexadecimal digits representing the "CId"
172             (character ID) of each character. The CId does not correspond to either the
173             single-byte or UTF-8 internal representations of the characters.
174              
175             The bottom line is that you need to know what the internal representation of
176             your text is, so that the output routines can tell the PDF reader about it
177             (via the PDF file). The text will not be translated upon output, but the PDF
178             reader needs to know what the encoding in use is, so it knows what glyph to
179             associate with each byte (or byte sequence).
180              
181             Note that some operating systems and Perl flavors are reputed to be strict
182             about encoding names. For example, B (an alias) may be rejected as
183             invalid, while B (a canonical value) will work.
184              
185             By the way, it is recommended that you be using I Perl 5.10 if you
186             are going to be using any non-ASCII characters. Perl 5.8 may be a little
187             unpredictable in handling such text.
188              
189             =head2 Rendering Order
190              
191             For better or worse, for compatibility purposes, PDF::Builder continues the
192             same rendering model as used by PDF::API2 (and possibly its predecessors). That
193             is, all graphics I are put into one record, and all
194             text output I goes into another
195             record. Which one is output first, is whichever is declared first. This can
196             lead to unexpected results, where items are rendered in (apparently) the
197             wrong order. That is, text and graphics items are not necessarily output
198             (rendered) in the same order as they were created in code. Two items in the
199             same object (e.g., C<$text>) I be rendered in the same order as they were
200             coded, but items from different objects may not be rendered in the expected
201             order. The following example (source code and annotated PDF excerpts) will
202             hopefully illustrate the issue:
203              
204             use strict;
205             use warnings;
206             use PDF::Builder;
207              
208             # demonstrate text and graphics object order
209             #
210             my $fname = "objorder";
211              
212             my $paper_size = "Letter";
213              
214             # see the text and graphics stream contents
215             my $pdf = PDF::Builder->new(compress => 'none');
216             $pdf->mediabox($paper_size);
217             my $page = $pdf->page();
218             # adjust path for your operating system
219             my $fontTR = $pdf->ttfont('C:\\Windows\\Fonts\\timesbd.ttf');
220              
221             For the first group, you might expect the "under" line to be output, then the
222             filled circle (disc) partly covering it, then the "over" line covering the
223             disc, and finally a filled rectangle (bar) over both lines. What actually
224             happened is that the C<$grfx> graphics object was declared first, so everything
225             in that object (the disc and bar) is output first, and the text object C<$text>
226             (both lines) comes afterwards. The result is that the text lines are on I
227             of the graphics drawings.
228            
229             # ----------------------------
230             # 1. text, orange ball over, text over, bar over
231              
232             my $grfx1 = $page->gfx();
233             my $text1 = $page->text();
234             $text1->font($fontTR, 20); # 20 pt Times Roman bold
235              
236             $text1->fillcolor('black');
237             $grfx1->strokecolor('blue');
238             $grfx1->fillcolor('orange');
239              
240             $text1->translate(50,700);
241             $text1->text_left("This text should be under everything.");
242              
243             $grfx1->circle(100,690, 30);
244             $grfx1->fillstroke();
245              
246             $text1->translate(50,670);
247             $text1->text_left("This text should be over the ball and under the bar.");
248              
249             $grfx1->rect(160,660, 20,70);
250             $grfx1->fillstroke();
251              
252             % ---------------- group 1: define graphics object first, then text
253             11 0 obj << /Length 690 >> stream % obj 11 is graphics for (1)
254             0 0 1 RG % stroke blue
255             1 0.647059 0 rg % fill orange
256             130 690 m ... c h B % draw and fill circle
257             160 660 20 70 re B % draw and fill bar
258             endstream endobj
259              
260             12 0 obj << /Length 438 >> stream % obj 12 is text for (1)
261             BT
262             /TiCBA 20 Tf % Times Roman Bold 20pt
263             0 0 0 rg % fill black
264             1 0 0 1 50 700 Tm % position text
265             <0037 ... 0011> Tj % "under" line
266             1 0 0 1 50 670 Tm % position text
267             <0037 ... 0011> Tj % "over" line
268             ET
269             endstream endobj
270              
271             The second group is the same as the first, with the only difference being
272             that the text object was declared first, and then the graphics object. The
273             result is that the two text lines are rendered first, and then the disc and
274             bar are drawn I them.
275              
276             # ----------------------------
277             # 2. (1) again, with graphics and text order reversed
278              
279             my $text2 = $page->text();
280             my $grfx2 = $page->gfx();
281             $text2->font($fontTR, 20); # 20 pt Times Roman bold
282              
283             $text2->fillcolor('black');
284             $grfx2->strokecolor('blue');
285             $grfx2->fillcolor('orange');
286              
287             $text2->translate(50,600);
288             $text2->text_left("This text should be under everything.");
289              
290             $grfx2->circle(100,590, 30);
291             $grfx2->fillstroke();
292              
293             $text2->translate(50,570);
294             $text2->text_left("This text should be over the ball and under the bar.");
295              
296             $grfx2->rect(160,560, 20,70);
297             $grfx2->fillstroke();
298              
299             % ---------------- group 2: define text object first, then graphics
300             13 0 obj << /Length 438 >> stream % obj 13 is text for (2)
301             BT
302             /TiCBA 20 Tf % Times Roman Bold 20pt
303             0 0 0 rg % fill black
304             1 0 0 1 50 600 Tm % position text
305             <0037 ... 0011> Tj % "under" line
306             1 0 0 1 50 570 Tm % position text
307             <0037 ... 0011> Tj % "over" line
308             ET
309             endstream endobj
310              
311             14 0 obj << /Length 690 >> stream % obj 14 is graphics for (2)
312             0 0 1 RG % stroke blue
313             1 0.647059 0 rg % fill orange
314             130 590 m ... h B % draw and fill circle
315             160 560 20 70 re B % draw and fill bar
316             endstream endobj
317              
318             The third group defines two text and two graphics objects, in the order that
319             they are expected in. The "under" text line is output first, then the orange
320             disc graphics is output, partly covering the text. The "over" text line is now
321             output -- it's actually I the disc, but is orange because the previous
322             object stream (first graphics object) left the fill color (also used for text)
323             as orange, because we didn't explicitly set the fill color before outputting
324             the second text line. This is not "inheritance" so much as it is whatever the
325             graphics (drawing) state (used for both "graphics" and "text") is left in at
326             the end of one object, it's the state at the beginning of the next object.
327             If you wish to control this, consider surrounding the graphics or text calls
328             with C and C calls to save and restore (push and pop) the
329             graphics state to what it was at the C. Finally, the bar is drawn over
330             everything.
331              
332             # ----------------------------
333             # 3. (2) again, with two graphics and two text objects
334              
335             my $text3 = $page->text();
336             my $grfx3 = $page->gfx();
337             $text3->font($fontTR, 20); # 20 pt Times Roman bold
338             my $text4 = $page->text();
339             my $grfx4 = $page->gfx();
340             $text4->font($fontTR, 20); # 20 pt Times Roman bold
341              
342             $text3->fillcolor('black');
343             $grfx3->strokecolor('blue');
344             $grfx3->fillcolor('orange');
345             # $text4->fillcolor('yellow');
346             # $grfx4->strokecolor('red');
347             # $grfx4->fillcolor('purple');
348              
349             $text3->translate(50,500);
350             $text3->text_left("This text should be under everything.");
351              
352             $grfx3->circle(100,490, 30);
353             $grfx3->fillstroke();
354              
355             $text4->translate(50,470);
356             $text4->text_left("This text should be over the ball and under the bar.");
357              
358             $grfx4->rect(160,460, 20,70);
359             $grfx4->fillstroke();
360              
361             % ---------------- group 3: define text1, graphics1, text2, graphics2
362             15 0 obj << /Length 206 >> stream % obj 15 is text1 for (3)
363             BT
364             /TiCBA 20 Tf % Times Roman Bold 20pt
365             0 0 0 rg % fill black
366             1 0 0 1 50 500 Tm % position text
367             <0037 ... 0011> Tj % "under" line
368             ET
369             endstream endobj
370              
371             16 0 obj << /Length 671 >> stream % obj 16 is graphics1 for (3) circle
372             0 0 1 RG % stroke blue
373             1 0.647059 0 rg % fill orange
374             130 490 m ... h B % draw and fill circle
375             endstream endobj
376              
377             17 0 obj << /Length 257 >> stream % obj 17 is text2 for (3)
378             BT
379             /TiCBA 20 Tf % Times Roman Bold 20pt
380             1 0 0 1 50 470 Tm % position text
381             <0037 ... 0011> Tj % "over" line
382             ET
383             endstream endobj
384              
385             18 0 obj << /Length 20 >> stream % obj 18 is graphics for (3) bar
386             160 460 20 70 re B % draw and fill bar
387             endstream endobj
388              
389             The fourth group is the same as the third, except that we define the fill color
390             for the text in the second line. This makes it clear that the "over" line (in
391             yellow) was written I the orange disc, and still before the bar.
392              
393             # ----------------------------
394             # 4. (3) again, a new set of colors for second group
395              
396             my $text3 = $page->text();
397             my $grfx3 = $page->gfx();
398             $text3->font($fontTR, 20); # 20 pt Times Roman bold
399             my $text4 = $page->text();
400             my $grfx4 = $page->gfx();
401             $text4->font($fontTR, 20); # 20 pt Times Roman bold
402              
403             $text3->fillcolor('black');
404             $grfx3->strokecolor('blue');
405             $grfx3->fillcolor('orange');
406             $text4->fillcolor('yellow');
407             $grfx4->strokecolor('red');
408             $grfx4->fillcolor('purple');
409              
410             $text3->translate(50,400);
411             $text3->text_left("This text should be under everything.");
412              
413             $grfx3->circle(100,390, 30);
414             $grfx3->fillstroke();
415              
416             $text4->translate(50,370);
417             $text4->text_left("This text should be over the ball and under the bar.");
418              
419             $grfx4->rect(160,360, 20,70);
420             $grfx4->fillstroke();
421              
422             % ---------------- group 4: define text1, graphics1, text2, graphics2 with colors for 2
423             19 0 obj << /Length 206 >> stream % obj 19 is text1 for (4)
424             BT
425             /TiCBA 20 Tf % Times Roman Bold 20pt
426             0 0 0 rg % fill black
427             1 0 0 1 50 400 Tm % position text
428             <0037 ... 0011> Tj % "under" line
429             ET
430             endstream endobj
431              
432             20 0 obj << /Length 671 >> stream % obj 20 is graphics1 for (4) circle
433             0 0 1 RG % stroke blue
434             1 0.647059 0 rg % fill orange
435             130 390 m ... h B % draw and fill circle
436             endstream endobj
437              
438             21 0 obj << /Length 266 >> stream % obj 21 is text2 for (4)
439             BT
440             /TiCBA 20 Tf % Times Roman Bold 20pt
441             1 1 0 rg % fill yellow
442             1 0 0 1 50 370 Tm % position text
443             <0037 ... 0011> Tj % "over" line
444             ET
445             endstream endobj
446              
447             22 0 obj << /Length 52 >> stream % obj 22 is graphics for (4) bar
448             1 0 0 RG % stroke red
449             0.498039 0 0.498039 rg % fill purple
450             160 360 20 70 re B % draw and fill rectangle (bar)
451             endstream endobj
452              
453             # ----------------------------
454             $pdf->saveas("$fname.pdf");
455              
456             The separation of text and graphics means that only some text methods are
457             available in a graphics object, and only some graphics methods are available
458             in a text object. There is much overlap, but they differ. There's really no
459             reason the code couldn't have been written (in PDF::API2, or earlier) as
460             outputting to a single object, which would keep everything in the same order as
461             the method calls. An advantage would be less object and stream overhead in the
462             PDF file. The only drawback might be that an object might more easily
463             overflow and require splitting into multiple objects, but that should be rare.
464              
465             You should always be able to manually split an object by simply ending output
466             to the first object, and picking up with output to the second object, I
467             as it was created immediately after the first object.> The graphics state at
468             the end of the first object should be the initial state at the beginning of the
469             second object. B use caution when dealing with text objects -- the
470             PDF specification states that the Text matrices are I carried over from
471             one object to the next (B resets them), so you may need to reset some
472             settings.
473              
474             $grfx1 = $page->gfx();
475             $grfx2 = $page->gfx();
476             # write a huge amount of stuff to $grfx1
477             # write a huge amount of stuff to $grfx2, picking up where $grfx1 left off
478              
479             In any case, now that you understand the rendering order and how the order
480             of object declarations affects it, how text and graphics are drawn can now be
481             completely controlled as desired. There is really no need to add another "both"
482             type object that will handle all graphics and text objects, as that would
483             probably be a major code bloat for very little benefit. However, it could be
484             considered in the future if there is a demonstrated need for it, such as
485             serious PDF file size bloat due to the extra object overhead when interleaving
486             text and graphics output.
487              
488             There is not currently a general facility for mixed-use objects, but a limited
489             example is the current implementation of underline, line-through, and overline
490             text (within C markup); which are performed within the text object,
491             temporarily exiting (ET) to graphics mode to draw the lines, and then returning
492             (BT) to text mode. This was done so that baseline coordinate adjustments could
493             be easily made. Since "BT" resets some text settings, this needs to be done
494             with care!
495              
496             =head2 PDF Versions Supported
497              
498             When creating a PDF file using the functions in PDF::Builder, the output is
499             marked as PDF 1.4. This does not mean that all I functionality up through
500             1.4 is supported! There are almost surely features missing as far back as the
501             PDF 1.0 standard.
502              
503             The big problem is when a PDF of version 1.5 or higher is imported or opened
504             in PDF::Builder. If it contains content that is actually unsupported by this
505             software, there is a chance that something will break. This does not guarantee
506             that a PDF marked as "1.7" will go down in flames when read by PDF::Builder,
507             or that a PDF written back out will break in a Reader, but the possibility is
508             there. Much PDF writer software simply marks its output as the highest version
509             of PDF at the time (usually 1.7), even if there is no content beyond, say, 1.2.
510             There is I handling of PDF 1.5 items in PDF::Builder, such as cross
511             reference streams, but support beyond 1.4 is very limited. All we can say is to
512             be careful when handling PDFs whose version is above 1.4, and test thoroughly,
513             as they may break at some point.
514              
515             PDF::Builder includes a simple version control mechanism, where the initial
516             PDF version to be output (default 1.4) can be set by the programmer. Input
517             PDFs greater than 1.4 (current output level) will receive a warning (can be
518             suppressed) that the output level will be raised to that level. The use of PDF
519             features greater than the current output level will likewise trigger a warning
520             that the output level is to be raised to the necessary level. If this is not
521             desired, you should avoid using those PDF features which are higher than the
522             desired PDF output level.
523              
524             =head2 History
525              
526             PDF::API2 was originally written by Alfred Reibenschuh, derived from Martin
527             Hosken's Text::PDF via the Text::PDF::API wrapper.
528             In 2009, Otto Hirr started the PDF::API3 fork, but it never went anywhere.
529             In 2011, PDF::API2 maintenance was taken over by Steve Simms.
530             In 2017, PDF::Builder was forked by Phil M. Perry, who desired a more aggressive
531             schedule of new features and bug fixes than Simms was providing, although some
532             of Simms's work I been ported from PDF::API2.
533              
534             According to "pdfapi2_for_fun_and_profit_APW2005.pdf" (on
535             http://pdfapi2.sourceforge.net, an unmaintained site), the history of PDF::API2
536             (the predecessor to PDF::Builder) goes as such:
537              
538             =over
539              
540             =item E E EE First Code implemented based on PDFlib-0.6 (AFPL)
541              
542             =item E E EE Changed to Text::PDF with a total rewrite as Text::PDF::API (procedural)
543              
544             =item E E EE Unmaintainable Code triggered rewrite into new Namespace PDF::API2 (object-oriented, LGPL)
545              
546             =item E E EE Object-Structure streamlined in 0.4x
547              
548             =back
549              
550             At Simms's request, the name of the new offering was changed from PDF::API4
551             to PDF::Builder, to reduce the chance of confusion due to parallel development.
552             Perry's intent is to keep all internal methods as upwardly compatible with
553             PDF::API2 as possible, although it is likely that there will be some drift
554             (incompatibilities) over time. At least initially, any program written based on
555             PDF::API2 should be convertible to PDF::Builder simply by changing "API2"
556             anywhere it occurs to "Builder". See the INFO/KNOWN_INCOMP known
557             incompatibilities file for further information.
558              
559             =head3 Thanks...
560              
561             Many users have helped out by reporting bugs and requesting enhancements. A
562             special shout out goes to those who have contributed code and tests, or
563             coordinated their package development with the needs of PDF::Builder:
564             Ben Bullock, Cary Gravel, Gregor Herrmann, Petr Pisar, Jeffrey Ratcliffe,
565             Steve Simms (via PDF::API2 fixes), and Johan Vromans.
566             Drop me a line if I've overlooked your contribution!
567              
568             =head1 DETAILED NOTES ON METHODS
569              
570             B older versions of this package named various (hash element) options
571             with leading dashes (hyphens) in the name, e.g., '-encode'. The use of a dash
572             is now optional, and options are documented with names I using dashes. At
573             some point in the future, it is possible that support for dashed names will be
574             deprecated (and eventually withdrawn), so it would be good practice to start
575             using undashed names in new and revised code.
576              
577             =head2 After saving a file...
578              
579             Note that a PDF object such as C<$pdf> cannot continue to be used after saving
580             an output PDF file or string with $pdf->C, C, or
581             C. There is some cleanup and other operations done internally
582             which make the object unusable for further operations. You will likely receive
583             an error message about B if
584             you try to keep using a PDF object.
585              
586             =head2 IntegrityCheck
587              
588             The PDF::Builder methods that open an existing PDF file, pass it by the
589             integrity checker method, C<$self-EIntegrityCheck(level, content)>. This method
590             servers two purposes: 1) to find any C settings that override the
591             PDF version found in the PDF heading, and 2) perform some basic validations on
592             the contents of the PDF.
593              
594             The C parameter accepts the following values:
595              
596             =over
597              
598             =item 0 = Do not output any diagnostic messages; just return any version override.
599              
600             =item 1 = Output error-level (serious) diagnostic messages, as well as returning any version override.
601              
602             Errors include, in no place was the /Root object specified, or if it was, the indicated object was not found. An object claims another object as its child (/Kids list), but another object has already claimed that child. An object claims a child, but that child does not list a Parent, or the child lists a different Parent.
603              
604             =item 2 = Output error- (serious) and warning- (less serious) level diagnostic messages, as well as returning any version override. B
605              
606             =item 3 = Output error- (serious), warning- (less serious), and note- (informational) level diagnostic messages, as well as returning any version override.
607              
608             Notes include, in no place was the (optional) /Info object specified, or if it was, the indicated object was not found. An object was referenced, but no entry for it was found among the objects. (This may be OK if the object is not defined, or is on the free list, as the reference will then be ignored.) An object is defined, but it appears that no other object is referencing it.
609              
610             =item 4 = Output error-, warning-, and note-level diagnostic messages, as well as returning any version override. Also dump the diagnostic data structure.
611              
612             =item 5 = Output error-, warning-, and note-level diagnostic messages, as well as returning any version override. Also dump the diagnostic data structure and the C<$self> data structure (generally useful only if you have already read in the PDF file).
613              
614             =back
615              
616             The version is a string (e.g., '1.5') if found, otherwise C (undefined value) is returned.
617              
618             For controlling the "automatic" call to IntegrityCheck (via opens), the level
619             may be given with the option (flag) C I>, where C is between 0 and 5.
620              
621             =head2 Preferences - set user display preferences
622              
623             =over
624              
625             =item $pdf->preferences(%options)
626              
627             Controls viewing preferences for the PDF.
628              
629             =back
630              
631             =head3 Page Mode Options
632              
633             =over
634              
635             =over
636              
637             =item fullscreen
638              
639             Full-screen mode, with no menu bar, window controls, or any other window visible.
640              
641             =item thumbs
642              
643             Thumbnail images visible.
644              
645             =item outlines
646              
647             Document outline visible.
648              
649             =back
650              
651             =back
652              
653             =head3 Page Layout Options
654              
655             =over
656              
657             =over
658              
659             =item singlepage
660              
661             Display one page at a time.
662              
663             =item onecolumn
664              
665             Display the pages in one column.
666              
667             =item twocolumnleft
668              
669             Display the pages in two columns, with oddnumbered pages on the left.
670              
671             =item twocolumnright
672              
673             Display the pages in two columns, with oddnumbered pages on the right.
674              
675             =back
676              
677             =back
678              
679             =head3 Viewer Options
680              
681             =over
682              
683             =over
684              
685             =item hidetoolbar
686              
687             Specifying whether to hide tool bars.
688              
689             =item hidemenubar
690              
691             Specifying whether to hide menu bars.
692              
693             =item hidewindowui
694              
695             Specifying whether to hide user interface elements.
696              
697             =item fitwindow
698              
699             Specifying whether to resize the document's window to the size of the displayed page.
700              
701             =item centerwindow
702              
703             Specifying whether to position the document's window in the center of the screen.
704              
705             =item displaytitle
706              
707             Specifying whether the window's title bar should display the
708             document title taken from the Title entry of the document information
709             dictionary.
710              
711             =item afterfullscreenthumbs
712              
713             Thumbnail images visible after Full-screen mode.
714              
715             =item afterfullscreenoutlines
716              
717             Document outline visible after Full-screen mode.
718              
719             =item printscalingnone
720              
721             Set the default print setting for page scaling to none.
722              
723             =item simplex
724              
725             Print single-sided by default.
726              
727             =item duplexflipshortedge
728              
729             Print duplex by default and flip on the short edge of the sheet.
730              
731             =item duplexfliplongedge
732              
733             Print duplex by default and flip on the long edge of the sheet.
734              
735             =back
736              
737             =back
738              
739             =head3 Page Fit Options
740              
741             These options are used for the C layout, as well as for
742             Annotations, Named Destinations and Outlines.
743              
744             =over
745              
746             =item 'fit' => 1
747              
748             Display the page designated by C<$page>, with its contents magnified just
749             enough to fit the entire page within the window both horizontally and
750             vertically. If the required horizontal and vertical magnification
751             factors are different, use the smaller of the two, centering the page
752             within the window in the other dimension.
753              
754             =item 'fith' => $top
755              
756             Display the page designated by C<$page>, with the vertical coordinate C<$top>
757             positioned at the top edge of the window and the contents of the page
758             magnified just enough to fit the entire width of the page within the
759             window.
760              
761             =item 'fitv' => $left
762              
763             Display the page designated by C<$page>, with the horizontal coordinate
764             C<$left> positioned at the left edge of the window and the contents of the
765             page magnified just enough to fit the entire height of the page within
766             the window.
767              
768             =item 'fitr' => [ $left, $bottom, $right, $top ]
769              
770             Display the page designated by C<$page>, with its contents magnified just
771             enough to fit the rectangle specified by the coordinates C<$left>, C<$bottom>,
772             C<$right>, and C<$top> entirely within the window both horizontally and
773             vertically. If the required horizontal and vertical magnification
774             factors are different, use the smaller of the two, centering the
775             rectangle within the window in the other dimension.
776              
777             =item 'fitb' => 1
778              
779             Display the page designated by C<$page>, with its contents magnified just
780             enough to fit its bounding box entirely within the window both
781             horizontally and vertically. If the required horizontal and vertical
782             magnification factors are different, use the smaller of the two,
783             centering the bounding box within the window in the other dimension.
784              
785             =item 'fitbh' => $top
786              
787             Display the page designated by C<$page>, with the vertical coordinate C<$top>
788             positioned at the top edge of the window and the contents of the page
789             magnified just enough to fit the entire width of its bounding box
790             within the window.
791              
792             =item 'fitbv' => $left
793              
794             Display the page designated by C<$page>, with the horizontal coordinate
795             C<$left> positioned at the left edge of the window and the contents of the
796             page magnified just enough to fit the entire height of its bounding
797             box within the window.
798              
799             =item 'xyz' => [ $left, $top, $zoom ]
800              
801             Display the page designated by C<$page>, with the coordinates C<$[$left, $top]>
802             positioned at the top-left corner of the window and the contents of
803             the page magnified by the factor C<$zoom>. A zero (0) value for any of the
804             parameters C<$left>, C<$top>, or C<$zoom> specifies that the current value of
805             that parameter is to be retained unchanged.
806              
807             =back
808              
809             =head3 Initial Page Options
810              
811             =over
812              
813             =item firstpage => [ $page, %options ]
814              
815             Specifying the page (either a page number or a page object) to be
816             displayed, plus one of the location options listed above in L.
817              
818             =back
819              
820             =head3 Example
821              
822             $pdf->preferences(
823             fullscreen => 1,
824             onecolumn => 1,
825             afterfullscreenoutlines => 1,
826             firstpage => [$page, fit => 1],
827             );
828              
829             =head2 info Example
830              
831             %h = $pdf->info(
832             'Author' => "Alfred Reibenschuh",
833             'CreationDate' => "D:20020911000000+01'00'",
834             'ModDate' => "D:YYYYMMDDhhmmssOHH'mm'",
835             'Creator' => "fredos-script.pl",
836             'Producer' => "PDF::Builder",
837             'Title' => "some Publication",
838             'Subject' => "perl ?",
839             'Keywords' => "all good things are pdf"
840             );
841             print "Author: $h{'Author'}\n";
842              
843             =head2 XMP XML example
844              
845             $xml = $pdf->xmpMetadata();
846             print "PDFs Metadata reads: $xml\n";
847             $xml=<
848            
849            
850            
851             xmlns:x='adobe:ns:meta/'
852             x:xmptk='XMP toolkit 2.9.1-14, framework 1.6'>
853            
854             xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'
855             xmlns:iX='http://ns.adobe.com/iX/1.0/'>
856            
857             rdf:about='uuid:b8659d3a-369e-11d9-b951-000393c97fd8'
858             xmlns:pdf='http://ns.adobe.com/pdf/1.3/'
859             pdf:Producer='Acrobat Distiller 6.0.1 for Macintosh'>
860            
861             rdf:about='uuid:b8659d3a-369e-11d9-b951-000393c97fd8'
862             xmlns:xap='http://ns.adobe.com/xap/1.0/'
863             xap:CreateDate='2004-11-14T08:41:16Z'
864             xap:ModifyDate='2004-11-14T16:38:50-08:00'
865             xap:CreatorTool='FrameMaker 7.0'
866             xap:MetadataDate='2004-11-14T16:38:50-08:00'>
867            
868             rdf:about='uuid:b8659d3a-369e-11d9-b951-000393c97fd8'
869             xmlns:xapMM='http://ns.adobe.com/xap/1.0/mm/'
870             xapMM:DocumentID='uuid:919b9378-369c-11d9-a2b5-000393c97fd8'/>
871            
872             rdf:about='uuid:b8659d3a-369e-11d9-b951-000393c97fd8'
873             xmlns:dc='http://purl.org/dc/elements/1.1/'
874             dc:format='application/pdf'>
875            
876            
877             Adobe Portable Document Format (PDF)
878            
879            
880            
881            
882             Adobe Systems Incorporated
883            
884            
885            
886            
887             PDF Reference, version 1.6
888            
889            
890            
891            
892            
893            
894             EOT
895              
896             $xml = $pdf->xmpMetadata($xml);
897             print "PDF metadata now reads: $xml\n";
898              
899             =head2 "BOX" METHODS
900              
901             B Use care if specifying a different Media Box (or other "box")
902             for a page, than the global "box" setting, to define the whole "chain" of boxes
903             on the page, to avoid surprises. For example, to define a global Media Box
904             (paper size) and a global Crop Box, and then define a new page-level Media Box
905             I defining a new page-level Crop Box, may give odd results in the
906             resultant cropping. Such combinations are not well defined.
907              
908             All dimensions in boxes default to the default User Unit, which is points (1/72
909             inch). Note that the PDF specification limits sizes and coordinates to 14400
910             User Units (200 inches, for the default User Unit of one point), and Adobe
911             products (so far) follow this limit for Acrobat and Distiller. It is worth
912             noting that other PDF writers and readers may choose to ignore the 14400 unit
913             limit, with or without the use of a specified User Unit. Therefore, PDF::Builder
914             does not enforce any limits on coordinates -- it's I responsibility to
915             consider what readers and other PDF tools may be used with a PDF you produce!
916             Also note that earlier Acrobat readers had coordinate limits as small as 3240
917             User Units (45 inches), and I media size of 72 or 3 User Units.
918              
919             =head3 User Units
920              
921             =over
922              
923             =item $pdf->userunit($number)
924              
925             The default User Unit in the PDF coordinate system is one point (1/72 inch). You
926             can think of it as a scale factor to enable larger (or even, smaller) documents.
927             This method may be used (for PDF 1.6 and higher) to set the User Unit to some
928             number of points. For example, C will set the scale multiplier to
929             72.0 points per User Unit, or 1 inch to the User Unit. Any number greater than
930             zero is acceptable, although some readers and tools may not handle User Units of
931             less than 1.0 very well.
932              
933             Not all readers respect the User Unit, if you give one, or handle it in exactly
934             the same way. Adobe Distiller, for one, does not use it. How User Units are
935             handled may vary from reader to reader. Adobe Acrobat, at this writing, respects
936             User Unit in version 7.0 and up, but limits it to 75000 (giving a maximum
937             document size of 15 million inches or 236.7 miles or 381 km). Other readers and
938             PDF tools may allow a larger (or smaller) limit.
939              
940             B Some readers ignore a global
941             User Unit setting and do I have pages inherit it (PDF::Builder duplicates
942             it on each page to simulate inheritance). Some readers may give spurious
943             warnings about truncated content when a Media Box is changed while User Units
944             are being used. Some readers do strange things with Crop Boxes when a User Unit
945             is in effect.
946              
947             Depending on the reader used, the effect of a larger User Unit (greater than 1)
948             may mean lower resolution (chunkier or coarser appearance) in the rendered
949             document. If you're printing something the size of a highway billboard, this may
950             not matter to you, but you should be aware of the possibility (even with
951             fractional coordinates). Conversely, a User Unit of less than 1.0 (if permitted)
952             reduces the allowable size of your document, but I result in greater
953             resolution.
954              
955             A global (PDF level) User Unit setting is inherited by each page (an action by
956             PDF::Builder, not necessarily automatically done by the reader), or can be
957             overridden by calling userunit in the page. Do not give more than one global
958             userunit setting, as only the last one will be used.
959             Setting a page's User Unit (if C<< $page-> >> instead) is permitted (overriding
960             the global setting for this page). However, many sources recommend against
961             doing this, as results may not be as expected (once again, depending on the
962             quirks of the reader).
963              
964             Remember to call C I calling anything having to do with page
965             or box sizes, or coordinates. Especially when setting 'named' box sizes, the
966             methods need to know the current User Unit so that named page sizes (in points)
967             may be scaled down to the current User Unit.
968              
969             =back
970              
971             =head3 Media Box
972              
973             =over
974              
975             =item $pdf->mediabox($name)
976              
977             =item $pdf->mediabox($name, orient => 'orientation' )
978              
979             =item $pdf->mediabox($w,$h)
980              
981             =item $pdf->mediabox($llx,$lly, $urx,$ury)
982              
983             =item ($llx,$lly, $urx,$ury) = $pdf->mediabox()
984              
985             Sets the global Media Box (or page's Media Box, if C<< $page-> >> instead).
986             This defines the width and height (or by corner
987             coordinates, or by standard name) of the output page itself, such as the
988             physical paper size. This is normally the largest of the "boxes". If any
989             subsidiary box (within it) exceeds the media box, the portion of the material
990             or boxes outside of the Media Box will be ignored. That is, the Media Box is
991             the One Box to Rule Them All, and is the overall limit for other boxes (some
992             documentation refers to the Media Box as "clipping" other boxes). In
993             addition, the Media Box defines the overall I for text and
994             graphics operations.
995              
996             If no arguments are given, the current Media Box (global or page) coordinates
997             are returned instead. The former C (page only) function is
998             B and will likely be removed some time in the future. In addition,
999             when I the Media Box, the resulting coordinates are returned. This
1000             permits you to specify the page size by a name (alias) and get the dimensions
1001             back, all in one call.
1002              
1003             Note that many printers can B print all the way to the
1004             physical edge of the paper, so you should plan to leave some blank margin,
1005             even outside of any crop marks and bleeds. Printers and on-screen readers are
1006             free to discard any content found outside the Media Box, and printers may
1007             discard some material just inside the Media Box.
1008              
1009             A I Media Box is B by the PDF spec; if not explicitly given,
1010             PDF::Builder will set the global Media Box to US Letter size (8.5in x 11in).
1011             This is the media size that will be used for all pages if you do not specify
1012             a C call on a page. That is,
1013             a global (PDF level) mediabox setting is inherited by each page, or can be
1014             overridden by setting mediabox in the page. Do not give more than one global
1015             mediabox setting, as only the last one will be used.
1016              
1017             If you give a single string name (e.g., 'A4'), you may optionally add an
1018             orientation to turn the page 90 degrees into Landscape mode:
1019             C<< orient => 'L' >> or C<< orient => 'l' >>. C is the only option
1020             recognized, and a string beginning with an 'L' or 'l' (for Landscape) is the
1021             only value of interest (anything else is treated as Portrait mode). The I
1022             axis still runs from 0 at the bottom of the page to what used to be the page
1023             I (now, I) at the top, and likewise for the I axis: 0 at left
1024             to (former) I at the right. That is, the coordinate system is the same
1025             as before, except that the height and width are different.
1026              
1027             The lower left corner does not I to be 0,0. It can be any values you want,
1028             including negative values (so long as the resulting media's sides are at least
1029             one point long). C sets the coordinate system (including the origin)
1030             of the graphics and text that will be drawn, as well as for subsequent "boxes".
1031             It's even possible to give any two opposite corners (such as upper left and
1032             lower right). The coordinate system will be rearranged (by the Reader) to
1033             still be the conventional minimum C and C in the lower left (i.e., you
1034             can't make C I from top to bottom!).
1035              
1036             B
1037              
1038             $pdf = PDF::Builder->new();
1039             $pdf->mediabox('A4'); # A4 size (595 Pt wide by 842 Pt high)
1040             ...
1041             $pdf->saveas('our/new.pdf');
1042              
1043             $pdf = PDF::Builder->new();
1044             $pdf->mediabox(595, 842); # A4 size, with implicit 0,0 LL corner
1045             ...
1046             $pdf->saveas('our/new.pdf');
1047              
1048             $pdf = PDF::Builder->new;
1049             $pdf->mediabox(0, 0, 595, 842); # A4 size, with explicit 0,0 LL corner
1050             ...
1051             $pdf->saveas('our/new.pdf');
1052              
1053             See the L source code for the full list of
1054             supported names (aliases) and their dimensions in points. You are free to add
1055             additional paper sizes to this file, if you wish. You might want to do this if
1056             you frequently use a standard page size in rotated (Landscape) mode. See also
1057             the C call in L. These names (aliases) are
1058             also usable in other "box" calls, although useful only if the "box" is the same
1059             size as the full media (Media Box), and you don't mind their starting at 0,0.
1060              
1061             =back
1062              
1063             =head3 Crop Box
1064              
1065             =over
1066              
1067             =item $pdf->cropbox($name)
1068              
1069             =item $pdf->cropbox($name, orient => 'orientation')
1070              
1071             =item $pdf->cropbox($w,$h)
1072              
1073             =item $pdf->cropbox($llx,$lly, $urx,$ury)
1074              
1075             =item ($llx,$lly, $urx,$ury) = $pdf->cropbox()
1076              
1077             Sets the global Crop Box (or page's Crop Box, if C<< $page-> >> instead).
1078             This will define the media size to which the output will
1079             later be I. Note that this does B itself output any crop marks
1080             to guide cutting of the paper! PDF Readers should consider this to be the
1081             I portion of the page, and anything found outside it I be clipped
1082             (invisible). By default, it is equal to the Media Box, but may be defined to be
1083             smaller, in the coordinate system set by the Media Box. A global setting will
1084             be inherited by each page, but can be overridden on a per-page basis.
1085              
1086             A Reader or Printer may choose to discard any clipped (invisible) part of the
1087             page, and show only the area I the Crop Box. For example, if your page
1088             Media Box is A4 (0,0 to 595,842 Points), and your Crop Box is (100,100 to
1089             495,742), a reader such as Adobe Acrobat Reader may show you a page 395 by
1090             642 Points in size (i.e., just the visible area of your page). Other Readers
1091             may show you the full media size (Media Box) and a 100 Point wide blank area
1092             (in this example) around the visible content.
1093              
1094             If no arguments are given, the current Crop Box (global or page) coordinates
1095             are returned instead. The former C (page only) function is
1096             B and will likely be removed some time in the future. If a Crop Box
1097             has not been defined, the Media Box coordinates (which always exist) will be
1098             returned instead. In addition,
1099             when I the Crop Box, the resulting coordinates are returned. This
1100             permits you to specify the crop box by a name (alias) and get the dimensions
1101             back, all in one call.
1102              
1103             Do not confuse the Crop Box with the C, which shows where printed
1104             paper is expected to actually be I. Some PDF Readers may reduce the
1105             visible "paper" background to the size of the crop box; others may simply omit
1106             any content outside it. Either way, you would lose any trim or crop marks,
1107             printer instructions, color alignment dots, or other content outside the Crop
1108             Box. I would be limit printing to the area where a
1109             printer I reliably put down ink, and leave white the edge areas where
1110             paper-handling mechanisms prevent ink or toner from being applied. This would
1111             keep you from accidentally putting valuable content in an area where a printer
1112             will refuse to print, yet permit you to include a bleed area and space for
1113             printer's marks and instructions. Needless to say, if your printer cannot print
1114             to the very edge of the paper, you will need to trim (cut) the printed sheets
1115             to get true bleeds.
1116              
1117             A global (PDF level) cropbox setting is inherited by each page, or can be
1118             overridden by setting cropbox in the page.
1119             As with C, only one crop box may be set at this (PDF) level.
1120             As with C, a named media size may have an orientation (l or L) for
1121             Landscape mode.
1122             Note that the PDF level global Crop Box will be used I the page gets
1123             its own Media Box. That is, the page's Crop Box inherits the global Crop Box,
1124             not the page Media Box, even if the page has its own media size! If you set the
1125             page's own Media Box, you should consider also explicitly setting the page
1126             Crop Box (and other boxes).
1127              
1128             =back
1129              
1130             =head3 Bleed Box
1131              
1132             =over
1133              
1134             =item $pdf->bleedbox($name)
1135              
1136             =item $pdf->bleedbox($name, orient => 'orientation')
1137              
1138             =item $pdf->bleedbox($w,$h)
1139              
1140             =item $pdf->bleedbox($llx,$lly, $urx,$ury)
1141              
1142             =item ($llx,$lly, $urx,$ury) = $pdf->bleedbox()
1143              
1144             Sets the global Bleed Box (or page's Bleed Box, if C<< $page-> >> instead).
1145             This is typically used in printing on paper, where you want
1146             ink or color (such as thumb tabs) to be printed a bit beyond the final paper
1147             size, to ensure that the cut paper I (the cut goes I the ink),
1148             rather than accidentally leaving some white paper visible outside. Allow
1149             enough "bleed" over the expected trim line to account for minor variations in
1150             paper handling, folding, and cutting; to avoid showing white paper at the edge.
1151             The Bleed Box is where I could actually extend to; the Trim Box is
1152             normally within it, where the paper would actually be I. The default
1153             value is equal to the Crop Box, but is often a bit smaller. The space between
1154             the Bleed Box and the Crop Box is available for printer instructions, color
1155             alignment dots, etc., while crop marks (trim guides) are at least partly within
1156             the bleed area (and should be printed after content is printed).
1157              
1158             If no arguments are given, the current Bleed Box (global or page) coordinates
1159             are returned instead. The former C (page only) function is
1160             B and will likely be removed some time in the future. If a Bleed Box
1161             has not been defined, the Crop Box coordinates (if defined) will be returned,
1162             otherwise the Media Box coordinates (which always exist) will be returned.
1163             In addition, when I the Bleed Box, the resulting coordinates are
1164             returned. This permits you to specify the bleed box by a name (alias) and get
1165             the dimensions back, all in one call.
1166              
1167             A global (PDF level) bleedbox setting is inherited by each page, or can be
1168             overridden by setting bleedbox in the page.
1169             As with C, only one bleed box may be set at this (PDF) level.
1170             As with C, a named media size may have an orientation (l or L) for
1171             Landscape mode.
1172             Note that the PDF level global Bleed Box will be used I the page gets
1173             its own Crop Box. That is, the page's Bleed Box inherits the global Bleed Box,
1174             not the page Crop Box, even if the page has its own media size! If you set the
1175             page's own Media Box or Crop Box, you should consider also explicitly setting
1176             the page Bleed Box (and other boxes).
1177              
1178             =back
1179              
1180             =head3 Trim Box
1181              
1182             =over
1183              
1184             =item $pdf->trimbox($name)
1185              
1186             =item $pdf->trimbox($name, orient => 'orientation')
1187              
1188             =item $pdf->trimbox($w,$h)
1189              
1190             =item $pdf->trimbox($llx,$lly, $urx,$ury)
1191              
1192             =item ($llx,$lly, $urx,$ury) = $pdf->trimbox()
1193              
1194             Sets the global Trim Box (or page's Trim Box, if C<< $page-> >> instead).
1195             This is supposed to be the actual dimensions of the
1196             finished page (after trimming of the paper). In some production environments,
1197             it is useful to have printer's instructions, cut marks, and so on outside of
1198             the trim box. The default value is equal to Crop Box, but is often a bit
1199             smaller than any Bleed Box, to allow the desired "bleed" effect.
1200              
1201             If no arguments are given, the current Trim Box (global or page) coordinates
1202             are returned instead. The former C (page only) function is
1203             B and will likely be removed some time in the future. If a Trim Box
1204             has not been defined, the Crop Box coordinates (if defined) will be returned,
1205             otherwise the Media Box coordinates (which always exist) will be returned.
1206             In addition, when I the Trim Box, the resulting coordinates are
1207             returned. This permits you to specify the trim box by a name (alias) and get
1208             the dimensions back, all in one call.
1209              
1210             A global (PDF level) trimbox setting is inherited by each page, or can be
1211             overridden by setting trimbox in the page.
1212             As with C, only one trim box may be set at this (PDF) level.
1213             As with C, a named media size may have an orientation (l or L) for
1214             Landscape mode.
1215             Note that the PDF level global Trim Box will be used I the page gets
1216             its own Crop Box. That is, the page's Trim Box inherits the global Trim Box,
1217             not the page Crop Box, even if the page has its own media size! If you set the
1218             page's own Media Box or Crop Box, you should consider also explicitly setting
1219             the page Trim Box (and other boxes).
1220              
1221             =back
1222              
1223             =head3 Art Box
1224              
1225             =over
1226              
1227             =item $pdf->artbox($name)
1228              
1229             =item $pdf->artbox($name, orient => 'orientation')
1230              
1231             =item $pdf->artbox($w,$h)
1232              
1233             =item $pdf->artbox($llx,$lly, $urx,$ury)
1234              
1235             =item ($llx,$lly, $urx,$ury) = $pdf->artbox()
1236              
1237             Sets the global Art Box (or page's Art Box, if C<< $page-> >> instead).
1238             This is supposed to define "the extent of the page's
1239             I content (including [margins])". It might exclude some content,
1240             such as Headlines or headings. Any binding or punched-holes margin would
1241             typically be outside of the Art Box, as would be page numbers and running
1242             headers and footers. The default value is equal to the Crop Box, although
1243             normally it would be no larger than any Trim Box. The Art Box may often be
1244             used for defining "important" content (e.g., I advertisements) that
1245             may or may not be brought over to another page (e.g., N-up printing).
1246              
1247             If no arguments are given, the current Art Box (global or page) coordinates
1248             are returned instead. The former C (page only) function is
1249             B and will likely be removed some time in the future. If an Art Box
1250             has not been defined, the Crop Box coordinates (if defined) will be returned,
1251             otherwise the Media Box coordinates (which always exist) will be returned.
1252             In addition, when I the Art Box, the resulting coordinates are
1253             returned. This permits you to specify the art box by a name (alias) and get
1254             the dimensions back, all in one call.
1255              
1256             A global (PDF level) artbox setting is inherited by each page, or can be
1257             overridden by setting artbox in the page.
1258             As with C, only one art box may be set at this (PDF) level.
1259             As with C, a named media size may have an orientation (l or L) for
1260             Landscape mode.
1261             Note that the PDF level global Art Box will be used I the page gets
1262             its own Crop Box. That is, the page's Art Box inherits the global Art Box,
1263             not the page Crop Box, even if the page has its own media size! If you set the
1264             page's own Media Box or Crop Box, you should consider also explicitly setting
1265             the page Art Box (and other boxes).
1266              
1267             =back
1268              
1269             =head3 Suggested Box Usage
1270              
1271             See C for an example of using boxes.
1272              
1273             How you define your boxes (or let them default) is up to you, depending on
1274             whether you're duplex printing US Letter or A4 on your laser printer, to be
1275             spiral bound on the bind margin, or engaging a professional printer. In the
1276             latter case, discuss in advance with the print firm what capabilities (and
1277             limitations) they have
1278             and what information they need from a PDF file. For instance, they may not want
1279             a Crop Box defined, and may call for very specific box sizes. For large press
1280             runs, they may print multiple pages (N-up) duplexed on large web roll
1281             "signatures", which are then intricately folded and guillotined (trimmed) and
1282             bound together into books or magazines. You would usually just supply a PDF
1283             with all the pages; they would take care of the signature layout (which
1284             includes offsets and 180 degree rotations).
1285              
1286             (As an aside, don't count on a printer having
1287             any particular font available, so be sure to ask. Usually they will want you
1288             to embed all fonts used, but ask first, and double-check before handing over
1289             the print job! TTF/OTF fonts (C) are embedded by default, but other
1290             fonts (core, ps, bdf, cjk) are not! A printer I have a core font
1291             collection, but they are free to substitute a "workalike" font for any given
1292             core font, and the results may not match what you saw on your PC!)
1293              
1294             On the assumption that you're using a single sheet (US Letter or A4) laser or
1295             inkjet printer, are you planning to trim each sheet down to a smaller final
1296             size? If so, you can do true bleeds by defining a Trim Box and a slightly
1297             larger Bleed Box. You would print bleeds (all the way to the finished edge)
1298             out to the Bleed Box, but nothing is enforced about the Bleed Box. At the other
1299             end of the spectrum, you would define the Media
1300             Box to be the physical paper size being printed on. Most printers reserve a
1301             little space on the sides (and possibly top and bottom) for paper handling, so
1302             it is often good to define your Crop Box as the printable area. Remember that
1303             the Media Box sets the coordinate system used, so you still need to avoid
1304             going outside the Crop Box with content (most readers and printers will not
1305             show any ink outside of the Crop Box). Whether or not you define a Crop Box,
1306             you're going to almost always end up with white paper on at least the sides.
1307              
1308             For small in-house jobs, you probably won't need color alignment dots and other
1309             such professional instructions and information between the Bleed Box and the
1310             Crop Box, but crop marks for trimming (if used) should go just outside the Trim
1311             Box (partly or wholly within the Bleed Box), and
1312             be drawn I all content. If you're I trimming the paper, don't try
1313             to do any bleed effects (including solid background color pages/covers), as
1314             you will usually have a white edge around the
1315             sheet anyway. Don't count on a PDF document I being physically printed,
1316             and not just displayed (where you can do things like bleed all the way to the
1317             media edge). Finally, for single sheet printing, an Art Box is
1318             probably unnecessary, but if you're combining pages into N-up prints, or doing
1319             other manipulations, it may be useful.
1320              
1321             =head3 Box Inheritance
1322              
1323             What Media, Crop, Bleed, Trim, and Art Boxes a page gets can be a little
1324             complicated. Note that usually, only the Media and Crop Boxes will have a
1325             clear visual effect. The visual effect of the other boxes (if any) may be
1326             very subtle.
1327              
1328             First, everything is set at the global (PDF) level. The Media Box is always
1329             defined, and defaults to US Letter (8.5 inches wide by 11 inches high). The
1330             global Crop Box inherits the Media Box, unless explicitly defined. The Bleed,
1331             Trim, and Art Boxes inherit the Crop Box, unless explicitly defined. A global
1332             box should only be defined once, as the last one defined is the one that will
1333             be written to the PDF!
1334              
1335             Second, a page inherits the global boxes, for its initial settings. You may
1336             call any of the box set methods (C, C, etc.) to explicitly
1337             set (override) any box for I page. Note that setting a new Media Box for
1338             the page does B reset the page's Crop Box -- it still uses whatever it
1339             inherited from the global Crop Box. You would need to explicitly set the page's
1340             Crop Box if you want a different setting. Likewise, the page's Bleed, Trim, and
1341             Art Boxes will not be reset by a new page Crop Box -- they will still inherit
1342             from the global (PDF) settings.
1343              
1344             Third, the page Media Box (the one actually used for output pages), clips or
1345             limits all the other boxes to extend no larger than its size. For example, if
1346             the Media Box is US Letter, and you set a Crop Box of A4 size, the smaller of
1347             the two heights (11 inches) would be effective, and the smaller of the two
1348             widths (8.26 inches, 595 Points) would be effective.
1349             The I dimensions of a box are returned on query (get), not the
1350             I dimensions clipped by the Media Box.
1351              
1352             =head2 FONT METHODS
1353              
1354             =head3 Core Fonts
1355              
1356             Core fonts are limited to single byte encodings. You cannot use UTF-8 or other
1357             multibyte encodings with core fonts. The default encoding for the core fonts is
1358             WinAnsiEncoding (roughly the CP-1252 superset of ISO-8859-1). See the
1359             C option below to change this encoding.
1360             See L method for information on
1361             accessing more than 256 glyphs in a font, using planes, I
1362             guarantee that future changes to font files will permit consistent results>.
1363              
1364             Note that core fonts use fixed lists of expected glyphs, along with metrics
1365             such as their widths. This may not exactly match up with whatever local font
1366             file is used by the PDF reader. It's usually pretty close, but many cases have
1367             been found where the list of glyphs is different between the core fonts and
1368             various local font files, so be aware of this.
1369              
1370             To allow UTF-8 text and extended glyph counts, you should
1371             consider replacing your use of core fonts with TrueType (.ttf) and OpenType
1372             (.otf) fonts. There are tools, such as I, which can do a fairly good
1373             (though, not perfect) job of converting a Type1 font library to OTF.
1374              
1375             B
1376              
1377             $font1 = $pdf->corefont('Times-Roman', encode => 'latin2');
1378             $font2 = $pdf->corefont('Times-Bold');
1379             $font3 = $pdf->corefont('Helvetica');
1380             $font4 = $pdf->corefont('ZapfDingbats');
1381              
1382             Valid %options are:
1383              
1384             =over
1385              
1386             =item encode
1387              
1388             Changes the encoding of the font from its default. Notice that the encoding
1389             (I the entire font's glyph list) is shown in a PDF object (record), listing
1390             256 glyphs associated with this encoding (I that are available in this
1391             font).
1392              
1393             =item dokern
1394              
1395             Enables kerning if data is available.
1396              
1397             =back
1398              
1399             B
1400              
1401             Even though these are called "core" fonts, they are I shipped
1402             with PDF::Builder, but are expected to be found on the machine with the PDF
1403             reader. Most core fonts are installed with a PDF reader, and thus are not
1404             coordinated with PDF::Builder. PDF::Builder I ship with core font
1405             I files (width, glyph names, etc.), but these cannot be guaranteed to
1406             be in sync with what the PDF reader has installed!
1407              
1408             There are some 14 core fonts (regular, italic, bold, and bold-italic for
1409             Times [serif], Helvetica [sans serif], Courier [fixed pitch]; plus two symbol
1410             fonts) that are supposed to be available on any PDF reader, B
1411             fonts with very similar metrics are often substituted.> You should I count
1412             on any of the 15 Windows core fonts (Bank Gothic, Georgia, Trebuchet, Verdana,
1413             and two more symbol fonts) being present, especially on Linux, Mac, or other
1414             non-Windows platforms. Be aware if you are producing PDFs to be read on a
1415             variety of different systems!
1416              
1417             If you want to ensure the widest portability for a PDF document you produce,
1418             you should consider using TTF fonts (instead of core fonts) and embedding them
1419             in the document. This ensures that there will be no substitutions, that all
1420             metrics are known and match the glyphs, UTF-8 encoding can be used, and
1421             that the glyphs I be available on the reader's machine. At least on
1422             Windows platforms, most of the fonts are TTF anyway, which are used behind the
1423             scenes for "core" fonts, while missing most of the capabilities of TTF (now
1424             or possibly later in PDF::Builder) such as embedding, ligatures, UTF-8, etc.
1425             The downside is, obviously, that the resulting PDF file will be larger because
1426             it includes the font(s). There I also be copyright or licensing issues
1427             with the redistribution of font files in this manner (you might want to check,
1428             before widely distributing a PDF document with embedded fonts, although many
1429             I permit the part of the font used, to be embedded.).
1430              
1431             See also L.
1432              
1433             =head3 PS Fonts
1434              
1435             PS (T1) fonts are limited to single byte encodings. You cannot use UTF-8 or
1436             other multibyte encodings with T1 fonts.
1437             The default encoding for the T1 fonts is
1438             WinAnsiEncoding (roughly the CP-1252 superset of ISO-8859-1). See the
1439             C option below to change this encoding.
1440             See L method for information on
1441             accessing more than 256 glyphs in a font, using planes, I
1442             guarantee that future changes to font files will permit consistent results>.
1443             B many Type1 fonts are limited to 256 glyphs, but some are available
1444             with more than 256 glyphs. Still, a maximum of 256 at a time are usable.
1445              
1446             C accepts both ASCII (.pfa) and binary (.pfb) Type1 glyph files.
1447             Font metrics can be supplied in either ASCII (.afm) or binary (.pfm) format,
1448             as can be seen in the examples given below. It is possible to use .pfa with .pfm
1449             and .pfb with .afm if that's what's available. The ASCII and binary files have
1450             the same content, just in different formats.
1451              
1452             To allow UTF-8 text and extended glyph counts in one font, you should
1453             consider replacing your use of Type1 fonts with TrueType (.ttf) and OpenType
1454             (.otf) fonts. There are tools, such as I, which can do a fairly good
1455             (though, not perfect) job of converting your font library to OTF.
1456              
1457             B
1458              
1459             $font1 = $pdf->psfont('Times-Book.pfa', afmfile => 'Times-Book.afm');
1460             $font2 = $pdf->psfont('/fonts/Synest-FB.pfb', pfmfile => '/fonts/Synest-FB.pfm');
1461              
1462             Valid %options are:
1463              
1464             =over
1465              
1466             =item encode
1467              
1468             Changes the encoding of the font from its default. Notice that the encoding
1469             (I the entire font's glyph list) is shown in a PDF object (record), listing
1470             256 glyphs associated with this encoding (I that are available in this
1471             font).
1472              
1473             =item afmfile
1474              
1475             Specifies the location of the I font metrics file (.afm). It may be used
1476             with either an ASCII (.pfa) or binary (.pfb) glyph file.
1477              
1478             =item pfmfile
1479              
1480             Specifies the location of the I font metrics file (.pfm). It may be used
1481             with either an ASCII (.pfa) or binary (.pfb) glyph file.
1482              
1483             =item dokern
1484              
1485             Enables kerning if data is available.
1486              
1487             =back
1488              
1489             B these T1 (Type1) fonts are I shipped with PDF::Builder, but are
1490             expected to be found on the machine with the PDF reader. Most PDF readers do
1491             not install T1 fonts, and it is up to the user of the PDF reader to install
1492             the needed fonts. Unlike TrueType fonts, PS (T1) fonts are not embedded in the
1493             PDF, and must be supplied on the Reader end.
1494              
1495             See also L.
1496              
1497             =head3 TrueType Fonts
1498              
1499             B BaseEncoding is I set by default for TrueType fonts, so B
1500             in the PDF isn't searchable> (by the PDF reader) unless a ToUnicode CMap is
1501             included. A ToUnicode CMap I included by default (unicodemap set to 1) by
1502             PDF::Builder, but allows it to be disabled (for performance and file size
1503             reasons) by setting unicodemap to 0. This will produce non-searchable text,
1504             which, besides being annoying to users, may prevent screen
1505             readers and other aids to disabled users from working correctly!
1506              
1507             B
1508              
1509             $font1 = $pdf->ttfont('Times.ttf');
1510             $font2 = $pdf->ttfont('Georgia.otf');
1511              
1512             Valid %options are:
1513              
1514             =over
1515              
1516             =item encode
1517              
1518             Changes the encoding of the font from its default (WinAnsiEncoding).
1519              
1520             Note that for a single byte encoding (e.g., 'latin1'), you are limited to 256
1521             characters defined for that encoding. 'automap' does not work with TrueType.
1522             If you want more characters than that, use 'utf8' encoding with a UTF-8
1523             encoded text string.
1524              
1525             =item isocmap
1526              
1527             Use the ISO Unicode Map instead of the default MS Unicode Map.
1528              
1529             =item unicodemap
1530              
1531             If 1 (default), output ToUnicode CMap to permit text searches and screen
1532             readers. Set to 0 to save space by I including the ToUnicode CMap, but
1533             text searching and screen reading will not be possible.
1534              
1535             =item dokern
1536              
1537             Enables kerning if data is available.
1538              
1539             =item noembed
1540              
1541             Disables embedding of the font file. B
1542             as the glyphs provided on the PDF reader machine may not match what was used on
1543             the PDF writer machine (the one running PDF::Builder)!> If you know I
1544             that all PDF readers will be using the same TTF or OTF file you're using with
1545             PDF::Builder; not embedding the font may be acceptable, in return for a smaller
1546             PDF file size. Note that the Reader needs to know where to find the font file
1547             -- it can't be in any random place, but typically needs to be listed in a path
1548             that the Reader follows. Otherwise, it will be unable to render the text!
1549              
1550             The only value for the C flag currently checked for is B<1>, which </td> </tr> <tr> <td class="h" > <a name="1551">1551</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> means to I<not> embed the font file in the PDF. Any other value currently </td> </tr> <tr> <td class="h" > <a name="1552">1552</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> results in the font file being embedded (by B<default>), although in the future, </td> </tr> <tr> <td class="h" > <a name="1553">1553</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> other values might be given significance (such as checking permission bits). </td> </tr> <tr> <td class="h" > <a name="1554">1554</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1555">1555</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Some additional comments on embedding font file(s) into the PDF: besides </td> </tr> <tr> <td class="h" > <a name="1556">1556</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> substantially increasing the size of the PDF (even if the font is subsetted, </td> </tr> <tr> <td class="h" > <a name="1557">1557</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> by default), PDF::Builder does not check the font file for any flags indicating </td> </tr> <tr> <td class="h" > <a name="1558">1558</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> font licensing issues and limitations on use. A font foundry may not permit </td> </tr> <tr> <td class="h" > <a name="1559">1559</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> embedding at all, may permit a subset of the font to be embedded, may permit a </td> </tr> <tr> <td class="h" > <a name="1560">1560</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> full font to be embedded, and may specify what can be done with an embedded </td> </tr> <tr> <td class="h" > <a name="1561">1561</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> font (e.g., may or may not be extracted for further use beyond displaying this </td> </tr> <tr> <td class="h" > <a name="1562">1562</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> one PDF). When you choose to use (and embed) a font, you should be aware of any </td> </tr> <tr> <td class="h" > <a name="1563">1563</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> such licensing issues. </td> </tr> <tr> <td class="h" > <a name="1564">1564</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1565">1565</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =item nosubset </td> </tr> <tr> <td class="h" > <a name="1566">1566</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1567">1567</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Disables subsetting of a TTF/OTF font, when embedded. By default, only the </td> </tr> <tr> <td class="h" > <a name="1568">1568</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> glyphs used by a document are included in the file, and I<not> the entire font. </td> </tr> <tr> <td class="h" > <a name="1569">1569</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> This can result in a tremendous savings in PDF file size. If you intend to </td> </tr> <tr> <td class="h" > <a name="1570">1570</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> allow the PDF to be edited by users, not having the entire font glyph set </td> </tr> <tr> <td class="h" > <a name="1571">1571</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> available may cause problems, so be aware of that (and consider using </td> </tr> <tr> <td class="h" > <a name="1572">1572</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> C<< nosubset => 1 >>. Setting this flag to any value results in the entire </td> </tr> <tr> <td class="h" > <a name="1573">1573</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> font glyph set being embedded in the file. It might be a good idea to use only </td> </tr> <tr> <td class="h" > <a name="1574">1574</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> the value B<1>, in case other values are assigned roles in the future. </td> </tr> <tr> <td class="h" > <a name="1575">1575</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1576">1576</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =item debug </td> </tr> <tr> <td class="h" > <a name="1577">1577</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1578">1578</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> If set to 1 (default is 0), diagnostic information is output about the CMap </td> </tr> <tr> <td class="h" > <a name="1579">1579</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> processing. </td> </tr> <tr> <td class="h" > <a name="1580">1580</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1581">1581</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =item usecmf </td> </tr> <tr> <td class="h" > <a name="1582">1582</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1583">1583</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> If set to 1 (default is 0), the first priority is to make use of one of the </td> </tr> <tr> <td class="h" > <a name="1584">1584</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> four C<.cmap> files for CJK fonts. This is the I<old> way of processing TTF </td> </tr> <tr> <td class="h" > <a name="1585">1585</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> files. If, after all is said and done, a working I<internal> CMap hasn't been </td> </tr> <tr> <td class="h" > <a name="1586">1586</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> found (for usecmf=>0), C<ttfont()> will fall back to using a C<.cmap> file </td> </tr> <tr> <td class="h" > <a name="1587">1587</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> if possible. </td> </tr> <tr> <td class="h" > <a name="1588">1588</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1589">1589</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =item cmaps </td> </tr> <tr> <td class="h" > <a name="1590">1590</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1591">1591</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> This flag may be set to a string listing the Platform/Encoding pairs to look </td> </tr> <tr> <td class="h" > <a name="1592">1592</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> for of any internal CMaps in the font file, in the desired order (highest </td> </tr> <tr> <td class="h" > <a name="1593">1593</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> priority first). If one list (comma and/or space-separated pairs) is given, it </td> </tr> <tr> <td class="h" > <a name="1594">1594</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> is used for both Windows and non-Windows platforms (on which PDF::Builder is </td> </tr> <tr> <td class="h" > <a name="1595">1595</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> running, I<not> the PDF reader's). Two lists, separated by a semicolon ; may be </td> </tr> <tr> <td class="h" > <a name="1596">1596</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> given, with the first being used for a Windows platform and the second for </td> </tr> <tr> <td class="h" > <a name="1597">1597</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> non-Windows. The default list is C<0/6 3/10 0/4 3/1 0/3; 0/6 0/4 3/10 0/3 3/1>. </td> </tr> <tr> <td class="h" > <a name="1598">1598</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Finally, instead of a P/E list, a string C<find_ms> may be given to tell it to </td> </tr> <tr> <td class="h" > <a name="1599">1599</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> simply call the Font::TTF C<find_ms()> method to find a (preferably Windows) </td> </tr> <tr> <td class="h" > <a name="1600">1600</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> internal CMap. C<cmaps> set to 'find_ms' would emulate the I<old> way of </td> </tr> <tr> <td class="h" > <a name="1601">1601</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> looking for CMaps. Symbol fonts (3/0) always use find_ms(), and the new default </td> </tr> <tr> <td class="h" > <a name="1602">1602</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> lookup is (if C<.cmap> isn't used, see C<usecmf>) to try to get a match with </td> </tr> <tr> <td class="h" > <a name="1603">1603</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> the default list for the appropriate OS. If none can be found, find_ms() is </td> </tr> <tr> <td class="h" > <a name="1604">1604</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> tried, and as last resort use the C<.cmap> (if available), even if C<usecmf> </td> </tr> <tr> <td class="h" > <a name="1605">1605</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> is not 1. </td> </tr> <tr> <td class="h" > <a name="1606">1606</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1607">1607</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =back </td> </tr> <tr> <td class="h" > <a name="1608">1608</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1609">1609</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =head3 CJK Fonts </td> </tr> <tr> <td class="h" > <a name="1610">1610</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1611">1611</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> B<Examples:> </td> </tr> <tr> <td class="h" > <a name="1612">1612</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1613">1613</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $font = $pdf->cjkfont('korean'); </td> </tr> <tr> <td class="h" > <a name="1614">1614</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $font = $pdf->cjkfont('traditional'); </td> </tr> <tr> <td class="h" > <a name="1615">1615</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1616">1616</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Valid %options are: </td> </tr> <tr> <td class="h" > <a name="1617">1617</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1618">1618</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =over </td> </tr> <tr> <td class="h" > <a name="1619">1619</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1620">1620</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =item encode </td> </tr> <tr> <td class="h" > <a name="1621">1621</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1622">1622</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Changes the encoding of the font from its default. </td> </tr> <tr> <td class="h" > <a name="1623">1623</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1624">1624</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =back </td> </tr> <tr> <td class="h" > <a name="1625">1625</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1626">1626</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> B<Warning:> Unlike C<ttfont>, the font file is I<not> embedded in the output </td> </tr> <tr> <td class="h" > <a name="1627">1627</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> PDF file. This is </td> </tr> <tr> <td class="h" > <a name="1628">1628</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> evidently behavior left over from the early days of CJK fonts, where the </td> </tr> <tr> <td class="h" > <a name="1629">1629</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> C<Cmap> and C<Data> were always external files, rather than internal tables. </td> </tr> <tr> <td class="h" > <a name="1630">1630</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> If you need a CJK-using PDF file to embed the font, for portability, you can </td> </tr> <tr> <td class="h" > <a name="1631">1631</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> create a PDF using C<cjkfont>, and then use an external utility (e.g., </td> </tr> <tr> <td class="h" > <a name="1632">1632</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> C<pdfcairo>) to embed the font in the PDF. It may also be possible to use </td> </tr> <tr> <td class="h" > <a name="1633">1633</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> C<ttfont> instead, to produce the PDF, provided you can deduce the correct </td> </tr> <tr> <td class="h" > <a name="1634">1634</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> font file name from examining the PDF file (e.g., on my Windows system, the </td> </tr> <tr> <td class="h" > <a name="1635">1635</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> "Ming" font would be C<< $font = $pdf->ttfont("C:/Program Files/Adobe/Acrobat DC/Resource/CIDFont/AdobeMingStd-Light.otf") >>. </td> </tr> <tr> <td class="h" > <a name="1636">1636</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Of course, the font file used would have to be C<.ttf> or C<.otf>. </td> </tr> <tr> <td class="h" > <a name="1637">1637</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> It may act a little differently than C<cjkfont> (due a a different Cmap), but </td> </tr> <tr> <td class="h" > <a name="1638">1638</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> you I<should> be able to embed the font file into the PDF. </td> </tr> <tr> <td class="h" > <a name="1639">1639</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1640">1640</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> See also L<PDF::Builder::Resource::CIDFont::CJKFont> </td> </tr> <tr> <td class="h" > <a name="1641">1641</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1642">1642</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =head3 Synthetic Fonts </td> </tr> <tr> <td class="h" > <a name="1643">1643</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1644">1644</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> B<Warning:> BaseEncoding is I<not> set by default for these fonts, so text </td> </tr> <tr> <td class="h" > <a name="1645">1645</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> in the PDF isn't searchable (by the PDF reader) unless a ToUnicode CMap is </td> </tr> <tr> <td class="h" > <a name="1646">1646</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> included. A ToUnicode CMap I<is> included by default (unicodemap set to 1) by </td> </tr> <tr> <td class="h" > <a name="1647">1647</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> PDF::Builder, but allows it to be disabled (for performance and file size </td> </tr> <tr> <td class="h" > <a name="1648">1648</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> reasons) by setting unicodemap to 0. This will produce non-searchable text, </td> </tr> <tr> <td class="h" > <a name="1649">1649</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> which, besides being annoying to users, may prevent screen </td> </tr> <tr> <td class="h" > <a name="1650">1650</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> readers and other aids to disabled users from working correctly! </td> </tr> <tr> <td class="h" > <a name="1651">1651</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1652">1652</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> B<Examples:> </td> </tr> <tr> <td class="h" > <a name="1653">1653</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1654">1654</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $cf = $pdf->corefont('Times-Roman', encode => 'latin1'); </td> </tr> <tr> <td class="h" > <a name="1655">1655</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $sf = $pdf->synfont($cf, condense => 0.85); # compressed 85% </td> </tr> <tr> <td class="h" > <a name="1656">1656</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $sfb = $pdf->synfont($cf, bold => 1); # embolden by 10em </td> </tr> <tr> <td class="h" > <a name="1657">1657</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $sfi = $pdf->synfont($cf, oblique => -12); # italic at -12 degrees </td> </tr> <tr> <td class="h" > <a name="1658">1658</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1659">1659</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Valid %options are: </td> </tr> <tr> <td class="h" > <a name="1660">1660</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1661">1661</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =over </td> </tr> <tr> <td class="h" > <a name="1662">1662</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1663">1663</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =item condense </td> </tr> <tr> <td class="h" > <a name="1664">1664</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1665">1665</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Character width condense/expand factor (0.1-0.9 = condense, 1 = normal/default, </td> </tr> <tr> <td class="h" > <a name="1666">1666</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> 1.1+ = expand). It is the multiplier to apply to the width of each character. </td> </tr> <tr> <td class="h" > <a name="1667">1667</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1668">1668</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =item oblique </td> </tr> <tr> <td class="h" > <a name="1669">1669</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1670">1670</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Italic angle (+/- degrees, default 0), sets B<skew> of character box. </td> </tr> <tr> <td class="h" > <a name="1671">1671</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1672">1672</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =item bold </td> </tr> <tr> <td class="h" > <a name="1673">1673</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1674">1674</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Emboldening factor (0.1+, bold = 1, heavy = 2, ...), additional thickness to </td> </tr> <tr> <td class="h" > <a name="1675">1675</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> draw outline of character (with a heavier B<line width>) before filling. </td> </tr> <tr> <td class="h" > <a name="1676">1676</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1677">1677</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =item space </td> </tr> <tr> <td class="h" > <a name="1678">1678</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1679">1679</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Additional character spacing in milliems (0-1000) </td> </tr> <tr> <td class="h" > <a name="1680">1680</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1681">1681</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =item caps </td> </tr> <tr> <td class="h" > <a name="1682">1682</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1683">1683</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> 0 for normal text, 1 for small caps. </td> </tr> <tr> <td class="h" > <a name="1684">1684</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Implemented by asking the font what the uppercased translation (single </td> </tr> <tr> <td class="h" > <a name="1685">1685</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> character) is for a given character, and outputting it at 80% height and </td> </tr> <tr> <td class="h" > <a name="1686">1686</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> 88% width (heavier vertical stems are better looking than a straight 80% </td> </tr> <tr> <td class="h" > <a name="1687">1687</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> scale). </td> </tr> <tr> <td class="h" > <a name="1688">1688</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1689">1689</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Note that only lower case letters which appear in the "standard" font (plane 0 </td> </tr> <tr> <td class="h" > <a name="1690">1690</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> for core fonts and PS fonts) will be small-capped. This may include eszett </td> </tr> <tr> <td class="h" > <a name="1691">1691</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> (German sharp s), which becomes SS, and dotless i and j which become I and J </td> </tr> <tr> <td class="h" > <a name="1692">1692</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> respectively. There are many other accented Latin alphabet letters which I<may> </td> </tr> <tr> <td class="h" > <a name="1693">1693</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> show up in planes 1 and higher. Ligatures (e.g., ij and ffl) do not have </td> </tr> <tr> <td class="h" > <a name="1694">1694</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> uppercase equivalents, nor does a long s. If you have text which includes such </td> </tr> <tr> <td class="h" > <a name="1695">1695</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> characters, you may want to consider preprocessing it to replace them with </td> </tr> <tr> <td class="h" > <a name="1696">1696</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Latin character expansions (e.g., i+j and f+f+l) before small-capping. </td> </tr> <tr> <td class="h" > <a name="1697">1697</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1698">1698</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =back </td> </tr> <tr> <td class="h" > <a name="1699">1699</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1700">1700</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Note that I<CJK> fonts (created with the C<cjkfont> method) do B<not> work </td> </tr> <tr> <td class="h" > <a name="1701">1701</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> properly with C<synfont>. This is due to a different internal structure of the </td> </tr> <tr> <td class="h" > <a name="1702">1702</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> I<CJK> fonts, as compared to I<corefont>, I<ttfont>, and I<psfont> base fonts. </td> </tr> <tr> <td class="h" > <a name="1703">1703</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> If you require a synthesized (modified) CJK font, you might try finding the </td> </tr> <tr> <td class="h" > <a name="1704">1704</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> TTF or OTF original, use C<ttfont> to create the base font, and running </td> </tr> <tr> <td class="h" > <a name="1705">1705</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> C<synfont> against that, in the manner described for embedding L</CJK Fonts>. </td> </tr> <tr> <td class="h" > <a name="1706">1706</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1707">1707</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> See also L<PDF::Builder::Resource::Font::SynFont> </td> </tr> <tr> <td class="h" > <a name="1708">1708</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1709">1709</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =head2 IMAGE METHODS </td> </tr> <tr> <td class="h" > <a name="1710">1710</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1711">1711</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> This is additional information on enhanced libraries available for TIFF and </td> </tr> <tr> <td class="h" > <a name="1712">1712</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> PNG images. See specific information listings for GD, GIF, JPEG, and PNM image </td> </tr> <tr> <td class="h" > <a name="1713">1713</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> formats. In addition, see C<examples/Content.pl> for an example of placing an </td> </tr> <tr> <td class="h" > <a name="1714">1714</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> image on a page, as well as using in a "Form". </td> </tr> <tr> <td class="h" > <a name="1715">1715</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1716">1716</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =head3 Why is my image flipped or rotated? </td> </tr> <tr> <td class="h" > <a name="1717">1717</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1718">1718</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Something not uncommonly seen when using JPEG photos in a PDF is that the </td> </tr> <tr> <td class="h" > <a name="1719">1719</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> images will be rotated and/or mirrored (flipped). This may happen when using </td> </tr> <tr> <td class="h" > <a name="1720">1720</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> TIFF images too. What happens is that the camera stores an image just as it </td> </tr> <tr> <td class="h" > <a name="1721">1721</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> comes off the CCD sensor, regardless of the camera orientation, and does not </td> </tr> <tr> <td class="h" > <a name="1722">1722</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> rotate it to the correct orientation! It I<does> store a separate </td> </tr> <tr> <td class="h" > <a name="1723">1723</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> "orientation" flag to suggest how the image might be corrected, but not all </td> </tr> <tr> <td class="h" > <a name="1724">1724</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> image processing obeys this flag (PDF::Builder does B<not>.). For example, if </td> </tr> <tr> <td class="h" > <a name="1725">1725</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> you take a "portrait" (tall) photo of a tree (with the phone held vertically), </td> </tr> <tr> <td class="h" > <a name="1726">1726</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> and then use it in a PDF, the tree may appear to have been cut down! (appears </td> </tr> <tr> <td class="h" > <a name="1727">1727</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> in landscape mode) </td> </tr> <tr> <td class="h" > <a name="1728">1728</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1729">1729</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> I have found some code that should allow the C<image_jpeg> or C<image> routine </td> </tr> <tr> <td class="h" > <a name="1730">1730</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> to auto-rotate to (supposedly) the correct orientation, by looking for the Exif </td> </tr> <tr> <td class="h" > <a name="1731">1731</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> metadata "Orientation" tag in the file. However, three problems arise: </td> </tr> <tr> <td class="h" > <a name="1732">1732</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> B<1)> if a photo has been edited, and rotated or flipped in the process, there is no guarantee that the Orientation tag has been corrected. </td> </tr> <tr> <td class="h" > <a name="1733">1733</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> B<2)> more than one Orientation tag may exist (e.g., in the binary APP1/Exif header, I<and> in XML data), and they may not agree with each other -- which should be used? </td> </tr> <tr> <td class="h" > <a name="1734">1734</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> B<3)> the code would need to uncompress the raster data, swap and/or transpose rows and/or columns, and recompress the raster data for inclusion into the PDF. This is costly and error-prone. </td> </tr> <tr> <td class="h" > <a name="1735">1735</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> In any case, the user would need to be able to override any auto-rotate function. </td> </tr> <tr> <td class="h" > <a name="1736">1736</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1737">1737</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> For the time being, PDF::Builder will simply leave it up to the user of the </td> </tr> <tr> <td class="h" > <a name="1738">1738</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> library to take care of rotating and/or flipping an image which displays </td> </tr> <tr> <td class="h" > <a name="1739">1739</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> incorrectly. It is possible that we will consider adding some sort of query or warning that the image appears to I<not> be "normally" oriented (Orientation value 1 or "Top-left"), according to the Orientation flag. You can consider either (re-)saving the photo in an editor such as PhotoShop or GIMP, or using PDF::Builder code similar to the following (for images rotated 180 degrees): </td> </tr> <tr> <td class="h" > <a name="1740">1740</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1741">1741</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $pW = 612; $pH = 792; # page dimensions (US Letter) </td> </tr> <tr> <td class="h" > <a name="1742">1742</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> my $img = $pdf->image_jpeg("AliceLake.jpeg"); </td> </tr> <tr> <td class="h" > <a name="1743">1743</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # raw size WxH 4032x3024, scaled down to 504x378 </td> </tr> <tr> <td class="h" > <a name="1744">1744</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $sW = 4032/8; $sH = 3024/8; </td> </tr> <tr> <td class="h" > <a name="1745">1745</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # intent is to center on US Letter sized page (LL at 54,207) </td> </tr> <tr> <td class="h" > <a name="1746">1746</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # Orientation flag on this image is 3 (rotated 180 degrees). </td> </tr> <tr> <td class="h" > <a name="1747">1747</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # if naively displayed (just $gfx->image call), it will be upside down </td> </tr> <tr> <td class="h" > <a name="1748">1748</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1749">1749</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $gfx->save(); </td> </tr> <tr> <td class="h" > <a name="1750">1750</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="1751">1751</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## method 0: simple display, is rotated 180 degrees! </td> </tr> <tr> <td class="h" > <a name="1752">1752</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> #$gfx->image($img, ($pW-$sW)/2,($pH-$sH)/2, $sW,$sH); </td> </tr> <tr> <td class="h" > <a name="1753">1753</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1754">1754</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## method 1: translate, then rotate </td> </tr> <tr> <td class="h" > <a name="1755">1755</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> #$gfx->translate($pW,$pH); # to new origin (media UR corner) </td> </tr> <tr> <td class="h" > <a name="1756">1756</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> #$gfx->rotate(180); # rotate around new origin </td> </tr> <tr> <td class="h" > <a name="1757">1757</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> #$gfx->image($img, ($pW-$sW)/2,($pH-$sH)/2, $sW,$sH); </td> </tr> <tr> <td class="h" > <a name="1758">1758</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # image's UR corner, not LL </td> </tr> <tr> <td class="h" > <a name="1759">1759</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1760">1760</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # method 2: rotate, then translate </td> </tr> <tr> <td class="h" > <a name="1761">1761</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $gfx->rotate(180); # rotate around current origin </td> </tr> <tr> <td class="h" > <a name="1762">1762</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $gfx->translate(-$sW,-$sH); # translate in rotated coordinates </td> </tr> <tr> <td class="h" > <a name="1763">1763</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $gfx->image($img, -($pW-$sW)/2,-($pH-$sH)/2, $sW,$sH); </td> </tr> <tr> <td class="h" > <a name="1764">1764</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # image's UR corner, not LL </td> </tr> <tr> <td class="h" > <a name="1765">1765</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1766">1766</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ## method 3: flip (mirror) twice </td> </tr> <tr> <td class="h" > <a name="1767">1767</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> #$scale = 1; # not rescaling here </td> </tr> <tr> <td class="h" > <a name="1768">1768</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> #$size_page = $pH/$scale; </td> </tr> <tr> <td class="h" > <a name="1769">1769</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> #$invScale = 1.0/$scale; </td> </tr> <tr> <td class="h" > <a name="1770">1770</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> #$gfx->add("-$invScale 0 0 -$invScale 0 $size_page cm"); </td> </tr> <tr> <td class="h" > <a name="1771">1771</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> #$gfx->image($img, -($pW-$sW)/2-$sW,($pH-$sH)/2, $sW,$sH); </td> </tr> <tr> <td class="h" > <a name="1772">1772</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1773">1773</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $gfx->restore(); </td> </tr> <tr> <td class="h" > <a name="1774">1774</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1775">1775</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> If your image is also mirrored (flipped about an axis), simple rotation will </td> </tr> <tr> <td class="h" > <a name="1776">1776</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> not suffice. You could do something with a reversal of the coordinate system, as in "method 3" above (see L<PDF::Builder::Content/Advanced Methods>). To mirror only left/right, the second C<$invScale> would be positive; to mirror only top/bottom, the first would be positive. If all else fails, you could save a mirrored copy in a photo editor. </td> </tr> <tr> <td class="h" > <a name="1777">1777</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> 90 or 270 degree rotations will require a C<rotate> call, possibly with "cm" usage to reverse mirroring. </td> </tr> <tr> <td class="h" > <a name="1778">1778</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Incidentally, do not confuse this issue with the coordinate flipping performed </td> </tr> <tr> <td class="h" > <a name="1779">1779</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> by some Chrome browsers when printing a page to PDF. </td> </tr> <tr> <td class="h" > <a name="1780">1780</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1781">1781</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Note that TIFF images may have the same rotation/mirroring problems as JPEG, </td> </tr> <tr> <td class="h" > <a name="1782">1782</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> which is not surprising, as the Exif format was lifted from TIFF for use in </td> </tr> <tr> <td class="h" > <a name="1783">1783</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> JPEG. The cure will be similar to JPEG's. </td> </tr> <tr> <td class="h" > <a name="1784">1784</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1785">1785</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =head3 TIFF Images </td> </tr> <tr> <td class="h" > <a name="1786">1786</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1787">1787</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Note that the Graphics::TIFF support library does B<not> currently permit a </td> </tr> <tr> <td class="h" > <a name="1788">1788</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> filehandle for C<$file>. </td> </tr> <tr> <td class="h" > <a name="1789">1789</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1790">1790</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> PDF::Builder will use the Graphics::TIFF support library for TIFF functions, if </td> </tr> <tr> <td class="h" > <a name="1791">1791</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> it is available, unless explicitly told not to. Your code can test whether </td> </tr> <tr> <td class="h" > <a name="1792">1792</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Graphics::TIFF is available by examining C<< $tiff->usesLib() >> or </td> </tr> <tr> <td class="h" > <a name="1793">1793</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> C<< $pdf->LA_GT() >>. </td> </tr> <tr> <td class="h" > <a name="1794">1794</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1795">1795</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =over </td> </tr> <tr> <td class="h" > <a name="1796">1796</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1797">1797</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =item = -1 </td> </tr> <tr> <td class="h" > <a name="1798">1798</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1799">1799</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Graphics::TIFF I<is> installed, but your code has specified C<nouseGT>, to </td> </tr> <tr> <td class="h" > <a name="1800">1800</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> I<not> use it. The old, pure Perl, code (buggy!) will be used instead, as if </td> </tr> <tr> <td class="h" > <a name="1801">1801</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Graphics::TIFF was not installed. </td> </tr> <tr> <td class="h" > <a name="1802">1802</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1803">1803</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =item = 0 </td> </tr> <tr> <td class="h" > <a name="1804">1804</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1805">1805</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Graphics::TIFF is I<not> installed. Not all systems are able to successfully </td> </tr> <tr> <td class="h" > <a name="1806">1806</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> install this package, as it requires libtiff.a. </td> </tr> <tr> <td class="h" > <a name="1807">1807</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1808">1808</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =item = 1 </td> </tr> <tr> <td class="h" > <a name="1809">1809</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1810">1810</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Graphics::TIFF is installed and is being used. </td> </tr> <tr> <td class="h" > <a name="1811">1811</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1812">1812</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =back </td> </tr> <tr> <td class="h" > <a name="1813">1813</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1814">1814</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Options: </td> </tr> <tr> <td class="h" > <a name="1815">1815</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1816">1816</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =over </td> </tr> <tr> <td class="h" > <a name="1817">1817</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1818">1818</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =item nouseGT => 1 </td> </tr> <tr> <td class="h" > <a name="1819">1819</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1820">1820</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Do B<not> use the Graphics::TIFF library, even if it's available. Normally </td> </tr> <tr> <td class="h" > <a name="1821">1821</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> you I<would> want to use this library, but there may be cases where you don't, </td> </tr> <tr> <td class="h" > <a name="1822">1822</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> such as when you want to use a file I<handle> instead of a I<name>. </td> </tr> <tr> <td class="h" > <a name="1823">1823</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1824">1824</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =item silent => 1 </td> </tr> <tr> <td class="h" > <a name="1825">1825</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1826">1826</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Do not give the message that Graphics::TIFF is not B<installed>. This message </td> </tr> <tr> <td class="h" > <a name="1827">1827</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> will be given only once, but you may want to suppress it, such as during </td> </tr> <tr> <td class="h" > <a name="1828">1828</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> t-tests. </td> </tr> <tr> <td class="h" > <a name="1829">1829</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1830">1830</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =back </td> </tr> <tr> <td class="h" > <a name="1831">1831</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1832">1832</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =head3 PNG Images </td> </tr> <tr> <td class="h" > <a name="1833">1833</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1834">1834</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> PDF::Builder will use the Image::PNG::Libpng support library for PNG functions, </td> </tr> <tr> <td class="h" > <a name="1835">1835</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> if it is available, unless explicitly told not to. Your code can test whether </td> </tr> <tr> <td class="h" > <a name="1836">1836</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Image::PNG::Libpng is available by examining C<< $png->usesLib() >> or </td> </tr> <tr> <td class="h" > <a name="1837">1837</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> C<< $pdf->LA_IPL() >>. </td> </tr> <tr> <td class="h" > <a name="1838">1838</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1839">1839</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =over </td> </tr> <tr> <td class="h" > <a name="1840">1840</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1841">1841</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =item = -1 </td> </tr> <tr> <td class="h" > <a name="1842">1842</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1843">1843</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Image::PNG::Libpng I<is> installed, but your code has specified C<nouseIPL>, </td> </tr> <tr> <td class="h" > <a name="1844">1844</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> to I<not> use it. The old, pure Perl, code (slower and less capable) will be </td> </tr> <tr> <td class="h" > <a name="1845">1845</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> used instead, as if Image::PNG::Libpng was not installed. </td> </tr> <tr> <td class="h" > <a name="1846">1846</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1847">1847</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =item = 0 </td> </tr> <tr> <td class="h" > <a name="1848">1848</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1849">1849</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Image::PNG::Libpng is I<not> installed. Not all systems are able to successfully </td> </tr> <tr> <td class="h" > <a name="1850">1850</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> install this package, as it requires libpng.a. </td> </tr> <tr> <td class="h" > <a name="1851">1851</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1852">1852</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =item = 1 </td> </tr> <tr> <td class="h" > <a name="1853">1853</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1854">1854</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Image::PNG::Libpng is installed and is being used. </td> </tr> <tr> <td class="h" > <a name="1855">1855</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1856">1856</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =back </td> </tr> <tr> <td class="h" > <a name="1857">1857</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1858">1858</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Options: </td> </tr> <tr> <td class="h" > <a name="1859">1859</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1860">1860</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =over </td> </tr> <tr> <td class="h" > <a name="1861">1861</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1862">1862</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =item nouseIPL => 1 </td> </tr> <tr> <td class="h" > <a name="1863">1863</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1864">1864</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Do B<not> use the Image::PNG::Libpng library, even if it's available. Normally </td> </tr> <tr> <td class="h" > <a name="1865">1865</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> you I<would> want to use this library, when available, but there may be cases </td> </tr> <tr> <td class="h" > <a name="1866">1866</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> where you don't. </td> </tr> <tr> <td class="h" > <a name="1867">1867</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1868">1868</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =item silent => 1 </td> </tr> <tr> <td class="h" > <a name="1869">1869</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1870">1870</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Do not give the message that Image::PNG::Libpng is not B<installed>. This </td> </tr> <tr> <td class="h" > <a name="1871">1871</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> message will be given only once, but you may want to suppress it, such as </td> </tr> <tr> <td class="h" > <a name="1872">1872</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> during t-tests. </td> </tr> <tr> <td class="h" > <a name="1873">1873</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1874">1874</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =item notrans => 1 </td> </tr> <tr> <td class="h" > <a name="1875">1875</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1876">1876</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> No transparency -- ignore tRNS chunk if provided, ignore Alpha channel if </td> </tr> <tr> <td class="h" > <a name="1877">1877</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> provided. </td> </tr> <tr> <td class="h" > <a name="1878">1878</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1879">1879</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =back </td> </tr> <tr> <td class="h" > <a name="1880">1880</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1881">1881</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =head2 USING SHAPER (HarfBuzz::Shaper library) </td> </tr> <tr> <td class="h" > <a name="1882">1882</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1883">1883</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # if HarfBuzz::Shaper is not installed, either bail out, or try to </td> </tr> <tr> <td class="h" > <a name="1884">1884</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # use regular TTF calls instead </td> </tr> <tr> <td class="h" > <a name="1885">1885</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> my $rc; </td> </tr> <tr> <td class="h" > <a name="1886">1886</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $rc = eval { </td> </tr> <tr> <td class="h" > <a name="1887">1887</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> require HarfBuzz::Shaper; </td> </tr> <tr> <td class="h" > <a name="1888">1888</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> 1; </td> </tr> <tr> <td class="h" > <a name="1889">1889</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> }; </td> </tr> <tr> <td class="h" > <a name="1890">1890</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> if (!defined $rc) { $rc = 0; } </td> </tr> <tr> <td class="h" > <a name="1891">1891</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> if ($rc == 0) { </td> </tr> <tr> <td class="h" > <a name="1892">1892</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # bail out in some manner </td> </tr> <tr> <td class="h" > <a name="1893">1893</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } else { </td> </tr> <tr> <td class="h" > <a name="1894">1894</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # can use Shaper </td> </tr> <tr> <td class="h" > <a name="1895">1895</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="1896">1896</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1897">1897</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> my $fontfile = '/WINDOWS/Fonts/times.ttf'; # used by both Shaper and textHS </td> </tr> <tr> <td class="h" > <a name="1898">1898</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> my $fontsize = 15; # used by both Shaper and textHS </td> </tr> <tr> <td class="h" > <a name="1899">1899</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> my $font = $pdf->ttfont($fontfile); </td> </tr> <tr> <td class="h" > <a name="1900">1900</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $text->font($font, $fontsize); </td> </tr> <tr> <td class="h" > <a name="1901">1901</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> </td> </tr> <tr> <td class="h" > <a name="1902">1902</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> my $hb = HarfBuzz::Shaper->new(); # only need to set up once </td> </tr> <tr> <td class="h" > <a name="1903">1903</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> my %settings; # for textHS(), not Shaper </td> </tr> <tr> <td class="h" > <a name="1904">1904</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $settings{'dump'} = 1; # see the diagnostics </td> </tr> <tr> <td class="h" > <a name="1905">1905</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $settings{'script'} = 'Latn'; </td> </tr> <tr> <td class="h" > <a name="1906">1906</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $settings('dir'} = 'L'; # LTR </td> </tr> <tr> <td class="h" > <a name="1907">1907</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $settings{'features'} = (); # required </td> </tr> <tr> <td class="h" > <a name="1908">1908</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1909">1909</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # -- set language (override automatic setting) </td> </tr> <tr> <td class="h" > <a name="1910">1910</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> #$settings{'language'} = 'en'; </td> </tr> <tr> <td class="h" > <a name="1911">1911</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> #$hb->set_language( 'en_US' ); </td> </tr> <tr> <td class="h" > <a name="1912">1912</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # -- turn OFF ligatures </td> </tr> <tr> <td class="h" > <a name="1913">1913</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> #push @{ $settings{'features'} }, 'liga'; </td> </tr> <tr> <td class="h" > <a name="1914">1914</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> #$hb->add_features( 'liga' ); </td> </tr> <tr> <td class="h" > <a name="1915">1915</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # -- turn OFF kerning </td> </tr> <tr> <td class="h" > <a name="1916">1916</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> #push @{ $settings{'features'} }, 'kern'; </td> </tr> <tr> <td class="h" > <a name="1917">1917</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> #$hb->add_features( 'kern' ); </td> </tr> <tr> <td class="h" > <a name="1918">1918</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $hb->set_font($fontfile); </td> </tr> <tr> <td class="h" > <a name="1919">1919</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $hb->set_size($fontsize); </td> </tr> <tr> <td class="h" > <a name="1920">1920</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $hb->set_text("Let's eat waffles in the field for brunch."); </td> </tr> <tr> <td class="h" > <a name="1921">1921</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # expect ffl and fi ligatures, and perhaps some kerning </td> </tr> <tr> <td class="h" > <a name="1922">1922</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1923">1923</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> my $info = $hb->shaper(); </td> </tr> <tr> <td class="h" > <a name="1924">1924</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> $text->textHS($info, \%settings); # strikethru, underline allowed </td> </tr> <tr> <td class="h" > <a name="1925">1925</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1926">1926</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> The package HarfBuzz::Shaper may be optionally installed in order to use the </td> </tr> <tr> <td class="h" > <a name="1927">1927</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> text-shaping capabilities of the HarfBuzz library. These include kerning and </td> </tr> <tr> <td class="h" > <a name="1928">1928</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ligatures in Western scripts (such as the Latin alphabet). More complex scripts </td> </tr> <tr> <td class="h" > <a name="1929">1929</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> can be handled, such as Arabic family and Indic scripts, where multiple forms </td> </tr> <tr> <td class="h" > <a name="1930">1930</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> of a character may be automatically selected, characters may be reordered, and </td> </tr> <tr> <td class="h" > <a name="1931">1931</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> other modifications made. The examples/HarfBuzz.pl script gives some examples </td> </tr> <tr> <td class="h" > <a name="1932">1932</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> of what may be done. </td> </tr> <tr> <td class="h" > <a name="1933">1933</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1934">1934</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Keep in mind that HarfBuzz works only with TrueType (.ttf) and OpenType (.otf) </td> </tr> <tr> <td class="h" > <a name="1935">1935</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> font files. It will not work with PostScript (Type1), core, bitmapped, or CJK </td> </tr> <tr> <td class="h" > <a name="1936">1936</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> fonts. Not all .ttf fonts have the instructions necessary to guide HarfBuzz, </td> </tr> <tr> <td class="h" > <a name="1937">1937</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> but most proper .otf fonts do. In other words, there are no guarantees that a </td> </tr> <tr> <td class="h" > <a name="1938">1938</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> particular font file will work with Shaper! </td> </tr> <tr> <td class="h" > <a name="1939">1939</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1940">1940</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> The basic idea is to break up text into "chunks" which are of the same script </td> </tr> <tr> <td class="h" > <a name="1941">1941</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> (alphabet), language, direction, font face, font size, and variant (italic, </td> </tr> <tr> <td class="h" > <a name="1942">1942</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> bold, etc.). These could range from a single character to paragraph-length </td> </tr> <tr> <td class="h" > <a name="1943">1943</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> strings of text. These are fed to HarfBuzz::Shaper, along with flags, the font </td> </tr> <tr> <td class="h" > <a name="1944">1944</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> file to be used, and other supporting </td> </tr> <tr> <td class="h" > <a name="1945">1945</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> information, to create an array of output glyphs. Each element is a hash </td> </tr> <tr> <td class="h" > <a name="1946">1946</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> describing the glyph to be output, including its name (if available), its glyph </td> </tr> <tr> <td class="h" > <a name="1947">1947</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> ID (number) in the selected font, its x and y displacement (usually 0), and </td> </tr> <tr> <td class="h" > <a name="1948">1948</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> its "advance" x and y values, all in points. For horizontal languages (LTR and </td> </tr> <tr> <td class="h" > <a name="1949">1949</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> RTL), the y advance is normally 0 and the x advance is the font's character </td> </tr> <tr> <td class="h" > <a name="1950">1950</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> width, less any kerning amount. </td> </tr> <tr> <td class="h" > <a name="1951">1951</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1952">1952</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Shaper will attempt to figure out the script used and the text direction, based on the Unicode range; and a reasonable guess at the language used. The language </td> </tr> <tr> <td class="h" > <a name="1953">1953</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> can be overridden, but currently the script and text direction cannot be </td> </tr> <tr> <td class="h" > <a name="1954">1954</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> overridden. </td> </tr> <tr> <td class="h" > <a name="1955">1955</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1956">1956</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> B<An important note:> the number of glyphs (array elements) may not be equal to </td> </tr> <tr> <td class="h" > <a name="1957">1957</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> the number of Unicode points (characters) given in the chunk's text string! </td> </tr> <tr> <td class="h" > <a name="1958">1958</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Sometimes a character will be decomposed into several pieces (multiple glyphs); </td> </tr> <tr> <td class="h" > <a name="1959">1959</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> sometimes multiple characters may be combined into a single ligature glyph; and </td> </tr> <tr> <td class="h" > <a name="1960">1960</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> characters may be reordered (especially in Indic and Southeast Asian languages). </td> </tr> <tr> <td class="h" > <a name="1961">1961</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> As well, for Right-to-Left (bidirectional) scripts such as Hebrew and Arabic </td> </tr> <tr> <td class="h" > <a name="1962">1962</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> families, the text is output in Left-to-Right order (reversed from the input). </td> </tr> <tr> <td class="h" > <a name="1963">1963</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1964">1964</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> With due care, a Shaper array can be manipulated in code. The elements are more </td> </tr> <tr> <td class="h" > <a name="1965">1965</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> or less independent of each other, so elements can be modified, rearranged, </td> </tr> <tr> <td class="h" > <a name="1966">1966</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> inserted, or deleted. You might adjust the position of a glyph with 'dx' and </td> </tr> <tr> <td class="h" > <a name="1967">1967</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> 'dy' hash elements. The 'ax' value should be left alone, so that the wrong </td> </tr> <tr> <td class="h" > <a name="1968">1968</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> kerning isn't calculated, but you might need to adjust the "advance x" value by </td> </tr> <tr> <td class="h" > <a name="1969">1969</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> means of one of the following: </td> </tr> <tr> <td class="h" > <a name="1970">1970</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1971">1971</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =over </td> </tr> <tr> <td class="h" > <a name="1972">1972</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1973">1973</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =item B<axs> is a value to be I<substituted> for 'ax' (points) </td> </tr> <tr> <td class="h" > <a name="1974">1974</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1975">1975</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =item B<axsp> is a I<substituted> value (I<percentage>) of the original 'ax' </td> </tr> <tr> <td class="h" > <a name="1976">1976</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1977">1977</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =item B<axr> I<reduces> 'ax' by the value (points). If negative, increase 'ax' </td> </tr> <tr> <td class="h" > <a name="1978">1978</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1979">1979</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =item B<axrp> I<reduces> 'ax' by the given I<percentage>. Again, negative increases 'ax' </td> </tr> <tr> <td class="h" > <a name="1980">1980</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1981">1981</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =back </td> </tr> <tr> <td class="h" > <a name="1982">1982</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1983">1983</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> B<Caution:> a given character's glyph ID is I<not> necessarily going to be the </td> </tr> <tr> <td class="h" > <a name="1984">1984</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> same between any two fonts! For example, an ASCII space (U+0020) might be </td> </tr> <tr> <td class="h" > <a name="1985">1985</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> C<E<lt>0001E<gt>> in one font, and C<E<lt>0003E<gt>> in another font (even one </td> </tr> <tr> <td class="h" > <a name="1986">1986</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> closely related!). A U+00A0 required blank (non-breaking space) may be output </td> </tr> <tr> <td class="h" > <a name="1987">1987</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> as a regular ASCII space U+0020. Take care if you need to find a particular </td> </tr> <tr> <td class="h" > <a name="1988">1988</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> glyph in the array, especially if the number of elements don't match. Consider </td> </tr> <tr> <td class="h" > <a name="1989">1989</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> making a text string of "marker" characters (space, nbsp, hyphen, soft hyphen, </td> </tr> <tr> <td class="h" > <a name="1990">1990</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> etc.) and processing it through HarfBuzz::Shaper to get the corresponding </td> </tr> <tr> <td class="h" > <a name="1991">1991</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> glyph numbers. You may have to count spaces, say, to see where you could break </td> </tr> <tr> <td class="h" > <a name="1992">1992</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> a glyph array to fit a line. </td> </tr> <tr> <td class="h" > <a name="1993">1993</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1994">1994</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> The C<advancewidthHS()> method uses the same inputs as does C<textHS()>. </td> </tr> <tr> <td class="h" > <a name="1995">1995</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Like C<advancewidth()>, it returns the chunk length in points. Unlike </td> </tr> <tr> <td class="h" > <a name="1996">1996</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> C<advancewidth()>, you cannot override the glyph array's font, font size, etc. </td> </tr> <tr> <td class="h" > <a name="1997">1997</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="1998">1998</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Once you have your (possibly modified) array of glyphs, you feed it to the </td> </tr> <tr> <td class="h" > <a name="1999">1999</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> C<textHS()> method to render it to the page. Remember that this method handles </td> </tr> <tr> <td class="h" > <a name="2000">2000</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> only a single line of text; it does not do line splitting or fitting -- that </td> </tr> <tr> <td class="h" > <a name="2001">2001</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> I<you> currently need to do manually. For Western scripts (e.g., Latin), that </td> </tr> <tr> <td class="h" > <a name="2002">2002</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> might not be too difficult, but for other scripts that involve extensive </td> </tr> <tr> <td class="h" > <a name="2003">2003</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> modification of the raw characters, it may be quite difficult to split </td> </tr> <tr> <td class="h" > <a name="2004">2004</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> I<words>, but you still may be able to split at inter-word spaces. </td> </tr> <tr> <td class="h" > <a name="2005">2005</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="2006">2006</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> A useful, but not exhaustive, set of functions are allowed by C<textHS()> use. </td> </tr> <tr> <td class="h" > <a name="2007">2007</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Support includes direction setting (top-to-bottom and bottom-to-top directions, </td> </tr> <tr> <td class="h" > <a name="2008">2008</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> e.g., for Far Eastern languages in traditional orientation), and explicit </td> </tr> <tr> <td class="h" > <a name="2009">2009</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> script names and language (depending on what support HarfBuzz itself gives). </td> </tr> <tr> <td class="h" > <a name="2010">2010</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> B<Not yet> supported are features such as discretionary ligatures and manual </td> </tr> <tr> <td class="h" > <a name="2011">2011</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> selection of glyphs (e.g., swashes and alternate forms). </td> </tr> <tr> <td class="h" > <a name="2012">2012</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="2013">2013</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> Currently, C<textHS()> can only handle a single text string. We are looking at </td> </tr> <tr> <td class="h" > <a name="2014">2014</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> how fitting to a line length (splitting up an array) could be done, as well as </td> </tr> <tr> <td class="h" > <a name="2015">2015</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> how words might be split on hard and soft hyphens. At some point, full paragraph </td> </tr> <tr> <td class="h" > <a name="2016">2016</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> and page shaping could be possible. </td> </tr> <tr> <td class="h" > <a name="2017">2017</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="2018">2018</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> =cut </td> </tr> <tr> <td class="h" > <a name="2019">2019</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="2020">2020</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="c0" > <a href="blib-lib-PDF-Builder-Docs-pm--subroutine.html#2020-1"> 0 </a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> sub _docs { </td> </tr> <tr> <td class="h" > <a name="2021">2021</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> # dummy stub </td> </tr> <tr> <td class="h" > <a name="2022">2022</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> } </td> </tr> <tr> <td class="h" > <a name="2023">2023</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> &nbsp; </td> </tr> <tr> <td class="h" > <a name="2024">2024</a> </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td > &nbsp; </td> <td class="s"> 1; </td> </tr> </table> </body> </html>