Previous Next


                                                  176
CHAPTER 3                                                                      Syntax



Type 4 functions also make it possible to include a wide variety of halftone spot
functions without the loss of accuracy that comes from sampling, and without
adding to the list of predefined spot functions (see Section 6.4.2, “Spot
Functions”). All of the predefined spot functions can be written as type 4
functions.

The language that can be used in a type 4 function contains expressions involving
integers, real numbers, and boolean values only. There are no composite data
structures such as strings or arrays, no procedures, and no variables or names.
Table 3.39 lists the operators that can be used in this type of function. (For more
information on these operators, see Appendix B of the PostScript Language
Reference, Third Edition.) Although the semantics are those of the corresponding
PostScript operators, a PostScript interpreter is not required.

                         TABLE 3.39 Operators in type 4 functions
OPERATOR TYPE              OPERATORS

Arithmetic operators       abs            cvi           floor   mod     sin
                           add            cvr           idiv    mul     sqrt
                           atan           div           ln      neg     sub
                           ceiling        exp           log     round   truncate
                           cos

Relational, boolean,       and            false         le      not     true
and bitwise operators      bitshift       ge            lt      or      xor
                           eq             gt            ne

Conditional operators      if             ifelse

Stack operators            copy           exch          pop
                           dup            index         roll


The operand syntax for type 4 functions follows PDF conventions rather than
PostScript conventions. The entire code stream defining the function is enclosed
in braces { }. Braces also delimit expressions that are executed conditionally by the
if and ifelse operators:

   boolean { expression } if
   boolean { expression1 } { expression2 } ifelse

This construct is purely syntactic; unlike in PostScript, no “procedure objects” are
involved.

Previous Next