4.1、变量定义
POSTSCRIPT 变量
变量的定义是将比那两名和值用def进行关联类似
/ppi 75 def %将ppi定义为75
/ppi ppi 1 add def %将ppi + 1的值定义为ppi ppi = 75 + 1 = 86
POSTSCRIPT 程序块
/inch {72 mul} def
4.2、使用程序和变量
方块
/box
{
72 0 rlineto
0 72 rlineto
-72 0 rlineto
closepath
}def
newpath
252 324 moveto box
.4 setgray fill
/inch {72 mul}def
/box
{
newpath moveto
1 inch 0 rlineto
0 1 inch rlineto
-1 inch 0 rlineto
closepath
}def
/fillbox
{
setgray fill
}def
3.5 inch 4.5 inch box
0 fillbox
2.75 inch 5 inch box
.4 fillbox