📄 language.htm
字号:
<b><tt>EndOfData <bool> true</tt></b>
<b><tt>EncodeZeroRuns <int> 256</tt></b>
<b><tt>Tables <int_array></tt></b>
</blockquote>
<b><tt><target/source> <dict> BWBlockSortEncode/Decode</tt></b>
<blockquote>
<b><tt>BlockSize <int> 16384</tt></b>
</blockquote>
<b><tt><target/source> MoveToFrontEncode/Decode</tt></b>
</tt></b></blockquote>
<p>
Ghostscript also supports additional keys in the optional dictionary
operands for some filters. For the <b><tt>LZWDecode</tt></b> filter:
<dl>
<dt><b><tt>InitialCodeLength <integer></tt></b> (default 8)
<dd>An integer between 2 and 11 specifying the initial number of data bits
per code. Note that the actual initial code length is 1 greater than this,
to allow for the reset and end-of-data code values.
</dl>
<dl>
<dt><b><tt>FirstBitLowOrder <boolean></tt></b> (default false)
<dd>If true, codes appear with their low-order bit first.
</dl>
<dl>
<dt><b><tt>BlockData <boolean></tt></b> (default false)
<dd>If true, the data is broken into blocks in the manner specified for the
GIF file format.
</dl>
<p>
For the <b><tt>CCITTFaxEncode</tt></b> and <b><tt>CCITTFaxDecode</tt></b>
filters:
<dl>
<dt><b><tt>DecodedByteAlign <integer></tt></b> (default 1)
<dd>An integer <b>N</b> with the value 1, 2, 4, 8, or 16, specifying that
decoded data scan lines are always a multiple of <b>N</b> bytes. The
encoding filter skips data in each scan line from Columns to the next
multiple of <b>N</b> bytes; the decoding filter pads each scan line to a
multiple of <b>N</b> bytes.
</dl>
<h3><a name="Virtual_memory"></a>Virtual memory operators</h3>
<dl>
<dt><b><tt><save> .forgetsave -</tt></b>
<dd>Cancels the effect of a save, making it as though the save never
happened.
</dl>
<h3><a name="Miscellaneous"></a>Miscellaneous operators</h3>
<dl>
<dt><b><tt><string> getenv <string> true</tt></b>
<dt><b><tt><string> getenv false</tt></b>
<dd>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.
</dl>
<dl>
<dt><b><tt><name> <array> .makeoperator <operator></tt></b>
<dd>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.
<p>
Operators defined in this way do one other thing besides running the
procedure: if an error occurs during the execution of the procedure, and
there has been no net reduction in operand or dictionary stack depth, the
operand or dictionary stack pointer respectively is reset to its position
at the beginning of the procedure.
</dl>
<dl>
<dt><b><tt><string> <boolean> .setdebug -</tt></b>
<dd>If the Ghostscript interpreter was built with the <b><tt>DEBUG</tt></b>
flag set, sets or resets any subset of the debugging flags normally
controlled by <b><tt>-Z</tt></b> in the command line. Has no effect
otherwise.
</dl>
<dl>
<dt><b><tt>- .oserrno <errno></tt></b>
<dd>Returns the error code for the most recent operating system error.
</dl>
<dl>
<dt><b><tt>- .oserror <string></tt></b>
<dd>Returns the error string for the most recent operating system error.
</dl>
<h3><a name="Device"></a>Device operators</h3>
<dl>
<dt><b><tt><device> copydevice <device></tt></b>
<dd>Copies a device. The copy is writable and installable.
</dl>
<dl>
<dt><b><tt><index> .getdevice <device></tt></b>
<dd>Returns a device from the set of devices known to the system. The
first device, which is the default, is numbered 0. If the
<b><tt>index</tt></b> is out of range, causes a <b><tt>rangecheck</tt></b>
error. This device is actually a prototype, not a directly usable device,
and is marked read-only; it cannot have its parameters changed or be
installed as the current device.
</dl>
<dl>
<dt><b><tt><matrix> <width> <height> <palette> makeimagedevice <device></tt></b>
<dd>Makes a new device that accumulates an image in memory. <b><tt>
matrix</tt></b> is the initial transformation matrix: it must be orthogonal
(that is, [a 0 0 b x y] or
[0 a b 0 x y]). <b><tt>palette</tt></b> is a
string of 2^<small><sup><b>N</b></sup></small> or
3 × 2^<small><sup><b>N</b></sup></small> elements,
specifying how the 2^<small><sup><b>N</b></sup></small> possible pixel
values will be interpreted. Each element is interpreted as a gray value,
or as RGB values, multiplied by 255. For example, if you want a monochrome
image for which 0=white and 1=black, the palette should be
<b><tt><ff 00></tt></b>; if you want a 3-bit deep image with
just the primary colors and their complements (ignoring the fact that 3-bit
images are not supported), the palette might be <b><tt><000000 0000ff
00ff00 00ffff ff0000 ff00ff ffff00 ffffff></tt></b>. At present, the
palette must contain exactly 2, 4, 16, or 256 entries, and must contain an
entry for black and an entry for white; if it contains any entries that
aren't black, white, or gray, it must contain at least the six primary
colors (red, green, blue, and their complements cyan, magenta, and yellow);
aside from this, its contents are arbitrary.
<p>
Alternatively, palette can be 16, 24, 32, or null (equivalent to 24).
These are interpreted as:
<blockquote><table cellpadding=0 cellspacing=0>
<tr valign=bottom>
<th valign=bottom align=left>Palette
<td>
<th valign=bottom align=left>Bits allocated per color
<tr> <td colspan=3><hr>
<tr valign=top> <td>16
<td>
<td>5 red, 6 green, 5 blue
<tr valign=top> <td>24
<td>
<td>8 red, 8 green, 8 blue
<tr valign=top> <td>32
<td>
<td>8C, 8M, 8Y, 8K
</table></blockquote>
<p>
Note that one can also make an image device (with the same palette as an
existing image device) by copying a device using the
<b><tt>copydevice</tt></b> operator.
</dl>
<dl>
<dt><b><tt><matrix> <width> <height> <palette> <word?> makewordimagedevice <device></tt></b>
<dd>Makes an image device as described above. <b><tt>word?</tt></b> is a
Boolean value indicating whether the data should be stored in a
word-oriented format internally. No ordinary PostScript programs should
use this operator.
</dl>
<dl>
<dt><b><tt><device> <index> <string> copyscanlines <substring></tt></b>
<dd>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 <b><tt>image</tt></b> operator. It is an 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.
</dl>
<dl>
<dt><b><tt><device> setdevice -</tt></b>
<dd>Sets the current device to the specified device. Also resets the
transformation and clipping path to the initial values for the device.
Signals an <b><tt>invalidaccess</tt></b> error if the device is a
prototype.
</dl>
<dl>
<dt><b><tt>- currentdevice <device></tt></b>
<dd>Gets the current device from the graphics state.
</dl>
<dl>
<dt><b><tt><device> getdeviceprops <mark> <name1> <value1> ... <namen> <valuen></tt></b>
<dd>Gets the properties of a device. See the section on
<a href="#Device_parameters">device parameters</a> below for details.
</dl>
<dl>
<dt><b><tt><mark> <name1> <value1> ... <namen> <valuen> <device> putdeviceprops <device></tt></b>
<dd>Sets properties of a device. May cause <b><tt>undefined</tt></b>,
<b><tt>typecheck</tt></b>, <b><tt>rangecheck</tt></b>, or
<b><tt>limitcheck</tt></b> errors.
</dl>
<dl>
<dt><b><tt>- flushpage -</tt></b>
<dd>On displays, flushes any buffered output, so that it is guaranteed to
show up on the screen; on printers, has no effect.
</dl>
<hr>
<h1><a name="Device_parameters"></a>Device parameters</h1>
Ghostscript supports the concept of device parameters for all devices, not
just page devices. (For non-page devices, these are accessible through
<b><tt>getdeviceprops</tt></b> and <b><tt>putdeviceprops</tt></b>, as
indicated above.) Here are the currently defined parameters for all
devices:
<dl>
<dt><b><tt>BitsPerPixel <integer> (usually read-only)</tt></b>
<dd>Number of bits per pixel.
</dl>
<dl>
<dt><b><tt>.HWMargins [<four floats>]</tt></b>
<dd>Size of non-imageable regions around the edges of the page, in points
(units of 1/72in; see the <a href="Devices.htm#Measurements">notes on
measurements</a> in the documentation on devices).
</dl>
<dl>
<dt><b><tt>HWSize [<integer> <integer>]</tt></b>
<dd>X and Y size in pixels.
</dl>
<dl>
<dt><b><tt>Name <string> (read-only)</tt></b>
<dd>The device name. Currently the same as <b><tt>OutputDevice</tt></b>.
</dl>
<dl>
<dt><b><tt>Colors, GrayValues, RedValues, GreenValues, BlueValues, ColorValues</tt></b> (usually read-only)
<dd>As for the "<b><tt>deviceinfo</tt></b>" operator of Display PostScript.
<b><tt>Red</tt></b>, <b><tt>Green</tt></b>, <b><tt>Blue</tt></b>, and
<b><tt>ColorValues</tt></b> are only defined if
<b><tt>Colors</tt></b> > 1.
</dl>
<dl>
<dt><b><tt>TextAlphaBits, GraphicsAlphaBits (usually read-only)</tt></b>
<dd>The number of bits of anti-aliasing information for text or graphics
respectively. Legal values are 1 (no anti-aliasing, the default for most
devices), 2, or 4.
</dl>
<p>
In addition, the following are defined per Adobe's documentation for the
<b><tt>setpagedevice</tt></b> operator:
<blockquote>
<b><tt>Duplex</tt></b> (if supported)<br>
<b><tt>HWResolution</tt></b><br>
<b><tt>ImagingBBox</tt></b><br>
<b><tt>Margins</tt></b><br>
<b><tt>NumCopies</tt></b> (for printers only)<br>
<b><tt>Orientation</tt></b> (if supported)<br>
<b><tt>OutputDevice</tt></b><br>
<b><tt>PageOffset</tt></b> (write-only)<br>
<b><tt>PageSize</tt></b><br>
<b><tt>ProcessColorModel</tt></b>
</blockquote>
<p>
Some devices may only allow certain values for <b><tt>HWResolution</tt></b>
and <b><tt>PageSize</tt></b>. The null device ignores attempts to set
<b><tt>PageSize</tt></b>; its size is always <b><tt>[0 0]</tt></b>.
<p>
For printers these are also defined:
<dl>
<dt><b><tt>BufferSpace <integer></tt></b>
<dd>Buffer space for band lists, if the bitmap is too big to fit in memory.
</dl>
<dl>
<dt><b><tt>MaxBitmap <integer></tt></b>
<dd>Maximum space for a full bitmap in memory.
</dl>
<dl>
<dt><b><tt>OutputFile <string></tt></b>
<dd><b><tt>()</tt></b> means "send to printer directly", otherwise
specifies the file name for output; "<b><tt>%d</tt></b>" is replaced by the
page number; on Unix systems "<b><tt>(|command)</tt></b>" writes to a pipe.
</dl>
<dl>
<dt><b><tt>OpenOutputFile <boolean></tt></b>
<dd>If true, open the device's output file when the device is opened,
rather than waiting until the first page is ready to print.
</dl>
<dl>
<dt><b><tt>PageCount <integer> (read-only)</tt></b>
<dd>Counts the number of pages printed on the device.
</dl>
<p>
The following parameters are for use only by very specialized applications
that separate band construction from band rasterization. Improper use may
cause unpredictable errors. In particular, if you only want to allocate
more memory for banding, to increase band size and improve performance, use
the <b><tt>BufferSpace</tt></b> parameter, not
<b><tt>BandBufferSpace</tt></b>.
<dl>
<dt><b><tt>BandHeight <integer></tt></b>
<dd>The height of bands when banding. 0 means use the largest band height
that will fit within the BandBufferSpace (or BufferSpace, if
BandBufferSpace is not specified).
</dl>
<dl>
<dt><b><tt>BandWidth <integer></tt></b>
<dd>The width of bands in the rasterizing pass, in pixels. 0 means use the
actual page width.
</dl>
<dl>
<dt><b><tt>BandBufferSpace <integer></tt></b>
<dd>The size of the band buffer in the rasterizing pass, in bytes. 0 means
use the same buffer size as for the interpretation pass.
</dl>
<p>
In addition, Ghostscript supports the following parameter for
<b><tt>setpagedevice</tt></b> and <b><tt>currentpagedevice</tt></b> that is
<b><em>not</em></b> a device parameter per se:
<dl>
<dt><b><tt>ViewerPreProcess procedure</tt></b>
<dd>Specifies a procedure to be applied to the page device dictionary
before any other processing is done. The procedure may not alter the
dictionary, but it may return a modified copy. This "hook" is provided for
use by viewing programs such as GSview.
</dl>
<hr>
<h1><a name="Miscellaneous_additions"></a>Miscellaneous additions</h1>
<b><tt>run</tt></b> can take either a string or a file as its argument. In
the latter case, it just runs the file, closing it at the end, and trapping
errors just as for the string case.
<!-- [2.0 end contents] ---------------------------------------------------- -->
<!-- [3.0 begin visible trailer] ------------------------------------------- -->
<hr>
<font size=2>
<p>Copyright © 1996, 1997, 1998 Aladdin Enterprises. All rights reserved.
<p>This file is part of Aladdin Ghostscript. See the
<a href="Public.htm">Aladdin Free Public License</a> (the "License") for
full details of the terms of using, copying, modifying, and redistributing
Aladdin Ghostscript.
<p>
Ghostscript version 5.50, 16 September 1998
</font>
<!-- [3.0 end visible trailer] --------------------------------------------- -->
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -