Johan Vromans > PostScript-Font > PostScript::PrinterFontMetrics

Download:
PostScript-Font-1.10.02.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  2
View/Report Bugs
Module Version: 0.08   Source  

NAME ^

PostScript::PrinterFontMetrics - module to fetch data from Printer Font Metrics files

SYNOPSIS ^

  my $info = new PostScript::PrinterFontMetrics (filename, options);
  print STDOUT ("Name = ", $info->FontName, "\n");
  print STDOUT ("Width of LAV = ", $info->kstringwidth("LAV", 10), "\n");

DESCRIPTION ^

This package allows printer font metric files for PostScript files (so called .pfm files) to be read and (partly) parsed. PFM files contain information that overlaps with that contained in AFM files and can be used with the font files to generate missing AFM files.

CONSTRUCTOR ^

new ( FILENAME [ , OPTIONS ])

The constructor will read the file and parse its contents.

OPTIONS ^

error => [ 'die' | 'warn' | 'ignore' ]

DEPRECATED. Please use 'eval { ... }' to intercept errors.

How errors must be handled. Default is to call die(). In any case, new() returns a undefined result. Setting 'error' to 'ignore' may cause surprising results.

verbose => value

Prints verbose info if value is true.

trace => value

Prints tracing info if value is true.

debug => value

Prints debugging info if value is true. Implies 'trace' and 'verbose'.

INSTANCE METHODS ^

Note: Most of the info from the PFM file can be obtained by calling a method of the same name, e.g. dfMaxWidth and etmCapHeight. Fields that overlap with fields in the AFM file are also available using the AFM name, e.g. etmCapHeight can be referred to as CapHeight, and PostScriptName as FontName.

Each of these methods returns undef if the corresponding information could not be found in the file.

FileName

The name of the file, e.g. 'tir_____.pfm'. This is not derived from the metrics data, but the name of the file as passed to the new method.

MetricsData

The complete contents of the file -- note though that PFM files are binary files.

CharWidthData

Returns a reference to a hash with the character widths for each glyph.

EncodingVector

Returns a reference to an array with the glyph names for each encoded character.

KernData

Returns a reference to a hash with the kerning data for glyph pairs. It is indexed by two glyph names (two strings separated by a comma, e.g. $kd->{"A","B"}).

This module also inherits methods from PostScript::FontMetrics.

NOTES ^

PFM files contain information that overlaps with AFM files, including character widths and kerning pairs.

The PFM file specification is available in the Microsoft Windows Device Development Kit (DDK) (for Windows 3.1), however I have been unable to locate this document. Details of the structure of PFM were gleaned from an Adobe technical note and by examining sample PFM files.

SEE ALSO ^

http://partners.adobe.com/asn/developers/pdfs/tn/5178.PFM.pdf

Building PFM Files for PostScript-Language CJK Fonts describes the structure of PFM files for CJK files, but the information appears to be applicable for western fonts too.

AUTHOR ^

Andrew Ford, Ford & Mason Ltd <A.Ford@ford-mason.co.uk>

This module draws heavily on the PostScript::FontMetrics module by Johan Vromans.

COPYRIGHT and DISCLAIMER ^

This program is Copyright 2001 by Andrew Ford and Ford & Mason Ltd. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of either: a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" which comes with Perl.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the Artistic License for more details.

syntax highlighting: