# X and DPS

Updated by Jim Gettys and Juliusz Chroboczek.

## Notice of Obsolescence and Removal from X.Org Releases

DPS is now obsolete.

At the time when I started this project, there was no decent rendering interface for X11 other than DPS.

Since then, there has been a large amount of work on a simple and clean X server extension, Xrender, which provides the basis for just such an interface.

Rendering libraries that are being built above Xrender include Xft, a font rendering library built on FreeType; Cairo, a geometry rendering library that provides PostScript-like rendering primitives but with from-the-ground support for Porter-Duff compositing (transparency); Pango, a high-level typesetting library.

If your application uses DPS, please consider porting it to the above libraries. See the DPS extension site for more details

The client-side DPS software is included and built by default (except as noted below) in the X.Org X11R6.8 release series. The client-side software will be included, but not built unless specifically configured by the builder, in the X.Org X11R6.9 release series. Most of the client-side DPS software is no longer included in X11R7.0 or later releases.

The server-side software is not included in any X.Org release for licensing reasons; the code is still available from the DPS extension site; it is not known whether it still compiles.

## Introduction

Display Postscript (or DPS for short) is a rendering extension for X11. DPS is slightly atypical in that it is based on code mobility, the ability to send executable code from client to server. Thus, a DPS client does not request that a line should be rendered; instead, it uploads code to the server which, when executed, causes a line to be drawn.

This document does not aim at teaching programming with DPS; it is only a summary description of the DPS support code included with X11R. More information about DPS, including a DPS bibliography, is available from the DPS extension site.

    Note: Adobe, PostScript and Display PostScript are trademarks of
    Adobe Systems Incorporated which may be registered in certain
    jurisdictions.

As all X11 extensions, DPS consists of client-side and server-side components. The DPS client side consists of a number of libraries and a number of tools for programming and configuration. The DPS server side may consist either of an X server extension, or of a client-side process known as the ``DPS agent.'' In this latter case, the term ``server-side'' is somewhat misleading.

At the time of writing, only the client side is included with X11R; the server side must be obtained separately. Please see sec-server-side later in this document for more information.

## The DPS client side

The DPS client side consists of four libraries and a number of basic tools for programming and configuration; these are all included with X11R.

### Libraries

The `libpsres` library is a library for management of PostScript resources, on-disk files representing PostScript data structures such as fonts, font encodings, procsets, etc. It is closely related to the `makepsres` tool (see sec-tools later in this document).

The basic DPS client library is `libdps`. This library contains a number of functions for connection establishment, resource management, as well as stubs for all standard PostScript operators. Normally, all DPS clients should link with `libdps`; in addition, `libdps` may be used for printing by non-DPS clients (this is done, for example, by Sun's JDK). This library is documented in [CLRM] and [CLSX].

The `libdpstk` library contains a number of additional utilities for managing DPS contexts, user paths and user objects, and for previewing EPS files. It is documented in [DPTX].

The `libdpstkXm` library contains four Motif widgets. The DPS Scrolling Widget is a DPS drawing area that automatically manages issues such as scrolling, scaling, client-side backing store, incremental redisplay, etc. The Font Selection Box, and its associated Font Preview, present a convenient and powerful interface for choosing scalable fonts. Finally, the Color Picker presents an interface for choosing colours using either of the RGB or HSV spaces. The latter three widgets are documented in [DPTX]; some summary Scrolling Widget documentation is available in the `doc` subdirectory of the `DPS.tar.gz` file, available from �.

The source code for `libdpstkXm` is included with X11R; however, as it depends on Motif, this library is not built by default. A GTK-based library providing some of the functionality of `libdpstkXm` is available from the gtkDPS site.

#### Libdps and Xt

In X11R5, `libdps` did not depend on `libXt`. In X11R6, however, code was added to make the Xt main loop dispatch to sundry code on DPS events; with this addition, all programs that link with `libdps` need to link with `libXt`, whether they use Xt or not.

This state of affairs is unfortunately true of the version of `libdps` included with X11R. We are currently considering various solutions to this problem (including the use of weak linker symbols or splitting off the guilty functions into a separate library).

### Client-side tools

In addition to the libraries, the client side of DPS consists of two utilities.

The `makepsres` utility is used for managing PostScript resources. Its basic operation consists in walking recursively a filesystem tree, noting all resources, and then writing out a ``Unix PostScript Resources,'' file, basically a directory of all the resources found. This utility is documented in the makepsres(1) manual page.

The `pswrap` utility is a stub generator for PostScript clients. Roughly speaking, it takes as its input textual PostScript code, and generates a collection of C functions that transmit that code in pre-tokenised form to the DPS extension. `Pswrap` is documented in [PSWRAP].

### Sample clients

X11R contains three sample DPS clients, `dpsinfo`, `dpsexec` and `texteroids`. They are documented in their respective manual pages.

A number of sample clients that depend on Motif are available in �. Additional sample clients can be found as part of GtkDPS (see above).

The GNUstep environment can be compiled to use DPS for all rendering; for more information, please see the GNUstep site.

## The DPS server side

In order to use DPS clients, you need to install a DPS server side, which can be either a server extension (a ``DPS/X extension''), or a separate process (referred to, variously, either as a ``DPS/NX agent'' or, rather confusingly, as ``Client-Side DPS'' (CSDPS).

### Display Ghostscript

Display Ghostscript (note the capitalisation), or DGS, is a client-side implementation of DPS based on the Ghostscript PostScript interpreter. DGS is still in beta at the time of writing; it does, however, provide a very usable implementation of DPS, although it still has some problems with the semantics of multiple DPS contexts.

DGS is available from the GNUstep download area.

### The DPS extension

The DPS extension is a much younger project aiming at producing an efficient server-side implementation of DPS. The extension is currently in a state best described as alpha; current versions are known to crash the X server under some circumstances.

The DPS extension is available from the DPS extension site.

## References

Links to electronic versions of all of these, and more, are available from the DPS extension site.

[PLRM2] PostScript language reference manual. Adobe Systems, 2nd ed. Addison-Wesley, 1990. ISBN 0-201-18127-4.

[PLRM] PostScript language reference. Adobe Systems Incorporated, 3rd ed. Addison-Wesley, 1999. ISBN 0-201-37922-8.

[INTRO] Display PostScript System. Introduction: Perspective for Software Developers. 15 April 1993.

[CLRM] Display PostScript System. Client Library Reference Manual. 15 April 1993.

[CLSX] Display PostScript System. Client Library Supplement for X. 15 April 1993.

[DPTX] Display PostScript System. Display PostScript Toolkit for X. 15 April 1993.

[PSWRAP] Display PostScript System. pswrap Reference Manual. 15 April 1993.