Pushing data onto the interpreter stack

Most TrueType instructions take their arguments from the interpreter stack. A few instructions, however, take their arguments from the instruction stream. Their purpose is to move data from the instruction stream to the interpreter stack. Collectively these instructions are known as the push instructions.

PUSH N Bytes

NPUSHB[ ]

Code Range

0x40

From IS

n: number of bytes to push (1 byte interpreted as an integer)
b1, b2,...bn: sequence of n bytes

Pushes

b1, b2,...bn: sequence of n bytes each padded to 32 bits (ULONG)


Takes n unsigned bytes from the instruction stream, where n is an unsigned integer in the range (0..255), and pushes them onto the stack. n itself is not pushed onto the stack.

PUSH N Words

NPUSHW[ ]

Code Range

0x41

From IS

n: number of words to push (one byte interpreted as an integer)
w1, w2,...wn: sequence of n words formed from pairs of bytes,
the high byte appearing first

Pushes

w1, w2,...wn: sequence of n words each sign extended to 32 bits (LONG)


Takes n 16-bit signed words from the instruction stream, where n is an unsigned integer in the range (0..255), and pushes them onto the stack. n itself is not pushed onto the stack.

PUSH Bytes

PUSHB[abc]

Code Range

0xB0 – 0xB7

abc

number of bytes to be pushed – 1

From IS

b0, b1,..bn: sequence of n + 1 bytes

Pushes

b0, b1, ...,bn: sequence of n + 1 bytes each padded to 32 bits (ULONG)


Takes the specified number of bytes from the instruction stream and pushes them onto the interpreter stack.

The variables a, b, and c are binary digits representing numbers from 000 to 111 (0-7 in binary). Because the actual number of bytes (n) is from 1 to 8, 1 is automatically added to the abc figure to obtain the actual number of bytes pushed.

Example:

PUSH Words

PUSHW[abc]

Code Range

0xB8 - 0xBF

abc

number of words to be pushed – 1.

From IS

w0,w1,..wn: sequence of n+1 words formed from pairs of bytes, the high byte appearing first

Pushes

w0 ,w1,...wn: sequence of n+1 words each sign extended to 32 bits (LONG)


Takes the specified number of words from the instruction stream and pushes them onto the interpreter stack.

The variables a, b, and c are binary digits representing numbers from 000 to 111 (0-7 binary). Because the actual number of bytes (n) is from 1 to 8, 1 is automatically added to the abc figure to obtain the actual number of bytes pushed.

Example: