summaryrefslogtreecommitdiff
path: root/fonts/cun/cun.old
blob: ba6048fb003f7405da67ab328e184531361ea787 (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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
%(c) 1990,91 by Joel M. Hoffman

mode_def testing=
		pixels_per_inch:=300*4;
		blacker:=.1;
		o_correction:=1;
		fillin:=.01;
		proofing:=2;
		fontmaking:=0;
		tracingtitles:=1;
	enddef;
if unknown mode:
mode:=testing; fi
mode_setup;

if mode=testing: screenstrokes; fi

% parameters that control what a wedge looks like.
width_to_length_ratio := 1/2;
tailang  := 30;
costail  := cosd tailang;
tantail  := sind tailang/cosd tailang;

u# = 1/384in#;
wedge_len# := 50u#;
wedge_wid# := wedge_len#*width_to_length_ratio;
tail_len# := wedge_wid#*costail;
stem_len# := wedge_len# - tail_len#;
tail_porp := tail_len#/wedge_len#;
stem_porp := stem_len#/wedge_len#;
let_height# := wedge_len#+wedge_wid#;
pen_thick# := wedge_len#/10;

define_pixels(wedge_len, wedge_wid, tail_len, stem_len, let_height, pen_thick);

def wedgepen = pickup pencircle scaled pen_thick; enddef;

def drawwedge (expr n) =
	wedgelen := V[n]len;
	wedgewid := wedgelen*width_to_length_ratio;
	taillen := wedgewid*costail;
	stemlen := wedgelen - taillen;
	V[n]pnt = V[n]mid + ((stemlen, 0) rotated (V[n]theta));
	V[n]ccw = V[n]mid + ((taillen, 0) rotated (V[n]theta + 180 - tailang));
	V[n]cw  = V[n]mid + ((taillen, 0) rotated (V[n]theta - 180 + tailang));
	if unknown V[n]mid.x:
		V[n]mid.x = (V[n]pnt.x + V[n]ccw.x + V[n]cw.x)/3;
	fi
	if unknown V[n]mid.y:
		V[n]mid.y = (V[n]pnt.y + V[n]ccw.y + V[n]cw.y)/3;
	fi
	if unknown V[n].tmid.x:
		V[n]tmid.x = (V[n]mid.x + V[n]ccw.x + V[n]cw.x)/3;
	fi
	if unknown V[n].tmid.y:
		V[n]tmid.y = (V[n]mid.y + V[n]ccw.y + V[n]cw.y)/3;
	fi
	% classic
%	fill V[n]pnt..controls V[n]mid and V[n]mid..V[n]ccw &
%		V[n]ccw..controls V[n]mid and V[n]mid..V[n]cw &
%		V[n]cw..controls V[n]mid and V[n]mid..V[n]pnt--cycle;
	% wedge
%	fill V[n]pnt--V[n]ccw--V[n]cw--cycle;
	% academic
	wedgepen;
	draw V[n]pnt--V[n]mid--V[n]ccw--V[n]cw--V[n]mid;
enddef;

def lenwedge(expr n) =
	V[n]len
enddef;

def rotwedge(expr n) =
	V[n]theta
enddef;

def pointwedge(expr n) = 
	V[n]pnt
enddef;

def midwedge(expr n) = 
	V[n]mid
enddef;

def ccwwedge(expr n) = 
	V[n]ccw
enddef;

def cwwedge(expr n) = 
	V[n]cw
enddef;

def tmidwedge(expr n) = 
	V[n]tmid
enddef;

def wedgesetup =
	save V;
	numeric	V[]len, V[]theta;
	pair	V[]pnt, V[]cw, V[]ccw, V[]mid, V[]tmid;

	for x = 0 step 1 until 20:
		lenwedge(x) := wedge_len;
		rotwedge(x) := 0;
	endfor
enddef;

beginchar("B",wedge_len#+wedge_wid#,let_height#,0); "ma";
wedgesetup;

pointwedge(1) = .5[cwwedge(4),midwedge(4)];
ccwwedge(4) = (w, h);
ccwwedge(3) = cwwedge(2);
w2pnt.x = w3pnt.x = w4pnt.x
w3cw.y = 0;
rotwedge(4) := -90;

drawwedge(4);
drawwedge(1);
drawwedge(2);
drawwedge(3);
endchar;

beginchar("A",wedge_len#,let_height#,0); "nu";
wedgesetup;

midwedge(1) = midwedge(2) = (w/2, h/2);
rotwedge(2) := 80;

drawwedge(1);
drawwedge(2);
endchar;

beginchar("@",wedge_wid#+wedge_len#,let_height#,0); "e";
wedgesetup;

ccwwedge(1) = (0, h);
pointwedge(2) = (wedge_len, wedge_len/2);
midwedge(3) = (wedge_len/2, wedge_len/2);
rotwedge(3) := -90;
ccwwedge(4) = (w, h);
rotwedge(4) := -90;
ccwwedge(5) = (w, h - tail_len);
rotwedge(5) := -90;

drawwedge(1);
drawwedge(2);
drawwedge(3);
drawwedge(4);
drawwedge(5);
endchar;

end;