chickadee » fps

Outdated egg!

This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

fps - Functional PostScript

Introduction

FPS is a portable system for doing device-independent, resolution-independent graphics from Scheme programs. It is PostScript, with the Forth computational engine replaced with Scheme.

FPS is tightly based upon PostScript. It uses *exactly* the PostScript base rendering primitives. For example, it understands PostScript AFM files, and can render text using general PostScript fonts.

The design of FPS centers on two basic data structures: paths and pictures. A path is an invisible, ideal geometric path on a plane. A picture is a description of ink on paper. Paths can be scaled, rotated, translated, and composed, creating new paths. Filling or stroking a path creates a picture. Pictures can also be scaled, rotated, translated, clipped, recolored, and composed, creating new pictures. The system is fully functional and free of side effects. The single side effect available to the user is rendering a picture to an output device. PostScript fonts are supported for generating paths and pictures from text.

The system is not a "toy." The full set of PostScript rendering primitives are provided: lines, curve, arcs, glyphs, and bitmaps. Full control is provided of the rendering engine's style parameters, such as line width, and cap style. Interchangeable RGB, CMYK, and HSB color models are provided.

The current release of FPS renders pictures to any Scheme port as a stream of straight-line, DSC-compliant PostScript text which can be submitted to any PostScript printer or viewed with ghostview. The renderer can generate EPS text if desired. The actual rendering is done on the printer, for accuracy and efficiency (the system has been carefully designed to allow for this phase-distinction between picture construction and rendering).

The current release has at least three lacunae: we do not currently support PostScript patterned fills, text kerning, or huge, CID fonts (such as Chinese).

A plaintext reference can be found at fps-ref.txt and there's also a tutorial: fps-tutorial.txt.

The SCSH project also has a page about FPS, with a HTML version of the documentation.

Usage

(require-extension fps)

Beware when importing the fps module that some exported procedures clash with existing library names like for example, the compose procedure. You can easily fix this by prefixing all imported forms. For example:

(require-library fps)
(import (prefix fps fps:))

Requirements

records and format-modular are required at run-time.

AFM Files

The AFM files for some common fonts are included in the AFM directory, located in the extension repository:

 Times-Roman.afm
 Times-BoldItalic.afm
 Courier.afm
 Helvetica.afm
 Symbol.afm

To overrride that location, set the environment variable FPS_AFM_PATH to a colon-separated list of directories.

Authors

Wandy Sae-Tan and Olin Shivers

History

1.1.4
fixed use of removed getenv procedure
1.1.3
added regex dependency
1.1.2
Port to Chicken 4
1.1
fixed bug in lowlevel version of with-attrib
1.0
first release as an egg

License

 FPS is copyright the authors, Wandy Sae-tan and Olin Shivers. Don't          
 worry about this too much. We advocate open use of the system and            
 provide sources in our releases. We retain copyright mostly as a means       
 of controlling the specific interface named by the term "FPS." We want       
 there to be a reliable interface spec on which programmers can depend,       
 so we are centralising control of that interface.                            
 
 If you want to use FPS for a commercial system, send us email. There         
 should be no trouble.                                                        
 
 If you want to extend the system, and want to fold your changes back         
 in to the shipped design, send us mail at wandy@mit.edu and                  
 shivers@ai.mit.edu.                                                        
 
 Copyright (C) 1996 Wandy Sae-Tan and Olin Shivers