FontFactory::Type1

Provides the standard PostSript fonts in a friendly package for use with many 'PDF::*' modules

NAME

FontFactory::Type1 - Provides the standard Adobe PostScript Type 1 fonts in a friendly package for use with many PDF::* modules.

A DocFont object is a Type 1 font of a specific name and point size. It provides all the methods available in module Font::AFM plus some extra convenient methods (and aliases). All its methods provide outputs properly scaled for its font and point size.

One can also use fonts without any specific size.

SYNOPSIS

Find the fonts available in the current version along with their aliases:

$ ff1-showfonts

# OUTPUT:
Font family: 'Courier'               (alias: 'c')
Font family: 'Courier-Bold'          (alias: 'ch')
Font family: 'Courier-BoldOblique'   (alias: 'cbo')
Font family: 'Courier-Oblique'       (alias: 'co')
Font family: 'Helvetica'             (alias: 'h')
Font family: 'Helvetica-Bold'        (alias: 'hb')
Font family: 'Helvetica-BoldOblique' (alias: 'hbo')
Font family: 'Helvetica-Oblique'     (alias: 'ho')
Font family: 'Symbol'                (alias: 's')
Font family: 'Times-Bold'            (alias: 'tb')
Font family: 'Times-BoldItalic'      (alias: 'tbi')
Font family: 'Times-Italic'          (alias: 'ti')
Font family: 'Times-Roman'           (alias: 't')
Font family: 'Zapfdingbats'          (alias: 'z')

Get a copy of the factory for use in your program:

my $ff = FontFactory::Type1.new;

Define a DocFont. Use a name that indicates its face and size for easy use later. For fractional points use a 'd' for the decimal point:

my $t12d1 = $ff.get-font: 't12d1';
say "name: ", $t12d1.name; # OUTPUT: «name: Times-Roman␤»
say "size: ", $t12d1.size; # OUTPUT: «size: 12.1␤»

Define another DocFont:

my $c10 = $ff.get-font: 'c';
say "name: ", $c10.name; # OUTPUT: «name: Courier␤»
say "size: ", $c10.size; # OUTPUT: «size: 0␤»

As stated above, in addition to those attributes, all the attributes from Font::AFM are also available plus some added for convenience. For example:

# For typesetting, find the width of a kerned string in PostScript points (72/inch):
my $text = "Some string of text to be typeset in a beautiful PDF document.";
my $wk = $t12d1.stringwidth($text, :kern);
say "kerned width: $wk"; # OUTPUT: «kerned width: 302.3064␤»

DESCRIPTION

FontFactory::Type1 provides easy access to the Adobe standard Type 1 fonts (and their metrics) as used in PDF document creation using other Raku modules.

See the accompanying METHODS for details on the methods and their use in your own PDF document.

AUTHOR

Tom Browder [email protected]

COPYRIGHT AND LICENSE

Ā© 2023-2025 Tom Browder

This library is free software; you may redistribute it or modify it under the Artistic License 2.0.

FontFactory::Type1 v1.1.1

Provides the standard PostSript fonts in a friendly package for use with many 'PDF::*' modules

Authors

  • Tom Browder

License

Artistic-2.0

Dependencies

Data::DumpMacOS::NativeLibFont::AFMPDF::ContentPDF::LiteFile::TempPDF::Font::LoaderProc::EasierText::UtilsFile::Find

Test Dependencies

Provides

  • FontFactory::Type1
  • FontFactory::Type1::BaseFont
  • FontFactory::Type1::DocFont
  • FontFactory::Type1::DocFont::StringSub
  • FontFactory::Type1::FontList
  • FontFactory::Type1::Subs

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.

Built with Podlite — the markup and publishing tools behind this site.