summaryrefslogtreecommitdiff
path: root/fonts/ifsym/ifgeo.gen
blob: a2be4fac0004b7ec2d04c8628e358364bc30b41b (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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
%%%%%%%%%%%%%%%%%% ifgeo.gen %%%%%%%%%%%%%%%%%%%%%%%
% (c) Ingo Kloeckl
% This program can be redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN
% archives in directory macros/latex/base/lppl.txt; either
% version 1 of the License, or any later version.

% History
% 20.12.1999 v1.0  IK 
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% geometric symbols
% by I.Kloeckl, ingo.kloeckl@2k-software.de

pen normalpen;
normalpen := pencircle scaled 1linewidth;

shadow_x := 2pt;
shadow_y := 2pt;


% some internal utility functions
def Tri(expr n, s, phi) =
if ((phi=90) or (phi=-90)):
  beginchar((char n),ystretch*(10pt#),xstretch*(10pt#),0); 
else:
  beginchar((char n),xstretch*(10pt#),ystretch*(10pt#),0); 
fi;
  pickup normalpen;
  bot lft z0 = (-0.5pt*s*xstretch, -0.5pt*s*ystretch) rotated (phi);
  bot rt z1 = (0.5pt*s*xstretch, -0.5pt*s*ystretch) rotated (phi);
  top z2 = (0pt, 0.5pt*s*ystretch) rotated (phi);
  draw z0--z1--z2--cycle shifted(.5w,.5h);
endchar;
enddef;

def FillTri(expr n, s, phi) =
if ((phi=90) or (phi=-90)):
  beginchar((char n),ystretch*(10pt#),xstretch*(10pt#),0); 
else:
  beginchar((char n),xstretch*(10pt#),ystretch*(10pt#),0); 
fi;
  pickup normalpen;
  fill (-0.5pt,-0.5pt)--(0.5pt,-0.5pt)--(0pt,0.5pt)--cycle
    xscaled (s*xstretch) yscaled (s*ystretch) rotated (phi)
    shifted(.5w,.5h);
endchar;
enddef;

def Cir(expr n, s) =
beginchar((char n),10pt#,10pt#,0); 
  pickup normalpen;
  numeric t;
  t:=s*1pt;
  draw fullcircle scaled t shifted(5pt,5pt);
endchar;
enddef;

def FillCir(expr n, s) =
beginchar((char n),10pt#,10pt#,0); 
  pickup normalpen;
  numeric t;
  t:=s*1pt;
  fill fullcircle scaled t shifted(5pt,5pt);
endchar;
enddef;

def Sq(expr n, s, shadow) =
  beginchar((char n),xstretch*(10pt#),ystretch*(10pt#),0); 
  pickup normalpen;
  bot lft z0 = (-0.5pt*s*xstretch, -0.5pt*s*ystretch);
  bot rt z1 = (0.5pt*s*xstretch, -0.5pt*s*ystretch);
  top rt z2 = (0.5pt*s*xstretch, 0.5pt*s*ystretch);
  top lft z3 = (-0.5pt*s*xstretch, 0.5pt*s*ystretch);
  if shadow=1:
    path p; p := z0--z1--z2;
    draw p shifted(.5w+shadow_x,.5h-shadow_y);
  elseif shadow=2:
    path p; p := z0--z1--z2--z3--cycle;
    fill p shifted(.5w+shadow_x,.5h-shadow_y);
    unfill p shifted(.5w,.5h);
  elseif shadow=3:
    path p; p := z0--z1--z2--z3--cycle;
    draw p shifted(.5w+shadow_x,.5h-shadow_y);
    unfill p shifted(.5w,.5h);
  fi;
  draw z0--z1--z2--z3--cycle shifted(.5w,.5h);
endchar;
enddef;

def FillSq(expr n, s, shadow) =
  beginchar((char n),xstretch*(10pt#),ystretch*(10pt#),0); 
  pickup normalpen;
  bot lft z0 = (-0.5pt*s*xstretch, -0.5pt*s*ystretch);
  bot rt z1 = (0.5pt*s*xstretch, -0.5pt*s*ystretch);
  top rt z2 = (0.5pt*s*xstretch, 0.5pt*s*ystretch);
  top lft z3 = (-0.5pt*s*xstretch, 0.5pt*s*ystretch);
  if shadow=1:
    path p; p := z0--z1--z2;
    draw p shifted(.5w+shadow_x,.5h-shadow_y);
  elseif shadow=3:
    path p; p := z0--z1--z2--z3--cycle;
    draw p shifted(.5w+shadow_x,.5h-shadow_y);
  fi;
  fill z0--z1--z2--z3--cycle shifted(.5w,.5h);
endchar;
enddef;

def CrossedSq(expr n, s) =
  beginchar((char n),xstretch*(10pt#),ystretch*(10pt#),0); 
  pickup normalpen;
  bot lft z0 = (-0.5pt*s*xstretch, -0.5pt*s*ystretch) shifted(.5w,.5h);
  bot rt z1 = (0.5pt*s*xstretch, -0.5pt*s*ystretch) shifted(.5w,.5h);
  top rt z2 = (0.5pt*s*xstretch, 0.5pt*s*ystretch) shifted(.5w,.5h);
  top lft z3 = (-0.5pt*s*xstretch, 0.5pt*s*ystretch) shifted(.5w,.5h);
  draw z0--z2; draw z1--z3;
endchar;
enddef;

def Diamond(expr n, s, shadow, fillshape) =
  beginchar((char n),xstretch*(10pt#),ystretch*(10pt#),0); 
  pickup normalpen;
  x0 = 0pt; bot y0 = -0.5pt*s*ystretch;
  rt x1 =  0.5pt*s*xstretch; y1 = 0pt;
  x2 =  0pt; top y2 =  0.5pt*s*ystretch;
  lft x3 = -0.5pt*s*xstretch; y3 =  0pt;
  if shadow=1:
    path p; p := z0--z1--z2;
    draw p shifted(.5w+shadow_x,.5h);
  elseif shadow=2:
    path p; p := z0--z1--z2--z3--cycle;
    fill p shifted(.5w+shadow_x,.5h);
    unfill p shifted(.5w,.5h);
  elseif shadow=3:
    path p; p := z0--z1--z2--z3--cycle;
    draw p shifted(.5w+shadow_x,.5h);
    unfill p shifted(.5w,.5h);
  fi;
  draw z0--z1--z2--z3--cycle shifted(.5w,.5h);
  if fillshape=1: % right half filled
    fill z0--z1--z2--cycle shifted(.5w,.5h);
  elseif fillshape=2: % lower half filled
    fill z0--z1--z3--cycle shifted(.5w,.5h);
  fi;
endchar;
enddef;

def FillDiamond(expr n, s, shadow) =
  beginchar((char n),xstretch*(10pt#),ystretch*(10pt#),0); 
  pickup normalpen;
  x0 = 0pt; bot y0 = -0.5pt*s*ystretch;
  rt x1 =  0.5pt*s*xstretch; y1 = 0pt;
  x2 =  0pt; top y2 =  0.5pt*s*ystretch;
  lft x3 = -0.5pt*s*xstretch; y3 =  0pt;
  if shadow=1:
    path p; p := z0--z1--z2;
    draw p shifted(.5w+shadow_x,.5h);
  elseif shadow=3:
    path p; p := z0--z1--z2--z3--cycle;
    draw p shifted(.5w+shadow_x,.5h);
  fi;
  fill z0--z1--z2--z3--cycle shifted(.5w,.5h);
endchar;
enddef;

def DiamondBar(expr n, s, barshape) =
  beginchar((char n),xstretch*(10pt#),ystretch*(10pt#),0); 
  pickup normalpen;
  x0 = 0pt; bot y0 = -0.5pt*s*ystretch;
  rt x1 =  0.5pt*s*xstretch; y1 = 0pt;
  x2 =  0pt; top y2 =  0.5pt*s*ystretch;
  lft x3 = -0.5pt*s*xstretch; y3 =  0pt;
  path p;
  if barshape=1: % horizontal bar
    p := z1--z3;
    draw p shifted(.5w,.5h);
  elseif barshape=2: % vertical bar
    p := z0--z2;
    draw p shifted(.5w,.5h);
  fi;
endchar;
enddef;

"Bigsquare";			Sq(32,10,0);
"Square";			Sq(48,8,0);
"Smallsquare";			Sq(64,6,0);
"FilledBigsquare";		FillSq(80,10,0);
"FilledSquare";			FillSq(96,8,0);
"FilledSmallsquare";		FillSq(112,6,0);

"SquareShadow1";		Sq(0,8,1);
"SquareShadow2";		Sq(1,8,2);
"SquareShadow3";		Sq(2,8,3);
"FilledSquareShadow1";		FillSq(3,8,1);
"FilledSquareShadow3";		FillSq(4,8,3);


"BigtriangleUp";		Tri(33,10,0);
"TriangleUp";			Tri(49,8,0);
"SmalltriangleUp";		Tri(65,6,0);
"FilledBigtriangleUp";		FillTri(81,10,0);
"FilledTriangleUp";		FillTri(97,8,0);
"FilledSmalltriangleUp";	FillTri(113,6,0);

"BigtriangleLeft";		Tri(34,10,90);
"TriangleLeft";			Tri(50,8,90);
"SmalltriangleLeft";		Tri(66,6,90);
"FilledBigtriangleLeft";	FillTri(82,10,90);
"FilledTriangleLeft";		FillTri(98,8,90);
"FilledSmalltriangleLeft";	FillTri(114,6,90);

"BigtriangleDown";          Tri(35,10,180);
"TriangleDown";             Tri(51,8,180);
"SmalltriangleDown";        Tri(67,6,180);
"FilledBigtriangleDown";    FillTri(83,10,180);
"FilledTriangleDown";       FillTri(99,8,180);
"FilledSmalltriangleDown";  FillTri(115,6,180);

"BigtriangleRight";         Tri(36,10,-90);
"TriangleRight";            Tri(52,8,-90);
"SmalltriangleRight";       Tri(68,6,-90);
"FilledBigtriangleRight";   FillTri(84,10,-90);
"FilledTriangleRight";      FillTri(100,8,-90);
"FilledSmalltriangleRight"; FillTri(116,6,-90);

"Bigcircle";                Cir(37,10);
"Circle";                   Cir(53,8);
"Smallcircle";              Cir(69,6);
"FilledBigcircle";          FillCir(85,10);
"Filledcircle";             FillCir(101,8);
"FilledSmallcircle";        FillCir(117,6);


"BigDiamond";                Diamond(38,10,0,0);
"Diamond";                   Diamond(54,8,0,0);
"SmallDiamond";              Diamond(70,6,0,0);
"FilledBigDiamond";          FillDiamond(86,10,0);
"FilledDiamond";             FillDiamond(102,8,0);
"FilledSmallDiamond";        FillDiamond(118,6,0);
"BigRightDiamond";           Diamond(47,10,0,1);
"RightDiamond";              Diamond(63,8,0,1);
"SmallRightDiamond";         Diamond(79,6,0,1);
"BigLowerDiamond";           Diamond(95,10,0,2);
"LowerDiamond";              Diamond(111,8,0,2);
"SmallLowerDiamond";         Diamond(127,6,0,2);

"DiamondShadow1";	     Diamond(5,8,1,0);
"DiamondShadow2";	     Diamond(6,8,2,0);
"DiamondShadow3";	     Diamond(7,8,3,0);
"DiamondSquareShadow1";	     FillDiamond(8,8,1);
"DiamondSquareShadow3";	     FillDiamond(9,8,3);

"BigCross";		     CrossedSq(13,10);
"Cross";		     CrossedSq(14,8);
"SmallCross";		     CrossedSq(15,6);
"BigHorBar";		     DiamondBar(26,10,1);
"HorBar";		     DiamondBar(27,8,1);
"SmallHorBar";		     DiamondBar(28,6,1);
"BigVertBar";		     DiamondBar(29,10,2);
"VertBar";		     DiamondBar(30,8,2);
"SmallVertBar";		     DiamondBar(31,6,2);

end.

%%%%%%%%%%%%%%%%%% end of ifgeo.gen %%%%%%%%%%%%%%%%%%%%%%%