Содержащиеся в
Найти другие документы
Ресурсы поддержки
| Загрузить это руководство в формате PDF
DPS Features and Enhancements
4
- This chapter briefly discusses the following Display PostScript (DPS) system topics:
-
- Introduction to the DPS system
- How applications use DPS
- DPS extension
- OpenWindows' font enhancements to DPS
- DPS Libraries
- Applications modified to use DPS
- DPS security issues
- Accessing information From Adobe
- When DPS encounters internal errors
- See Adobe's Programming the Display PostScript System with X for more detailed information.
Introduction to the DPS System
- The Display PostScript system displays graphical information on the computer screen with the same PostScript language imaging model that is a standard for printers and typesetters.1
- 1. This section is based on Chapter 4 of Programming the Display PostScript System with X by Adobe Systems Incorporated (Addison-Wesley Publishing Company, Inc., 1993) and is used with the permission of the copyright holder.
- The PostScript language makes it possible for an X application to draw lines and curves with perfect precision, rotate and scale images, and manipulate type as a graphic object. In addition, X applications that use the Display PostScript system have access to the entire Adobe Type Library.
- Device and resolution independence are important benefits of PostScript printers and typesetters. The Display PostScript system extends these benefits to interactive displays. An application that takes advantage of the DPS system will work and appear the same on any supported display without modification to the application program.
- The DPS system has several components, including the PostScript interpreter, the Client Library, and the pswrap translator. The Client Library is the link between an application and the PostScript interpreter. An application draws on the screen by making calls to Client Library procedures. These procedures generate PostScript language code that is sent to the PostScript interpreter for execution. In addition to the Client Library, the DPS system provides the pswrap translator. It takes PostScript language operators and produces a C language procedure-called a wrap-that can then be called from an application program.
How Applications Use the DPS System
- An application interacts with the DPS system in the following manner:
-
- The application creates a PostScript execution context and establishes a communication channel to the server. The PostScript interpreter switches among contexts, giving multiple applications access to the interpreter.
- The application then sends Client Library procedures and wraps to the context and receives responses from it.
- When the application exits, it destroys the context and closes the communications channel, freeing resources used during the session.
DPS Extension to X
- The X Window System is extensible; that is, new features and technology can be added easily.1 The Display PostScript system is implemented as an extension to the X Window System; the extension is sometimes referred to as DPS/X. Figure 4-1 shows the components of DPS and their relationship to X.

Figure 4-1
- The DPS extension is implemented as part of the X Window System client-server network architecture. The PostScript interpreter is implemented as an extension to the X server, and each application is a client. The application sends PostScript language code to the server through single operator calls or wraps. Data can be returned from the server in the form of output arguments. The Client Library implements DPS client-server communication transparently using the low-level communication protocols provided by the X Window System.
- 1. This section is based on Chapter 2 of Programming the Display PostScript System with X by Adobe Systems Incorporated (Addison-Wesley Publishing Company, Inc., 1993) and is used with the permission of the copyright holder.
- Each application that uses the DPS extension creates a context. A context can be thought of as a virtual PostScript printer that sends its output to a window or an offscreen pixmap. It has its own set of stacks, input/output facilities, and memory space. Separate contexts enable multiple applications to share the PostScript interpreter, which runs a single process in the server.
- Although the DPS system supports multiple contexts for a single application, one context is usually sufficient for all drawing within an application. A single context can handle many drawing areas. There are exceptions, however, when it is preferable to use more than one context in a client. For example, a separate context might be used when importing Encapsulated PostScript (EPS) files. This simplifies error recovery if an included EPS file contains PostScript errors.
- The interpreter handles the scheduling associated with executing contexts in time slices. Each context has access to a private portion of PostScript VM (virtual memory space). An additional portion of VM, called shared VM, is shared among all contexts and holds system fonts and other shared resources. Private VM can hold fonts private to the context.
- The structure of a context is the same across all DPS platforms. Creating and managing a context, however, can differ from one platform to another. Client Library Reference Manual and Client Library Supplement for X contain information on contexts and the routines that manipulate them, and Display PostScript Toolkit for X contains utilities for Display PostScript developers.
DPS Font Enhancements
- The server includes the following font enhancements to the DPS system:
-
- Support for F3 Latin and Asian fonts
- Support for obtaining pre-scaled bitmap font formats from X11 font code
- Type 1 fonts (.pfa and .pfb)
- See Chapter 5, "Font Support" for more information.
DPS Libraries
- The DPS libraries are listed in the following table. The .so and .a files that comprise these libraries are located in the /usr/openwin/lib and /usr/openwin/lib/libp directories.
-
Table 4-1
| Library | Description |
| libdps | DPS Client library |
| libdpstk | DPS Toolkit library |
| libpsres | PostScript Language Resource Location library |
- For information on these libraries, see Programming the Display PostScript System with X and PostScript Language Reference Manual.
- Adobe added Adobe NX agent support to libdps for OpenWindows 3.4; it is described in the following section.
Adobe NX Agent Support
- The Context creation routines (XDPSCreateSimpleContext and XDPSCreateContext) in libdps now attempt to contact the DPS NX agent if they are unable to connect to the DPS/X extension. The NX client must be started manually, usually during the boot or X window startup process.
- The Adobe DPS NX agent, which is available from Adobe, is a separate process from the X window server and your DPS/X client. When connected to the DPS NX agent, your client's DPS calls are intercepted and converted into standard X Protocol requests. Thus a DPS client can run on an X window server that does not natively support the DPS extension.
Applications Modified to use DPS
- The PageView, ImageTool, and DocViewer applications have been modified to use DPS. If your application calls one of these applications, it will run in the current OpenWindows environment.
DPS Security Issues
- The OpenWindows environment provides, and in some cases exceeds, MIT's X11R5 sample server security levels. To ensure this, DPS programmers should be aware of two DPS-specific security features: PostScript file operators' inability to access system files, and secure context creation.
System File Access
- The PostScript language provides file operations that allow users to access system devices such as disk files. This presents a serious security problem. In the OpenWindows environment, you cannot--by default--use PostScript file operators to open or otherwise access a system file.
- For applications, the client should perform necessary file operations, rather than the server. This prevents a client with a user id different than the server's from accessing the server's file access privileges. If you want PostScript file operators to access system files, start the server with the -dpsfileops option (see the Xsun(1) man page). If you attempt to access system files without specifying -dpsfileops, you will get a PostScript undefinedfilename error.
Secure Context Creation
- DPS contexts normally have access to global data that provide a mechanism for inserting "Trojan horses." This allows a context to peer into the activities of another context. For example, one context could intercept a document that another context is imaging. This section describes how to create secure contexts in the OpenWindows environment.
- Section 7.1.1, "Creating Contexts," in the PostScript Language Reference Manual, Second Edition describes three ways that contexts can share VM:
-
- "Local and global VM are completely private to the context." This capability is new with Level 2, and a context created this way is called a secure context.
- "Local VM is private to the context, but global VM is shared with some other context." This is the normal situation for contexts created with XDPSCreateContext and XDPSCreateSimpleContext.
-
- "Local and global VM are shared with some other context." This is the situation for contexts created with XDPSCreateContext and XDPSCreateSimpleContext when the space parameter is not NULL.
- To create a secure context, use XDPSCreateSecureContext:
-
XDPSCreateSecureContext DPSContext XDPSCreateSecureContext(dpy,
drawable, gc, x, y, eventmask, grayramp, ccube, actual,
textProc, errorProc, space)
Display *dpy;
Drawable drawable;
GC gc;
int x;
int y;
unsigned int eventmask;
XStandardColormap *grayramp;
XStandardColormap *ccube;
int actual;
DPSTextProc textProc;
DPSErrorProc errorProc;
DPSSpace space;
|
- All parameters have the identical meaning to those in XDPSCreateContext, but the context being created has its own private global VM. If the space parameter is not NULL, it must identify a space created with a secure context. A space created with a secure context cannot be used for the creation of a nonsecure context. Specifying a nonsecure space with a secure context or a secure space with a nonsecure context will generate an Access error.
How to Access Information From Adobe
- The following information is readily available from Adobe's public access file server: source code examples, AMF (Adobe Metric Font) files, documentation, PPP (PostScript printer description) files, and press releases. You can obtain this information if you have access to Internet or UUCP electronic mail.
- If you have access to Internet, use the File Transfer Program (ftp) to download files from the ftp.mv.us.adobe.com machine. Read the README.first file for information on the archived files. See the "Public Access File Server" section in the preface of Programming the Display PostScript System with X for details on how to obtain this information by electronic mail.
When DPS Encounters Internal Errors
- DPS conducts consistency checks during execution. In the rare event that it encounters internal errors, DPS applications will not be able to connect to the server. If this happens, you must restart the OpenWindows environment. If a client tries to connect to a server with the DPS extension in this state, the following error message sometimes appears:
-
XError: 130
Request Major code 129 (Adobe-DPS_Extension)
|
|
|