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