home *** CD-ROM | disk | FTP | other *** search
- Copyright (C) 1989, 1990, 1991 Aladdin Enterprises. All rights reserved.
- Distributed by Free Software Foundation, Inc.
-
- This file is part of Ghostscript.
-
- Ghostscript is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY. No author or distributor accepts responsibility
- to anyone for the consequences of using it or for whether it serves any
- particular purpose or works at all, unless he says so in writing. Refer
- to the Ghostscript General Public License for full details.
-
- Everyone is granted permission to copy, modify and redistribute
- Ghostscript, but only under the conditions described in the Ghostscript
- General Public License. A copy of this license is supposed to have been
- given to you along with Ghostscript so you can know your rights and
- responsibilities. It should be in a file named COPYING. Among other
- things, the copyright notice and this notice must be preserved on all
- copies.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- This file, language.doc, describes the Ghostscript language.
-
- For an overview of Ghostscript and a list of the documentation files, see
- README.
-
- The Ghostscript language bears a very strong resemblance to the PostScript
- (TM) language. In fact, the current release of Ghostscript, unless
- otherwise noted, is intended to execute properly any source program that
- conforms to the definition of the Level 1 PostScript Language as presented
- in the December 1990 printing of the PostScript Language Reference Manual
- (Second Edition) published by Addison-Wesley, plus a subset of the Display
- PostScript and Level 2 PostScript operators (indicated below).
-
- Some of the operators of the Ghostscript language are actually implemented
- as procedures. For this reason, `bind' will not necessarily bind every
- `operator' of the language.
-
- Extended PostScript Facilities
- ------------------------------
-
- Aladdin Enterprises intends to extend Ghostscript over time to implement
- many of the facilities of Display PostScript and of Level 2 PostScript.
- The following operators provided in the current release are not part of
- the original Level 1 PostScript specification, and are intended to have
- the same meanings in Ghostscript as in Display PostScript or Level 2
- PostScript, unless otherwise noted. Operators or categories marked with *
- have only a partial or dummy implementation.
-
- Language features:
- // syntax for immediately evaluated names
- CR, LF, or CRLF as end-of-line
-
- Character and font operators:
- ISOLatin1Encoding, selectfont
-
- Dictionary operators:
- undef
-
- File operators:
- deletefile, eexec, filenameforall (MS-DOS and VMS only),
- fileposition, renamefile, setfileposition
-
- * Graphics state operators:
- currentblackgeneration, currentcmykcolor, currentcolorscreen,
- currentcolortransfer, currenthalftonephase, currentundercolorremoval,
- setblackgeneration, setcmykcolor, setcolorscreen,
- setcolortransfer, sethalftonephase, setundercolorremoval
-
- Interpreter parameter operators:
- currentcacheparams, setcacheparams
-
- Packed array operators:
- currentpacking, packedarray, setpacking
-
- Painting operators:
- colorimage
-
- Path construction operators:
- arct
-
- Ghostscript-specific additions
- ==============================
-
- Miscellaneous
- -------------
-
- ^Z is counted as whitespace.
-
- readhexstring can take either a file or a string as the source of
- characters. In the latter case, it leaves the remainder of the string on
- the stack, just as for the token operator.
-
- run can take either a string or a file as its argument. In the former
- case, it uses findlibfile to open the file (searching directories as
- needed). In the latter case, it just runs the file, closing it at the
- end, and trapping errors just as for the string case.
-
- Mathematical operators
- ----------------------
- <number> arccos <number>
- Computes the arc cosine of a number between -1 and 1.
- <number> arcsin <number>
- Computes the arc sine of a number between -1 and 1.
-
- Dictionary operators
- --------------------
- <dict> <integer> setmaxlength -
- Changes the capacity of a dictionary, preserving its
- contents. Causes a dictfull error if the requested
- capacity is less than the current number of occupied
- entries.
-
- String operators
- ----------------
- <string|name|other> <patternString> stringmatch <boolean>
- Determines whether the string or name matches the given
- pattern. In the pattern, `*' matches any substring of
- the string, `?' matches any single character, and `\'
- quotes the next character. If the first argument is not
- a string or name, stringmatch returns true if
- patternString is a single *, and false otherwise.
- <state> <fromString> <toString> type1encrypt <newState> <toSubstring>
- Encrypts fromString according to the algorithm for Adobe
- Type 1 fonts, writing the result into toString.
- toString must be at least as long as fromString or a
- rangecheck error occurs. state is the initial state of
- the encryption algorithm (a 16-bit non-negative
- integer); newState is the new state of the algorithm.
- <state> <fromString> <toString> type1decrypt <newState> <toSubstring>
- Decrypts fromString according to the algorithm for Adobe
- Type 1 fonts, writing the result into toString. Other
- specifications are as for type1encrypt.
-
- Relational operators
- --------------------
- <number|string> <number|string> max <number|string>
- Returns the larger of two numbers or strings.
- <number|string> <number|string> min <number|string>
- Returns the smaller of two numbers or strings.
-
- File operators
- --------------
- <state> <file> type1decryptfile <newFile>
- Creates a pseudo-file for decrypting a file that contains
- hex characters (as for readhexstring) that represent an
- encrypted string. The pseudo-file is only available for
- reading.
- <string> findlibfile <file> true or <string> false
- Opens the file of the given name for reading. If the file
- cannot be opened using the supplied name, searches
- through directories as described in use.doc. If the
- search fails, findlibfile simply pushes false on the
- stack and returns, rather than causing an error.
- <file> <integer> unread -
- Pushes back the given character onto the front of the
- file. If the file is only open for writing, or if the
- C library call (ungetc) fails, causes an ioerror error.
- If the integer is not in the range [0..255], causes
- a rangecheck error.
- <file> <device> writeppmfile -
- Writes the contents of the device, which must be an image
- device, onto the file, in Portable PixMap (ppm) format.
- Does not close the file.
-
- Miscellaneous operators
- -----------------------
- - currenttime <number>
- Returns the current value of a continuously-running timer,
- in minutes. The initial value of this timer is undefined.
- <string> getenv <string> true or false
- Looks up a name in the shell environment. If the name is
- found, returns the corresponding value and true; if the
- name is not found, returns false.
- <name> <array> makeoperator <operator>
- Constructs and returns a new operator that is actually the
- given procedure in disguise. The name is only used for
- printing. The operator has the executable attribute.
- <string> <boolean> setdebug -
- If the Ghostscript interpreter was built with the DEBUG
- flag set, sets or resets any subset of the debugging
- flags normally controlled by -Z in the command line.
- Has no effect otherwise.
-
- Graphics state operators
- ------------------------
- - currentgscolor <color>
- Returns a color object (a new kind of object) representing
- the current color/gray from the graphics state.
- <color> setgscolor -
- Sets the current color in the graphics state according to
- a color object.
-
- Device operators
- ----------------
- <index> getdevice <device>
- Returns a device from the set of devices known to the
- system. The first device, which is default, is numbered
- 0. If the index is out of range, causes a rangecheck
- error.
- <device> devicename <string>
- Gets the name of a device. The devices currently
- supported are listed in gdevs.mak.
- <matrix> <width> <height> <palette> makeimagedevice <device>
- Makes a new device that accumulates an image in memory.
- palette is an array of color objects that specify how
- the pixel values will be interpreted, e.g., if you want
- a monochrome image for which 0=white and 1=black, the
- palette should be the result of executing
- [ 1 setgray currentgscolor 0 setgray currentgscolor ]
- The palette must contain exactly 2, 4, 16, or 256
- entries, and must contain an entry for black and an
- entry for white; aside from this, its contents are
- arbitrary. Each pixel occupies log2(colormap size)
- bits.
- Alternatively, palette can be null. This is interpreted
- as 32-bit-per-pixel color, where the four bytes of each
- pixel are respectively unused, R, G, and B.
- Note that one can also make an image device (with the same
- colormap as an existing image device) using makedevice.
- ****** NOTE: the current implementation of makeimagedevice
- only supports 1-, 8-, and 32-bit-per-pixel devices. ******
- <device> <index> <string> copyscanlines <substring>
- Copies one or more scan lines from an image device into a
- string, starting at a given scan line in the image.
- The data is in the same format as for the image
- operator. Error if the device is not an image device or
- if the string is too small to hold at least one complete
- scan line. Always copies an integral number of scan
- lines.
- <device> <matrix> <width> <height> makedevice <device>
- Makes a new device just like an existing one, but with a
- specified width, height, and initial transformation.
- Note that the width is in pixels, not in bytes as in
- framedevice.
- <device> setdevice -
- Sets the current device to the specified device. Also
- resets the transformation and clipping path to the
- initial values for the device.
- - currentdevice <device>
- Gets the current device from the graphics state.
- <device> <matrix> deviceparams <<mark>> <matrix> <width> <height>
- Gets the parameters of a device. Some devices may have
- additional parameters betwen the mark and the matrix:
- one should use cleartomark to remove the output of
- deviceparams from the stack.
- - flushpage -
- On displays, flushes any buffered output, so that it
- is guaranteed to show up on the screen; on printers,
- has no effect.
-
- Character operators
- -------------------
- <string> type1addpath -
- Adds the description of a character to the current path,
- and then optionally renders the character. The string
- argument is a scalable description encoded in Adobe Type
- 1 format. This operator is only valid in the context of
- a show operator, like setcharwidth and setcachedevice.
- It uses information from the current font, in addition
- to the argument.
- <image> <width> <height> <wx> <wy> <ox> <oy> <string>
- type1imagepath <substring>
- Converts an image (bitmap) description of a character into
- a scalable description in Adobe Type 1 format. The
- current transformation matrix should be the same as the
- FontMatrix of the font in which this character will be
- used: this establishes the scaling relationship between
- image pixels (the image is assumed to be 1 unit high in
- user space) and the character coordinate system used in
- the scalable description. wx and wy are the character
- width, and ox and oy are the character origin relative
- to the lower left corner of the bitmap, in *pixels*.
- All coordinates in the scalable description are rounded to
- integers, so the coefficients in the FontMatrix should
- be on the order of 1/N for some value of N that is
- either a multiple of the height/width or is large
- compared to the width and height. (There is a
- convention, which some P*stScr*pt programs rely on, that
- N=1000.)
- Note that the encoded description has *not* been subjected
- to CharString encryption, which is necessary before the
- description can be given to type1addpath: to do this,
- follow the type1imagepath with
- 4330 exch dup type1encrypt exch pop
- If the description is too complex to fit into the supplied
- string, a limitcheck error results. A good rule of
- thumb is that the size of the string should be about 6
- times the number of 1-bits in the image that are not
- completely surrounded by other 1-bits.
- <font> <char> Type1BuildChar -
- This is not a new operator: rather, it is a name known
- specially to the interpreter. Whenever the interpreter
- needs to render a character (during a ...show,
- stringwidth, or charpath), it looks up the name
- BuildChar in the font dictionary to find a procedure to
- run. If it does not find this name, and if the FontType
- is 1, the interpreter instead uses the value (looked up
- on the dictionary stack in the usual way) of the name
- Type1BuildChar.
- The standard definition of Type1BuildChar is in gs_fonts.ps.
- Users should not need to redefine Type1BuildChar, except
- perhaps for tracing or debugging.
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- PostScript is a trademark of Adobe Systems, Incorporated.
-