Johan Vromans > PostScript-Font-1.10.02 > PostScript::Resources



Annotate this POD


Open  2
View/Report Bugs
Module Version: 1.03   Source  


PostScript::Resources - module to fetch data from Unix PostScript Resource '.upr' files


  my $rsc = new PostScript::Resources (options);
  print STDOUT $rsc->FontAFM ("Times-Roman"), "\n";


This package allows Unix font resource files, so called '.upr' files, to be read and parsed.


new ( OPTIONS )

The constructor will initialise the PostScript resource context by loading all resource files.


path => path

path is a colon-separated list of locations where resource files are kept. It defaults to the value of the environment variable PSRESOURCEPATH, which defaults to '::'.

Two adjacent colons in the path represent the list of default places in which a component looks for resources. This is also the default value for users who have not installed private resources. Users with private resources should end the path with a double colon if they want their resources to override the system defaults, or begin it with a double colon if they don't want to override system defaults.

On Unix systems, resource files end with the suffix '.upr' (for Unix PostScript resources). The principal resource file in a directory is named 'PSres.upr'.

If the first line of a principal resource file is 'PS-Resources-Exclusive-1.0', only this file will be loaded and processing continues with the next entry from the path.

If, however, the first line of the principal resource file is 'PS-Resources-1.0', or if there is no such file, all files in the directory with the suffix '.upr' will be loaded.

stdpath => path

The standard locations for resource files.

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

How errors must be handled.

Invalid entries in the file are always reported unless the error handling strategy is set to 'ignore'.

verbose => value

Prints verbose info if value is true.

trace => value

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

debug => value

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


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


The name of the Adobe Font Metrics (.afm) file for the named font.

FontOutline ( FONTNAME )

The name of the PostScript Font program for the named font.



The list of directories where resource files are kept. Semantics are as defined in appendix A of Display PostScript Toolkit for X, Adobe Technical Note DPS.refmanuals.TK.pdf.


Only FontAFM and FontOutline resources are implemented. All other resource sections are ignored.

All info is loaded in memory structures. This is okay for small files or if several lookups are done on the same file.

Backslash escape processing is not yet implemented, except for the handling of line continuation.

This module is intended to be used on Unix systems only. Your mileage on other platforms may vary.


The specification of the Adobe Display PostScript Toolkit for X. The format of the font resources file is described in appendix A of this document.


Johan Vromans, Squirrel Consultancy <>


This program is Copyright 2000,1999 by Squirrel Consultancy. 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: