home *** CD-ROM | disk | FTP | other *** search
-
- defineps GKTextSetUp ( )
-
- % define the functions here so that there is less to send between
- % the gamekit and the postscript server. This will hopefully make
- % drawing text a hair faster and it's easy enough to set up...
-
- /gkbbox {
- /str 2 1 roll def
- newpath
- % start at origin; get both bounding boxes
- 0 0 moveto (str) false charpath
- 2 2 moveto (str) false charpath
- pathbbox
- % convert MAX corner into width/heights and add 1 to
- % width/height (compensates for adjustment below)
- exch 3 index sub 1 add exch 2 index sub 1 add
- % move min corner down & left 1 unit (covers rounding)
- 4 2 roll 1 sub 4 1 roll 1 sub 4 1 roll
- % return the values on the stack... x y width height
- height width y x
- } def
-
- /gkdrawtext {
- /str 2 1 roll def
- /ylate 2 1 roll def
- /xlate 2 1 roll def
- gsave
- 0.0 setgray
- xlate 1 sub ylate 1 add moveto (str) show
- xlate 1 sub ylate 1 sub moveto (str) show
- xlate 1 add ylate 1 add moveto (str) show
- xlate 1 add ylate 1 sub moveto (str) show
- 1.0 setgray
- xlate ylate moveto (str) show
- grestore
- } def
-
- endps
-
-
- defineps GKborderedTextBoundingBox( char *str; | float *x; float *y; float *width; float *height )
-
- % you must have called the set up routine first!
- gsave
- str gkbbox height width y x
- grestore
-
- endps
-
-
- defineps GKdrawBorderedText( float xlate; float ylate; char *str )
-
- % you must have called the set up routine first!
- xlate ylate str gkdrawtext
-
- endps
-