dictbegin % % SUN's display items % /ALLTYPES [ /booleantype /colortype /fixedtype /fonttype /integertype /marktype /nametype /nulltype /operatortype /realtype /savetype /arraytype /canvastype /colormapentrytype /colormaptype /cursortype /dicttype /environmenttype /eventtype /filetype /graphicsstatetype /monitortype /packedarraytype /pathtype /processtype /stringtype /visualtype ] def /PAINT { % ... any -- dup truetype currentdict exch get exec } def /itempaintdict dictbegin /pop load ALLTYPES {1 index def} forall pop /marktype nullproc def /arraytype { % [str|proc|can|ins font? color?] -- dup xcheck {/paint exch exec}{ gsave aload pop //PAINT exec grestore } ifelse } def /packedarraytype /arraytype load def /canvastype { % canvas -- matrix currentmatrix exch currentpoint translate dup /Parent get null eq { dup false getbbox scale pop pop } if dup /Color get {imagecanvas}{false exch imagemaskcanvas} ifelse setmatrix } def /dicttype { % instance -- dup /ParentDictArray known { /paint exch send } {pop} ifelse } def /stringtype { % string -- 0 currentfont fontdescent rmoveto show } def /colortype { % ... color -- setcolor //PAINT exec } def /fonttype { % ... font -- setfont //PAINT exec } def /integertype { % .. dx dy -- rmoveto //PAINT exec } def /fixedtype //integertype def /realtype //integertype def /nametype { % .. array name -- exch aload length 1 add -1 roll cvx exec //PAINT exec } def dictend def % % Size % /SIZE { % ... any -- w h dup truetype currentdict exch get exec } def /itemsizedict dictbegin {pop 0 0} ALLTYPES {1 index def} forall pop /marktype {0 0} def /arraytype { % [str|proc|can|ins font? color?] -- w h dup xcheck {/size exch exec} { aload pop //SIZE exec } ifelse } def /packedarraytype /arraytype load def /canvastype { % canvas -- w h false getbbox 4 2 roll pop pop } def /dicttype { % instance -- w h dup /ParentDictArray known { /size exch send } {pop 0 0} ifelse } def /stringtype { % string -- w h dup stringbbox pop 3 -2 roll pop pop exch stringwidth pop max currentfont fontheight } def /colortype { % ... color -- w h pop //SIZE exec } def /fonttype { % ... font -- w h setfont //SIZE exec } def /integertype { % ... x y -- w h pop pop //SIZE exec } def /fixedtype //integertype def /realtype //integertype def /nametype { % ... array name -- w h exch aload length 1 add -1 roll cvx exec //SIZE exec } def dictend def % % The actual routines % /DIPaint { % displayitem -- gsave //itempaintdict begin mark exch //PAINT exec cleartomark end grestore } def /DISize { % displayitem -- w h gsave //itemsizedict begin mark exch //SIZE exec counttomark 1 add 2 roll cleartomark end grestore } def /DIPaintCentered { % displayitem x y w h -- gsave 4 copy rectpath clip newpath 4 index DISize xysub 2 div exch 2 div exch xyadd moveto //itempaintdict begin mark exch //PAINT exec cleartomark end grestore } def /DIPaintLeft { % displayitem x y w h -- gsave 4 copy rectpath clip newpath exch pop 3 index DISize exch pop sub 2 div add moveto //itempaintdict begin mark exch //PAINT exec cleartomark end grestore } def /DIPaintRight { % displayitem x y w h -- gsave 4 copy rectpath clip newpath 4 index DISize 3 -1 roll exch sub 2 div 3 1 roll sub exch xyadd moveto //itempaintdict begin mark exch //PAINT exec cleartomark end grestore } def /DIString { % displayitem -- string|null { dup truetype /stringtype eq {exit} if dup isarray? 1 index xcheck not and {0 get} {pop null exit} ifelse } loop } def currentdict /ALLTYPES undef currentdict /itempaintdict undef currentdict /itemsizedict undef currentdict /PAINT undef currentdict /SIZE undef dictend readonly