NAME¶
PostScript::File::Metrics::Loader - Load metrics for PostScript fonts using
Font::AFM
VERSION¶
This document describes version 2.20 of PostScript::File::Metrics::Loader,
released February 11, 2012 as part of PostScript-File version 2.20.
DESCRIPTION¶
PostScript::File::Metrics::Loader is used by PostScript::File::Metrics when no
pre-compiled metrics are available for the requested font or encoding. It uses
Font::AFM to read the AFM file and extract metrics from it.
You should not normally need to use this module, since pre-compiled metrics for
the standard PostScript fonts are included with this distribution. If you
request metrics for a non-standard font, PostScript::File::Metrics will load
this module automatically.
If you need metrics for additional fonts, you may want to modify and run
examples/generate_metrics.pl to create pre-compiled modules for them.
SUBROUTINES¶
get_encoding_vector¶
PostScript::File::Metrics::Loader::get_encoding_vector($encoding)
This returns the encoding vector for $encoding, an arrayref of 256 glyph names.
load¶
PostScript::File::Metrics::Loader::load($font, \@encodings)
This uses Font::AFM to read the metrics for $font, and creates width tables for
each of the @encodings. The metrics are stored into the hashes used internally
by PostScript::File::Metrics.
DIAGNOSTICS¶
- "Can't find definition for %s"
- If this happens, it indicates you found a bug in
PostScript::File::Metrics::Loader. Please report it as described under
"AUTHOR".
- "Can't find the AFM file for %s"
- Font::AFM could not find %s.afm in any
of the directories it searched. See "CONFIGURATION AND
ENVIRONMENT".
- "Invalid term %s in %s"
- This also indicates a bug in PostScript::File. Please
report it.
- "Unknown encoding %s"
- You asked for an encoding that PostScript::File::Metrics
doesn't know about.
CONFIGURATION AND ENVIRONMENT¶
PostScript::File::Metrics::Loader requires no configuration files or environment
variables.
However, it uses Font::AFM, and unfortunately that's difficult to configure
properly (which is why I created PostScript::File::Metrics in the first
place). Font::AFM expects to find a file named
FontName.afm in one of
the directories it searches.
I wound up creating symlinks in
/usr/local/lib/afm/ (which is one of the
default paths that Font::AFM searches if you don't have a "METRICS"
environment variable):
Courier.afm
-> /usr/share/texmf-dist/fonts/afm/adobe/courier/pcrr8a.afm
Courier-Bold.afm
-> /usr/share/texmf-dist/fonts/afm/adobe/courier/pcrb8a.afm
Courier-BoldOblique.afm
-> /usr/share/texmf-dist/fonts/afm/adobe/courier/pcrbo8a.afm
Courier-Oblique.afm
-> /usr/share/texmf-dist/fonts/afm/adobe/courier/pcrro8a.afm
Helvetica.afm
-> /usr/share/texmf-dist/fonts/afm/adobe/helvetic/phvr8a.afm
Helvetica-Bold.afm
-> /usr/share/texmf-dist/fonts/afm/adobe/helvetic/phvb8a.afm
Helvetica-BoldOblique.afm
-> /usr/share/texmf-dist/fonts/afm/adobe/helvetic/phvbo8a.afm
Helvetica-Oblique.afm
-> /usr/share/texmf-dist/fonts/afm/adobe/helvetic/phvro8a.afm
Symbol.afm
-> /usr/share/texmf-dist/fonts/afm/adobe/symbol/psyr.afm
Times-Bold.afm
-> /usr/share/texmf-dist/fonts/afm/adobe/times/ptmb8a.afm
Times-BoldItalic.afm
-> /usr/share/texmf-dist/fonts/afm/adobe/times/ptmbi8a.afm
Times-Italic.afm
-> /usr/share/texmf-dist/fonts/afm/adobe/times/ptmri8a.afm
Times-Roman.afm
-> /usr/share/texmf-dist/fonts/afm/adobe/times/ptmr8a.afm
Paths on your system may vary. I suggest searching for ".afm" files,
and then grepping them for "FontName X", where X is the font you
need metrics for.
INCOMPATIBILITIES¶
None reported.
BUGS AND LIMITATIONS¶
No bugs have been reported.
AUTHOR¶
Christopher J. Madsen "<perl AT cjmweb.net>"
Please report any bugs or feature requests to
"<bug-PostScript-File AT rt.cpan.org>" or through
the web interface at
http://rt.cpan.org/Public/Bug/Report.html?Queue=PostScript-File
<
http://rt.cpan.org/Public/Bug/Report.html?Queue=PostScript-File>.
You can follow or contribute to PostScript-File's development at
http://github.com/madsen/postscript-file
<
http://github.com/madsen/postscript-file>.
COPYRIGHT AND LICENSE¶
This software is copyright (c) 2012 by Christopher J. Madsen.
This is free software; you can redistribute it and/or modify it under the same
terms as the Perl 5 programming language system itself.
DISCLAIMER OF WARRANTY¶
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE
SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO
THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE
PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR
CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY
COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO
LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR
THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER
SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.