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 fonts in a friendly package for use with many *PDF::** modules

SYNOPSIS

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

use FontFactory::Type1;
use FontFactory::Type1::Utils;

show-myfonts;

# 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: 'MICREncoding'          (alias: 'm')
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')

(NOTE: font family MICREncoding is not usable in commercial programs without more investigation. See the notes later in this document.)

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}"; # OUTOUT: Ā«size: 12.1ā¤Ā»

Define another DocFont:

my $c10 = $ff.get-font: 'c10';
say "name: {$c10.name}"; # OUTPUT: Ā«name: Courierā¤Ā»
say "size: {$c10.size}"; # OUTOUT: Ā«size: 10ā¤Ā»

In addition to those attributes, all the attributes from Font::AFM are also available, 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 provides easy access to the Adobe standard Type 1 fonts (and their metrics) as used in PDF document creation using modules such as:

  • PDF::Lite

  • PDF::Document (WIP)

  • PDF::Writer (WIP)

  • Slidemaker (WIP)

  • CheckWriter (WIP)

A future module, FontFactory::TT, will provide the same benefits for TrueType (and OpenType) fonts, but it will require the user to provide his or her own font files (the author recommends using Google's free fonts as a starting point for a collection of fonts);

MICR Encoding (MICRE) font

The MICR Encoding font for bank checks was obtained from 1001fonts.com.

The downloaded file was named micr-encoding.zip (which was deleted after unzipping it).

When file micr-encoding.zip was unzipped into the directory, the following files were found:

  '!DigitalGraphicLabs.html'
  '!license.txt'
  micrenc.ttf

The two files in single quotes were renamed to:

DigitalGraphicLabs.html
license.txt

The license basically says the font is free to use for non-commercial purposes.

The font was transformed to an Adobe PostScript Type 1 font by creating .pfa and .afm files using program fontforge. See the complete unzipped package and all the files in directory /dev/fonts and the accompanying file README.fontforge for the procedures used.

AUTHOR

Tom Browder [email protected]

COPYRIGHT AND LICENSE

Ā© 2023 Tom Browder

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

FontFactory::Type1 v0.0.1

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

Authors

  • Tom Browder

License

Artistic-2.0

Dependencies

Proc::EasierPDF::LiteText::UtilsPDF::Font::LoaderFile::FindFont::AFM

Test Dependencies

Provides

  • FontFactory::Type1
  • FontFactory::Type1::Utils

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