aboutsummaryrefslogtreecommitdiff
path: root/src/graph/PS/drawIstr.ps
blob: c9234c0c2241f472a6bcd81f8dee9ab74a8552dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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