Author image Phil M. Perry
and 1 contributors

NAME

PDF::Builder::Resource::Font::SynFont - Module for using synthetic Fonts.

SYNOPSIS

    #
    use PDF::Builder;
    #
    $pdf = PDF::Builder->new();
    $cft = $pdf->corefont('Times-Roman');  # ttfont, etc. also works
    $sft = $pdf->synfont($cft, -condense => .75);  # condense by 25%
    #

This works for corefonts, PS fonts, and TTF/OTF fonts; but does not work for CJK fonts or bitmapped fonts. See also "Synthetic Fonts" in PDF::Builder::Docs.

METHODS

$font = PDF::Builder::Resource::Font::SynFont->new($pdf, $fontobj, %options)

Returns a synfont object.

Valid %options are:

-encode ... changes the encoding of the font from its default. See Perl's Encode for the supported values. Warning: only single byte encodings are supported. Multibyte encodings such as UTF-8 are invalid.

-pdfname ... changes the reference-name of the font from its default. The reference-name is normally generated automatically and can be retrieved via $pdfname=$font->name().

-condense ... condense/expand factor (0.1-0.9 = condense, 1 = normal, 1.1+ = expand). It's the multiplier for character widths vs. normal.

-slant ... DEPRECATED, will be removed. Use -condense instead.

-oblique ... italic angle (+/-) in degrees, where the character box is skewed. While it's unlikely that anyone will want to slant characters at +/-360 degrees, they should be aware that these will be treated as an angle of 0 degrees (deg2rad() wraps around). 0 degrees of italic slant (obliqueness) is the default.

-bold ... embolding factor (0.1+, bold=1, heavy=2, ...). It is additional outline thickness (linewidth), which expands the character outwards.

-space ... additional charspacing in em (0-1000).

-caps ... create synthetic small-caps. 0 = no, 1 = yes. These are capitals of lowercase letters, at 80% height and 88% width.