diff options
Diffstat (limited to 'src/graph/PS/drawIstr.ps')
-rw-r--r-- | src/graph/PS/drawIstr.ps | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/graph/PS/drawIstr.ps b/src/graph/PS/drawIstr.ps new file mode 100644 index 00000000..c9234c0c --- /dev/null +++ b/src/graph/PS/drawIstr.ps @@ -0,0 +1,47 @@ +% operand stack configuration in order to use psDrawIStr: +% psDrawIStr +% window type: title or window +% string +% y +% x +% graphics-context dictionary +% it draws a text string in foreground color on top of bounding box of +% string, which is in background color. + +/psDrawIStr + { gsave + newpath %% for rectangle + loadFont + + /window exch def %% get window type + + %% draw bounding box with background color + /str exch def %% get text string + str stringwidth pop 1 sub %% width + FontHeight 1 sub %% height + currentfont begin %% get font height + FontBBox + end + /ypos exch def pop %% define ypos + neg ypos add /offset exch def pop + /offset ypos offset div FontHeight mul def %% define offset + /h exch def /w exch def %% define h + /y0 exch def %% define y0 + /x0 exch def %% define x0 + w h x0 y0 offset sub + window (title) eq + {hVal moveto drawRect} %% draws in title window + {rectangle} ifelse %% draws in view window + begin + BGcolor setgray fill %% set background box color + + x0 y0 + window (title) eq + {hVal} %% print title text + {yVal} ifelse %% print window text + moveto str + FGcolor setgray show %% set text color + end + grestore } + def + |