Postscript Operators 'm'

makefont font matrix makefont font'
applies matrix to font, producing a new font' whose characters are transformed by matrix when they are shown. makefont first creates a copy of font. Then it replaces the new font's FontMatrix entry with the result of concatenating the existing FontMatrix with matrix. It inserts two additional entries, OrigFont and ScaleMatrix, whose purpose is internal to the implementation. Finally, it returns the result as font'.

The makefont, scalefont, and selectfont operators produce a font dictionary derived from an original font dictionary, but with the FontMatrix entry altered. The derived font dictionary is allocated in local or global VM according to whether the original font dictionary is in local or global VM. This is independent of the current VM allocation mode.

Normally, makefont copies only the font dictionary. Subsidiary objects, such as the CharStrings and FontInfo dictionaries, are shared with the original font. However, if font is a composite font, makefont also copies the font dictionaries of any descendant composite fonts. It does not copy descendant base fonts.

Showing characters from the transformed font produces the same results as showing from the original font after having transformed user space by the same matrix. makefont is essentially a convenience operator that permits the desired transformation to be encapsulated in the font description. The most common transformation is to scale a font by a uniform factor in both x and y. scalefont is a special case of the more general makefont and should be used for such uniform scaling. Another operator, selectfont, combines the effects of findfont and makefont.

The interpreter keeps track of font dictionaries recently created by makefont. Calling makefont multiple times with the same font and matrix will usually return the same font' rather than create a new one. However, it is usually more efficient for a PostScript language program to apply makefont only once for each font that it needs and to keep track of the resulting font dictionaries on its own.

/Helvetica findfont [10 0 0 12 0 0] makefont setfont

This obtains the standard Helvetica font, which is defined with a one unit line height, and scales it by a factor of 10 in the x dimension and 12 in the y dimension. This produces a 12-unit high font (i.e., a 12-point font in default user space) whose characters are "condensed" in the x dimension by a ratio of 10/12.

ERRORS: invalidfont, rangecheck, stackunderflow, typecheck, VMerror

SEE ALSO: scalefont, setfont, findfont, selectfont

Troubleshooting index Postscript Index

makepattern dict matrix makepattern pattern LEVEL 2
verifies that dict is a prototype pattern dictionary with all required key-value pairs . It then creates a copy of dict in local VM, adding an entry, with key Implementation, for use by the implementation. makepattern copies only the contents of dict itself, not the values of subsidiary composite objects, which are shared with the original dictionary.

makepattern saves a copy of the current graphics state, to be used later when the interpreter calls the PaintProc to render the pattern cell. It then modifies certain parameters in the saved graphics state, as follows:

1. Concatenates matrix with the saved copy of the CTM.
2. Adjusts the resulting matrix to ensure that the device space can be tiled properly
with a pattern cell of the given size in accordance with the TilingType.
3. Resets the path to empty.
4. Replaces the clipping path by the pattern cell bounding box specified
by the BBox entry in the pattern dictionary.
5. Replaces the device by a special one the implementation provides.

Finally, makepattern makes the new dictionary read-only and pushes it on the operand stack. The resulting pattern dictionary is suitable for use as an operand of setpattern or as a "color value" in the Pattern color space.

ERRORS: limitcheck, rangecheck, stackunderflow, typecheck, undefined, VMerror

SEE ALSO: setpattern, findresource

Troubleshooting index Postscript Index

mark - mark mark
pushes a mark (an object whose type is mark, not the mark operator itself) on the operand stack. All marks are identical, and the operand stack may contain any number of them at once.

The primary use of marks is to indicate the stack position of the beginning of an indefinitely long list of operands being passed to an operator or procedure. The ] operator (array construction) is the most common operator that works this way. It treats as operands all elements of the stack down to a mark that was pushed by the [ operator ( [ is a synonym for mark). It is possible to define procedures that work similarly. Operators such as counttomark and cleartomark are useful within such procedures.

ERRORS: stackoverflow

SEE ALSO: counttomark, cleartomark, pop

Troubleshooting index Postscript Index

matrix - matrix matrix
creates a 6-element array object, fills it in with the values of an identity matrix
[1.0 0.0 0.0 1.0 0.0 0.0] and pushes this array on the operand stack. The array is allocated in local or global VM according to the current VM allocation mode.


matrix -> [1.0 0.0 0.0 1.0 0.0 0.0]
6 array identmatrix -> [1.0 0.0 0.0 1.0 0.0 0.0]

The two lines in the example yield identical results.

ERRORS: stackoverflow, VMerror

SEE ALSO: currentmatrix, defaultmatrix, initmatrix, setmatrix, array

Troubleshooting index Postscript Index

maxlength dict maxlength int
returns the capacity of dict-in other words, the maximum number of key-value pairs that dict can hold using the VM currently allocated to it. In Level 1 implementations, maxlength returns the length operand of the dict operator that created the dictionary; this is the dictionary's maximum capacity (exceeding it causes a dictfull error). In a Level 2 implementation, which permits a dictionary to grow beyond its initial capacity, maxlength returns its current capacity, a number at least as large as that returned by length.


/mydict 5 dict def
mydict length -> 0
mydict maxlength -> 5

ERRORS: invalidaccess, stackunderflow, typecheck

SEE ALSO: length, dict

Troubleshooting index Postscript Index

mod int1 int2 mod remainder
returns the remainder that results from dividing int1 by int2. The sign of the result is the same as the sign of the dividend int1. Both operands must be integers. The result is an integer.


5 3 mod -> 2
5 2 mod -> 1
-5 3 mod -> -2

The last line of the example demonstrates that mod is a remainder operation rather than a true modulo operation.

ERRORS: stackunderflow, typecheck, undefinedresult

SEE ALSO: idiv, div

Troubleshooting index Postscript Index

monitor lock proc monitor - DPS
acquires lock, first waiting if necessary for it to become free, then executes proc, and finally releases lock again. The release of lock occurs whether proc runs to completion or terminates prematurely for any reason.
If lock is already held by the current context, monitor executes an invalidcontext error without disturbing the lock. If the current context has previously executed a save not yet matched by a restore and lock is already held by another context sharing the same local VM as the current context, an invalidcontext error results. These restrictions prevent the most straightforward cases of a context deadlocking with itself.

ERRORS: invalidcontext, stackunderflow, typecheck

SEE ALSO: lock, fork, wait

Troubleshooting index Postscript Index

moveto x y moveto -
starts a new subpath of the current path. moveto sets the current point in the graphics state to the user space coordinate (x, y) without adding any line segments to the current path.
If the previous path operation in the current path was also a moveto or rmoveto, that point is deleted from the current path and the new moveto point replaces it.

ERRORS: limitcheck, stackunderflow, typecheck

SEE ALSO: rmoveto, lineto, curveto, arc, closepath

Troubleshooting index Postscript Index

mul num1 num2 mul product
returns the product of num1 and num2. If both operands are integers and the result is within integer range, the result is an integer. Otherwise, the result is a real.

ERRORS: stackunderflow, typecheck, undefinedresult

SEE ALSO: div, idiv, add, sub, mod

Troubleshooting index Postscript Index

Original file name: PSL2m.html