summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlgs/kanji/metrics2.ps
blob: f1b7745604d5478054e042230e2fdb0f792257b6 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
%
% wmode.ps  -  define /setmetrics2 operator
%
% Aug.28,1991 Programmed by N.Katayama
%
% Akira Tanaka <akr@jaist.ac.jp> modified for gs4.03/VFlib support. 1996/10/17

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Metrics Utility Operator
% Execute this in the BuildChar procedure instead of setcachedevice2
%

%/SETMETRICS2 14 dict def	% private dictionary

%
% w0x w0y llx lly urx ury w1x w1y vx vy char setmetrics2 -
%

/setmetrics2
{
	currentdict 
	14 dict begin
	/font exch def
	/char exch def	
	/vy exch def	/vx exch def	/w1y exch def	/w1x exch def
	/ury exch def	/urx exch def	/lly exch def	/llx exch def
	/w0y exch def	/w0x exch def

	/old-llx llx def
	/old-lly lly def

	% Metrics

	font /Metrics 2 copy known {
		get char 2 copy known {
			get dup type 
			dup /integertype eq { 
				/w0x 2 index def 
			} if
			dup /realtype eq {
				/w0x 2 index def
			} if
			dup /arraytype eq {
				1 index
				dup length 2 eq {
					/llx 1 index 0 get def
					/urx llx old-llx sub urx add def
					/w0x 1 index 1 get def
				} if
				dup length 4 eq {
					/llx 1 index 0 get def
					/lly 1 index 1 get def
					/urx llx old-llx sub urx add def
					/ury lly old-lly sub ury add def
					/w0x 1 index 2 get def
					/w0y 1 index 3 get def
				} if
				pop
			} if
			pop pop
		}{ pop pop } ifelse
	}{ pop pop } ifelse

	% Metrics2

	font /Metrics2 2 copy known {
		get char 2 copy known {
			get 
			dup 0 get /w1x exch def
			dup 1 get /w1y exch def
			dup 2 get /vx exch def
			dup 3 get /vy exch def
			pop
		}{ pop pop } ifelse
	}{ pop pop } ifelse

	% CDevProc

	font /CDevProc 2 copy known {
		get
		w0x w0y llx lly urx ury w1x w1y vx vy char 12 -1 roll exec
		/vy exch def	/vx exch def	/w1y exch def	/w1x exch def
		/ury exch def	/urx exch def	/lly exch def	/llx exch def
		/w0y exch def	/w0x exch def
	}{ pop pop } ifelse

	% setcachedevice2

	w0x w0y llx lly urx ury w1x w1y vx vy setcachedevice2

	% translate

	llx old-llx sub lly old-lly sub translate 
	
	end
} bind def