PDF::API2::Resource::Font::SynFont(3pm)

PDF::API2::Resource::Font::SynFont3pm

Module for creating synthetic fonts.

Usage

    my $pdf = PDF::API2->new();
    my $base_font = $pdf->font('Helvetica');
    # Create a condensed synthetic font
    my $condensed = $pdf->synthetic_font($base_font, hscale => 80);
    # Compare the two fonts
    my $text = $pdf->page->text();
    $text->font($base_font, 18);
    $text->distance(72, 720);
    $text->text('Hello World!');
    $text->font($condensed, 18);
    $text->distance(0, -36);
    $text->text('Hello World!');
    $pdf->save('sample.pdf');

Overview

This module allows you to create a custom font based on an existing font, adjusting the scale, stroke thickness, angle, and other properties of each glyph.

Options

hscale

A percentage to condense (less than 100) or expand (greater than 100) the glyphs horizontally.

angle

A number of degrees to lean the glyphs to the left (negative angle) or to the right (positive angle).

bold

A stroke width, in thousandths of a text unit, to add to the glyph's outline, creating a bold effect.

smallcaps

Set to true to replace lower-case characters with small versions of their upper-case glyphs.

space

Additional space, in thousandths of a text unit, to add between glyphs.

Releases

11 releases since Debian 3.1 (Sarge); the text changed 10 times.

  1. 3.1
  2. 5.0
  3. 6.0
  4. 7
  5. 8
  6. 9
  7. 10
  8. 11
  9. 12
  10. 13
  11. Arch

From perl-pdf-api2 2.048-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.