Defining and using functions and instructions

The following instructions make it possible to define and use both functions and new instructions.

In addition to a simple call function, there is a loop and call function.

An IDEF or instruction definition call makes it possible to patch old scalers in order to add newly defined instructions.

Function DEFinition

FDEF[ ]

Code Range

0x2C

Pops

f: function identifier number (integer in the range 0 to n-1 where n is specified in the 'maxp' table )

Pushes


Marks the start of a function definition. The argument f is a number that uniquely identifies this function. A function definition can appear only in the Font Program or the CVT program. Functions may not exceed 64K in size.

END Function definition

ENDF[ ]

Code Range

0x2D

Pops

Pushes


Marks the end of a function definition or an instruction definition.

CALL function

CALL[ ]

Code Range

0x2B

Pops

f: function identifier number (integer in the range 0 to n-1 where n is specified in the 'maxp' table )

Pushes


Calls the function identified by the number f.

LOOP and CALL function

LOOPCALL[ ]

Code Range

0x2A

Pops

f: function number integer in the range 0 to n-1 where n is specified in the 'maxp' table

count: number of times to call the function (signed word)

Pushes


Calls the function f, count number of times.

Example:

Assume the Font Program contains this:

PUSHB(000), 17

push 17 onto the stack

FDEF[ ]

start defining function 17

...

contents of function

...

ENDF[ ]

end the definition

PUSHB(000),17

push function number

PUSHB(000),5

push count

LOOPCALL[ ]

call function17, 5 times


Instruction DEFinition

IDEF[ ]

Code Range

0x89

Pops

opcode (8 bit code padded with zeroes to ULONG)

Pushes


Begins the definition of an instruction. The instruction definition terminates when at ENDF, which is encountered in the instruction stream. Subsequent executions of the opcode popped will be directed to the contents of this instruction definition (IDEF). IDEFs should be defined in the Font Program or the CVT Program. An IDEF affects only undefined opcodes. If the opcode in question is already defined, the interpreter will ignore the IDEF. This is to be used as a patching mechanism for future instructions. Instructions may not exceed 64K in size.