Postscript Operators 'g' and 'h'
gcheck any gcheck bool LEVEL 2
returns true if the operand is simple or if it is composite and its value
resides in global VM. It returns false if the operand is composite and its
value resides in local VM. In other words, gcheck returns true if one could
legally store its operand as an element of another object in global VM.
ERRORS:
stackunderflow
Troubleshooting index
Back to Postscript index
ge num1 num2 ge bool
string1 string2 ge bool
pops two objects from the operand stack and pushes the boolean value true
if the first operand is greater than or equal to the second, false otherwise.
If both operands are numbers, ge compares their mathematical values. If
both operands are strings, ge compares them element by element, treating
the elements as integers in the range 0 to 255, to determine whether the
first string is lexically greater than or equal to the second.
If the operands are of other types or one is a string and the other is a
number, ge executes the
typecheck error.
EXAMPLE:
4.2 4 ge -> true
(abc)(d) ge -> false
(aba)(ab) ge -> true
(aba)(aba) ge -> true
ERRORS:
invalidaccess,
stackunderflow,
typecheck
SEE ALSO:
gt,
eq,
ne,
le,
lt
Troubleshooting index
Postscript
Index
get array index get any
packedarray index get any
dict key get any
string index get int
gets a single element from the value of an array, packed array, dictionary,
or string.
If the first operand is an array, packed array, or string, get treats the
second operand as an index and returns the element identified by the index,
counting from zero. index must be in the range 0 to n-1, where n is the
length of the array, packed array, or string. If it is outside this range,
get will execute a
rangecheck error.
If the first operand is a dictionary, get looks up the second operand as
a key in the dictionary and returns the associated value. If the key is
not present in the dictionary, get executes the
undefined
error.
EXAMPLE:
[31 41 59] 0 get -> 31
[0 (a mixed-type array) [ ] /{
add 2 div}]
2 get -> [ ] % An empty array
/mykey (myvalue) def
currentdict /mykey get -> (myvalue)
(abc) 1 get -> 98 % Character code for "b"
(a) 0 get -> 97
ERRORS:
invalidaccess,
rangecheck,
stackunderflow,
typecheck,
undefined
SEE ALSO:
put,
getinterval
Troubleshooting index
Back to Postscript index
getinterval array index count getinterval subarray
packedarray index count getinterval subarray
string index count getinterval substring
creates a new array, packed array, or string object whose value consists
of some subsequence of the original array, packed array, or string. The
subsequence consists of count elements starting at the specified index in
the original object. The elements in the subsequence are shared between
the original and new objects.
The returned subarray or substring is an ordinary array, packed array, or
string object whose length is count and whose elements are indexed starting
at 0. The element at index 0 in subarray is the same as the element at index
index in the original array.
getinterval requires index to be a valid index in the original object and
count to be a non-negative integer such that index + count is not greater
than the length of the original object.
EXAMPLE:
[9 8 7 6 5] 1 3 getinterval -> [8 7 6]
(abcde) 1 3 getinterval -> (bcd)
(abcde) 0 0 getinterval -> () % An empty string
ERRORS:
invalidaccess,
rangecheck,
stackunderflow,
typecheck
SEE ALSO:
get,
putinterval
Troubleshooting index
Postscript
Index
globaldict - globaldict dict LEVEL 2
pushes the dictionary object globaldict on the operand stack . globaldict
is not an operator; it is a name in
systemdict
associated with the dictionary object.
ERRORS:
stackoverflow
SEE ALSO:
systemdict,
userdict
Troubleshooting index
Back to Postscript index
GlobalFontDirectory - GlobalFontDirectory dict LEVEL 2
pushes a dictionary of defined fonts on the operand stack. Its contents
are limited to those fonts that have been defined in global VM. GlobalFontDirectory
is not an operator; it is a name in
systemdict
associated with the dictionary object.
ERRORS:
stackoverflow
SEE ALSO:
FontDirectory
Troubleshooting index
Back to Postscript index
glyphshow name glyphshow - LEVEL 2
shows a single character, identified by name, from the current font. Unlike
all other show variants, glyphshow bypasses the current font's Encoding.
It can access any character in the font, whether or not that character's
name is present in the font's encoding vector.
The behavior of glyphshow depends on the current font's FontType. For FontType
1, glyphshow looks up name in the font's CharStrings dictionary to obtain
a character description to execute. If name is not present in the CharStrings
dictionary, glyphshow substitutes the .notdef entry, which must be present
in every Type 1 font.
For FontType 3, if the font dictionary contains a BuildGlyph procedure,
glyphshow pushes the current font dictionary and name on the operand stack,
then invokes BuildGlyph in the usual way . If there is no BuildGlyph procedure,
but only a BuildChar procedure, glyphshow searches the font's Encoding array
for an occurrence of name. If it finds one, it pushes the font dictionary
and the array index on the operand stack, then invokes BuildChar in the
usual way. If name is not present in the encoding, glyphshow substitutes
the name .notdef and repeats the search. If .notdef isn't present either,
an
invalidfont error occurs.
Like show, glyphshow can access characters that are already in the font
cache. glyphshow does not always need to execute the character's description.
glyphshow operates only with base fonts. If the current font is composite
(FontType 0), an
invalidfont error
occurs.
ERRORS:
invalidaccess,
invalidfont,
nocurrentpoint,
stackunderflow,
typecheck
SEE ALSO:
show
Troubleshooting index
Back to Postscript index
grestore - grestore -
resets the current graphics state from the one on the top of the graphics
state stack and pops the graphics state stack, restoring the graphics state
in effect at the time of the matching gsave. This operator provides a simple
way to undo complicated transformations and other graphics state modifications
without having to re-establish all graphics state parameters individually.
If there is no matching
gsave or if the most recent
gsave preceded the most recent unmatched save, grestore
does not pop the graphics state stack, although it does restore the graphics
state from the top of the graphics state stack.
ERRORS: (none)
SEE ALSO:
gsave,
grestoreall,
setgstate
Troubleshooting index
Back to Postscript index
grestoreall - grestoreall -
repeatedly pops the graphics state stack until it encounters either the
bottommost graphics state or one that was saved by save as opposed to gsave,
leaving that state on top of the graphics state stack. It then resets the
current graphics state from that saved one.
ERRORS: (none)
SEE ALSO:
gsave,
grestore,
setgstate
Troubleshooting index
Back to Postscript index
gsave - gsave -
pushes a copy of the current graphics state on the graphics state stack.
All elements of the graphics state are saved, including the CTM, current
path, clip path, and identity of the raster output device, but not the contents
of raster memory. The saved state may later be restored by a matching
grestore.
The save operator implicitly performs a gsave, but restoring a graphics
state saved by save is slightly different from restoring one saved by gsave
(see the descriptions of
grestore and
grestoreall).
Note that, unlike
save, gsave does not return
a save object on the operand stack to represent the saved state. gsave and
grestore work strictly in a stack-like fashion,
except for the wholesale restoration performed by
restore
and
grestoreall.
ERRORS:
limitcheck
SEE ALSO:
grestore,
grestoreall,
restore,
save,
gstate,
currentgstate
Troubleshooting index
Back to Postscript index
gstate - gstate gstate LEVEL 2
creates a new gstate (graphics state) object and pushes it on the operand
stack. Its initial value is a copy of the current graphics state.
This operator consumes VM; it is the only graphics state operator that does.
The gstate is allocated in either local or global VM according to the current
VM allocation mode
If gstate is allocated in global VM, gstate will generate an invalidaccess
error if any of the composite objects in the current graphics state are
in local VM. Such objects might include the current font, screen function,
halftone dictionary, transfer function, or dash pattern. In general, allocating
gstate objects in global VM is risky and should be avoided.
ERRORS:
invalidaccess,
stackoverflow,
VMerror
SEE ALSO:
currentgstate,
setgstate
Troubleshooting index
Back to Postscript index
gt num1 num2 gt bool
string1 string2 gt bool
pops two objects from the operand stack and pushes the boolean value
true if the first operand is greater than the second, false otherwise. If
both operands are numbers, gt compares their mathematical values. If both
operands are strings, gt compares them element by element, treating the
elements as integers in the range 0 to 255, to determine whether the first
string is lexically greater than the second. If the operands are of other
types or one is a string and the other is a number, gt executes the
typecheck
error.
ERRORS:
invalidaccess,
stackoverflow,
typecheck
SEE ALSO:
ge,
eq,
ne,
le,
lt
Troubleshooting index
Back to Postscript index
handleerror (error)
is looked up in errordict and executed to report error information saved
by the default error handlers . There is also a procedure named handleerror
in
systemdict; it merely calls the procedure
in
errordict.
Troubleshooting index
Back to Postscript index
Original file name: PSL2gh