Page 303 - Open Soource Technologies 304.indd
P. 303

Unit 12: Portable Document Format



                                                                                                  Notes
                           Figure 12.5: Lining, Stroking, Filling, and Coloring Text







                                     Overlined Text
                                     Underlined Text
                                     Underlined strikeout Text
                                     Red Text
                                     Green Outlined Text
                                     Green Outlined Blue Text
















            12.3.4 Fonts
            There are 14 built-in fonts in PDF, as listed in Table 12.3. If you use only these fonts, the documents
            you create will be smaller and more portable than if you use nonstandard fonts.

                                     Table 12.3: Standard PDF Fonts

                Courier      Courier-Bold      Courier-BoldOblique  Courier-Oblique

                Helvetica    Helvetica-Bold    Helvetica-BoldOblique  Helvetica-Oblique
                Times-Bold   Times-BoldItalic  Times-Italic         Times-Roman
                Symbol       ZapfDingbats

            You can select a font with the pdf_findfont( ) function:
            $font = pdf_findfont(pdf, fontname, encoding, embed);
            The encoding parameter indicates how the internal numeric codes for characters map onto the
            font’s characters. The built-in encodings are “winansi” (Windows, a superset of ISO 8859-1, which
            is itself a superset of ASCII), “macroman” (Macintosh), “ebcdic” (IBM mainframe), “builtin” (for
            symbol fonts), and “host” (“macroman” on the Mac, “ebcdic” on EBCDIC-based systems, and
            “winansi” on everything else). When using built-in fonts, stick to “host”.
            You can load nonstandard fonts if you have the PostScript font metrics or TrueType files. If you
            want to embed the nonstandard fonts in the PDF file, rather than using whatever fonts on the
            viewer’s system most resemble them, set the embed parameter to 1. You do not need to embed
            the standard fonts.
            Using nonstandard fonts without embedding them makes your documents much less portable,
            while embedding them makes your generated PDF files much larger. TrueType font files have
            an indicator that is set if the font should not be embedded. This is honored by pdflib, which
            produces an error if you try to embed such a font.



                                             LOVELY PROFESSIONAL UNIVERSITY                                   297
   298   299   300   301   302   303   304   305   306   307   308