PDF::API2::Resource::BaseFont(3)

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

METHODS

$font = PDF::API2::Resource::BaseFont->new $pdf, $name
    Returns a font resource object.

$font = PDF::API2::Resource::BaseFont->new_api $api, $name
    Returns a font resource object. This method is different from 'new' that it needs an PDF::API2-object rather than a Text::PDF::File-object.

$descriptor = $font->descrByData()
    Returns the fonts FontDescriptor key-structure based on the fonts data.

FONT-MANAGEMENT RELATED METHODS

$name = $font->fontname()
    Returns the fonts name (aka. display-name).

$name = $font->altname()
    Returns the fonts alternative-name (aka. windows-name for a postscript font).

$name = $font->subname()
    Returns the fonts subname (aka. font-variant, schriftschnitt).

$name = $font->apiname()
    Returns the fonts name to be used internally (should be equal to $font->name).

$issymbol = $font->issymbol()
    Returns the fonts symbol flag.

$iscff = $font->iscff()
    Returns the fonts compact-font-format flag.

TYPOGRAPHY RELATED METHODS

($llx, $lly, $urx, $ury) = $font->fontbbox()
    Returns the fonts bounding-box.

$capheight = $font->capheight()
    Returns the fonts capheight value.

$xheight = $font->xheight()
    Returns the fonts xheight value.

$missingwidth = $font->missingwidth()
    Returns the fonts missingwidth value.

$maxwidth = $font->maxwidth()
    Returns the fonts maxwidth value.

$avgwidth = $font->avgwidth()
    Returns the fonts avgwidth value.

$flags = $font->flags()
    Returns the fonts flags value.

$stemv = $font->stemv()
    Returns the fonts stemv value.

$stemh = $font->stemh()
    Returns the fonts stemh value.

$italicangle = $font->italicangle()
    Returns the fonts italicangle value.

$isfixedpitch = $font->isfixedpitch()
    Returns the fonts isfixedpitch flag.

$underlineposition = $font->underlineposition()
    Returns the fonts underlineposition value.

$underlinethickness = $font->underlinethickness()
    Returns the fonts underlinethickness value.

$ascender = $font->ascender()
    Returns the fonts ascender value.

$descender = $font->descender()
    Returns the fonts 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 glyphs 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 glyphs name by the fonts encoding map.

$name = $font->glyphByMap $char
    Returns the glyphs name by the fonts default map.

$width = $font->wxByGlyph $glyph
    Returns the glyphs width.

$width = $font->wxByUni $uni
    Returns the unicodes width.

$width = $font->wxByEnc $char
    Returns the characters width based on the current encoding.

$width = $font->wxByMap $char
    Returns the characters width based on the fonts 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 fonts encoding map.

$pdfstring = $font->textByStr $text
    Returns a properly formatted representation of $text for use in the PDF.