PDF::API2::cFont

PDF::API2::cFont - a perl-module providing core-font objects for both Text::PDF and PDF::API2.

SYNOPSIS

use PDF::API2;
use PDF::API2::cFont;

$api = PDF::API2->new;
...
$font = PDF::API2::cFont->new_api($api,'Helvetica', -encoding => 'latin1'); 

OR

use Text::PDF::File;
use PDF::API2::cFont;

$pdf = Text::PDF::File->new('some.pdf');
...
$font = PDF::API2::cFont->new($pdf,'Helvetica', -encoding => 'latin1', -pdfname => 'F0'); 

METHODS

$font = PDF::API2::cFont->new $pdf, $fontname, %options

Returns a corefont object.

Valid %options are:

'-encoding' ... changes the encoding of the font from its default.

'-pdfname' ... changes the reference-name of the font from its default.

On '-encoding': The natively supported encodings are 'latin1','winansi' and 'macroman'. Other Encodings are supported via PDF::API2::UniMap.

On '-pdfname': The reference-name is normally generated automatically and can be retrived via $pdfname=$font->name.

$font = PDF::API2::cFont->new_api $api, $fontname, %options

Returns a corefont object. This method is different from 'new' that it needs an PDF::API2-object rather than a Text::PDF::File-object.

$pdfstring = $font->text $text

Returns a properly formated string-representation of $text for use in the PDF.

$pdfstring = $font->text_hex $text

Returns a properly formated hex-representation of $text for use in the PDF.

$wd = $font->width $text

Returns the width of $text as if it were at size 1.

@widths = $font->width_array $text

Returns the widths of the words in $text as if they were at size 1.

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

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

$pdfname = $font->name

Returns the fonts pdfname.

$a = $font->ascent

Returns the fonts ascender value.

$d = $font->descent

Returns the fonts descender value.

$ia = $font->italicangle

Returns the fonts italicangle value.

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

Returns the fonts bounding-box.

$ch = $font->capheight

Returns the fonts capheight value.

$xh = $font->xheight

Returns the fonts xheight.

SUPPORTED FONTS

PDF::API::cFont supports the following 'Adobe Core Fonts':
Courier 
Courier-Bold
Courier-BoldOblique
Courier-Oblique
Helvetica 
Helvetica-Bold
Helvetica-BoldOblique
Helvetica-Oblique
Symbol 
Times-Bold
Times-BoldItalic
Times-Italic
Times-Roman 
ZapfDingbats
PDF::API::cFont supports the following 'Windows Fonts':
Arial
Arial,Bold
Arial,BoldItalic
Arial,Italic
BankGothic
BankGothic,Bold
BankGothic,BoldItalic
BankGothic,Italic
CourierNew
CourierNew,Bold
CourierNew,BoldItalic
CourierNew,Italic
Georgia
Georgia,Bold
Georgia,BoldItalic
Georgia,Italic
Impact
Impact,Italic
OzHandicraft
OzHandicraft,Bold
OzHandicraft,BoldItalic
OzHandicraft,Italic
TimesNewRoman
TimesNewRoman,Bold
TimesNewRoman,BoldItalic
TimesNewRoman,Italic
Trebuchet
Trebuchet,Bold
Trebuchet,BoldItalic
Trebuchet,Italic
Verdana
Verdana,Bold
Verdana,BoldItalic
Verdana,Italic
Webdings
Wingdings
PDF::API::cFont supports the following 'Unix Fonts' as aliases:
sans
sans,bold
sans,bolditalic
sans,italic
serif
serif,bold
serif,bolditalic
serif,italic
typewriter
typewriter,bold
typewriter,bolditalic
typewriter,italic
greek
bats

AUTHOR

alfred reibenschuh

4 POD Errors

The following errors were encountered while parsing the POD:

Around line 1279:

'=item' outside of any '=over'

Around line 1595:

You forgot a '=back' before '=head1'

Around line 1597:

'=item' outside of any '=over'

Around line 1670:

You forgot a '=back' before '=head1'