The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

PDF::API2::Resource::BaseFont - Base class for font resources

METHODS

$font = PDF::API2::Resource::BaseFont->new $pdf, $name

Returns a font resource object.

$descriptor = $font->descrByData()

Returns the font's FontDescriptor key-structure based on the font's data.

FONT-MANAGEMENT RELATED METHODS

$name = $font->fontname()

Returns the font's name (aka. display-name).

$name = $font->altname()

Returns the font's alternative-name (aka. windows-name for a postscript font).

$name = $font->subname()

Returns the font's subname (aka. font-variant, schriftschnitt).

$name = $font->apiname()

Returns the font's name to be used internally (should be equal to $font->name).

$issymbol = $font->issymbol()

Returns the font's symbol flag.

$iscff = $font->iscff()

Returns the font's compact-font-format flag.

TYPOGRAPHY RELATED METHODS

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

Returns the font's bounding-box.

$capheight = $font->capheight()

Returns the font's capheight value.

$xheight = $font->xheight()

Returns the font's xheight value.

$missingwidth = $font->missingwidth()

Returns the font's missingwidth value.

$maxwidth = $font->maxwidth()

Returns the font's maxwidth value.

$avgwidth = $font->avgwidth()

Returns the font's avgwidth value.

$flags = $font->flags()

Returns the font's flags value.

$stemv = $font->stemv()

Returns the font's stemv value.

$stemh = $font->stemh()

Returns the font's stemh value.

$italicangle = $font->italicangle()

Returns the font's italicangle value.

$isfixedpitch = $font->isfixedpitch()

Returns the font's isfixedpitch flag.

$underlineposition = $font->underlineposition()

Returns the font's underlineposition value.

$underlinethickness = $font->underlinethickness()

Returns the font's underlinethickness value.

$ascender = $font->ascender()

Returns the font's ascender value.

$descender = $font->descender()

Returns the font's descender value.

GLYPH RELATED METHODS

@names = $font->glyphNames()

Returns the defined glyph-names of the font.

$glNum = $font->glyphNum()

Returns the number of defined glyph-names of the font.

$uni = $font->uniByGlyph $char

Returns the unicode by glyph-name.

$uni = $font->uniByEnc $char

Returns the unicode by the fonts encoding map.

$uni = $font->uniByMap $char

Returns the unicode by the fonts default map.

$char = $font->encByGlyph $glyph

Returns the character by the given glyph-name of the fonts encoding map.

$char = $font->encByUni $uni

Returns the character by the given unicode of the fonts encoding map.

$char = $font->mapByGlyph $glyph

Returns the character by the given glyph-name of the fonts default map.

$char = $font->mapByUni $uni

Returns the character by the given unicode of the fonts default map.

$name = $font->glyphByUni $unicode

Returns the glyph's name by the fonts unicode map. BEWARE: non-standard glyph-names are mapped onto the ms-symbol area (0xF000).

$name = $font->glyphByEnc $char

Returns the glyph's name by the font's encoding map.

$name = $font->glyphByMap $char

Returns the glyph's name by the font's default map.

$width = $font->wxByGlyph $glyph

Returns the glyph's width.

$width = $font->wxByUni $uni

Returns the unicode's width.

$width = $font->wxByEnc $char

Returns the character's width based on the current encoding.

$width = $font->wxByMap $char

Returns the character's width based on the font's default encoding.

$wd = $font->width $text

Returns the width of $text as if it were at size 1. BEWARE: works only correctly if a proper perl-string is used either in native or utf8 format (check utf8-flag).

@widths = $font->width_array $text

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

STRING METHODS

$utf8string = $font->utfByStr $string

Returns the utf8-string from string based on the fonts encoding map.

$string = $font->strByUtf $utf8string

Returns the encoded string from utf8-string based on the font's encoding map.

$pdfstring = $font->textByStr $text

Returns a properly formatted representation of $text for use in the PDF.