Text::PDF::TTFont(3) User Contributed Perl Documentation Text::PDF::TTFont(3)

# [NAME](#NAME)

Text::PDF::TTFont - Inherits from Text::PDF::Dict and represents a TrueType font within a PDF file.

# [DESCRIPTION](#DESCRIPTION)

A font consists of two primary parts in a PDF file: the header and the font descriptor. Whilst two fonts may share font descriptors, they will have their own header dictionaries including encoding and widhth information.

# [INSTANCE VARIABLES](#INSTANCE_VARIABLES)

There are no instance variables beyond the variables which directly correspond to entries in the appropriate PDF dictionaries.

# [METHODS](#METHODS)

## [Text::PDF::TTFont-&gt;new($parent, $fontfname, $pdfname, %opts)](#Text::PDF::TTFont)

Creates a new font resource for the given fontfile. This includes the font descriptor and the font stream. The $pdfname is the name by which this font resource will be known throughtout a particular PDF file.

All font resources are full PDF objects.

## [$t-&gt;width($text)](#$t)

Measures the width of the given text according to the widths in the font

## $t-&gt;trim($text, $len)

Trims the given text to the given length (in per mille em) returning the trimmed text

## [$t-&gt;out\_text($text)](#$t~2)

Indicates to the font that the text is to be output and returns the text to be output

## [$f-&gt;copy](#$f)

Copies the font object excluding the name, widths and encoding, etc.

# [TITLE](#TITLE)

Text::PDF::TTIOString - internal IO type handle for string output for font embedding. This code is ripped out of IO::Scalar, to save the direct dependence for so little. See IO::Scalar for details

2026-10-03 perl v5.44.0

---

Document: Text::PDF::TTFont(3pm) from perl-text-pdf 0.31-r0 (Chainguard OS)
