# NAME

PDF::API2::PDF::AFont - Embedding of Adobe PFB/PFA + AFM format fonts. Inherits from PDF::API2::PDF::Dict

# METHODS

## PDF::API2::PDF::AFont->new $parent, $name, $psfile, $afmfile, $pdfname [ , $encoding [ , @glyphs ]]

Creates a new font object with given parent and name from pfb/pfa from psfile and afm from afmfile.

The $pdfname is the name that this particular font object will be referenced by throughout the PDF file. If you want to play silly games with naming, then you can write the code to do it!

The $encoding is the name of one of the encoding schemes specified in the pdf-specification (v1.3 2nd Ed.), 'latin1' or 'custom'. 'latin1' is a variant of the standard WinAnsiEncoding especially customized for iso-8859-1 (aka. iso-latin-1). If you use 'custom' as encoding, you have to supply the @glyphs array which should specify 256 glyph-names as defined by the "PostScript(R) Language Reference 3rd. Ed. -- Appendix E"

If you do not give $encoding, than the afms internal encoding is used.

If you give an unknown $encoding, the encoding defaults to WinAnsiEncoding.

Returns the new font object.

## PDF::API2::PDF::AFont->newNonEmbed $parent, $afmfile, $pdfname [ , $encoding [, @glyphs ]]

Creates a new font object with given parent and name from pfb/pfa from psfile and afm from afmfile.

All the rules for PDF::API2::PDF::AFont->new apply here, but instead of having a embedded font included in the pdf-file you only have a reference to the font included in the pdf-file. This results in far smaller filesizes, but requires the viewing/printing application to have the actual font properly installed at their platform.

Returns the new font object.

## PDF::API2::PDF::AFont->newCore $parent, $fontname, $pdfname [, $encoding [, @glyphs ]]

Creates a new font object with given parent and fontname from one of the 14 Adobe Core Fonts as supported by the Adobe PDF Reader applications versions 3.0 and up.

Valid values for fontname are:

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

All the rules of PDF::API2::PDF::AFont->newNonEmbed apply here, but don't require you to specify an afm-file since the fonts are internally supported by both the Adobe PDF Reader applications and this module.

Returns the new font object.

## $f->reencode $parentpdf $pdfname $encoding [@glyphs]

Reencodes the current font $f with encoding $encoding (optional variant @glyphs) to be used with name $pdfname.

Returns the new font object.

## $f->width($text)

Returns the width of the text in em.

($llx,$lly,$urx,$ury) = $font->bbox $text

Returns the texts bounding-box as if it were at size 1.

## $f->out_text($text)

Acknowledges the text to be output for subsetting purposes, etc.