Debian Codegraph @

texmf-dist/fonts/source/public/circ/csym.mf

raw
1 %%
2 %% This is file `csym.mf',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% circ.dtx (with options: `csym')
8 %% CIRC is a LaTeX package to typeset circuit and optics diagrams.
9 %% Copyright (C) 1997,1998,2003 Sebastian Tannert and Andreas Tille
10 %%
11 %% This program is free software; you can redistribute it and/or modify
12 %% it under the terms of the GNU General Public License as published by
13 %% the Free Software Foundation; either version 2 of the License, or
14 %% (at your option) any later version.
15 %%
16 %% This program is distributed in the hope that it will be useful,
17 %% but WITHOUT ANY WARRANTY; without even the implied warranty of
18 %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 %% GNU General Public License for more details.
20 %%
21 %% You should have received a copy of the GNU General Public License
22 %% along with this program; if not, write to the Free Software
23 %% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 %%
25 %% For error reports concerning UNCHANGED versions of this file no
26 %% more than one year old, see CIRC.DVI after installation.
27 %% If installation fails search thru this file for 'bug'.
28 mode_setup;
29
30 lLE# :=7pt#;
31 define_whole_pixels(lLE);
32
33 linethickness#:= 0.45pt#;
34 thinline# := 0.5linethickness#;
35 normalline# := 1.0linethickness#;
36 thickline# := 1.5linethickness#;
37 verythickline#:= 2.5linethickness#;
38 define_whole_blacker_pixels(normalline,thinline,thickline,verythickline);
39
40 fontdimen6: 1lLE#;
41
42
43
44 box_wd# := 4lLE#;
45 define_pixels(box_wd);
46
47 osc_dia# := 3lLE#;
48 osc_t := .75; % settings from Andreas Tille
49 osc_spc := .5lLE;
50 define_pixels(osc_dia);
51
52 ww_spc := .25lLE;
53
54 darr_ht# := 1.3lLE#;
55 darr_lt# := 1lLE#;
56 darr_phi := 10;
57 darr_rad := 1lLE;
58 define_pixels(darr_ht,darr_lt);
59
60 bnd_lt# := 1lLE#;
61 bnd_phi := 60;
62 define_pixels(bnd_lt);
63
64 dsw_wd# := 4lLE#;
65 dsw_ht# := 2lLE#;
66 dsw_ov := .2lLE;
67 dsw_t := .2;
68 dsw_cc := .35;
69 dsw_c := .3;
70 dsw_phi := 12;
71 define_pixels(dsw_wd,dsw_ht);
72
73 tri_lt := 0.8lLE;
74 tri_phi := 18;
75
76 arr_lt := 0.8lLE;
77 arr_phi := 10;
78
79 cap_wd := .4lLE; %only for electrolytic capacitor
80 cap_spx := .32lLE; %only for electrolytic capacitor
81 cap_spy := .5lLE; %only for electrolytic capacitor
82 cap_rad := .4lLE;
83 cap_spc := .32lLE;
84 cap_ht# := 2lLE#;
85 cap_lt# := 2lLE#;
86 cap_phi := 45;
87 cap_ara := 1.4lLE;
88 cap_arb := 1.2lLE;
89 define_pixels(cap_lt,cap_ht);
90
91 res_wd := 3lLE;
92 res_ht# := 1lLE#;
93 res_lt# := 4lLE#;
94 res_ara# := 3.3lLE#;
95 res_phi := 45;
96 res_x# := 1lLE#;
97 res_y# := 1lLE#;
98 res_o# := res_ara#*cosd(res_phi)-res_y#;
99 define_pixels(res_lt,res_ht,res_x,res_y,res_o,res_ara);
100
101 did_wd := 1.5lLE;
102 did_ht# := 1.5lLE#;
103 did_lt# := 3lLE#;
104 did_zlt := .4lLE;
105 Dcap_ht := .5lLE;
106 Dcap_spc := .15lLE;
107 Dcap_wd := .35lLE;
108 define_pixels(did_lt,did_ht);
109
110 thy_ht# := 1lLE#;
111 define_pixels(thy_ht);
112
113 led_lt# := 1.5lLE#;
114 led_wd := .8lLE;
115 led_phi := 10; %aperture-angle of arrows
116 led_psi := 50; %angle of arrows from baseline
117 led_spc := .4lLE; %space between arrows
118 led_spx := .4lLE;
119 led_spy# := .8lLE#;
120 define_pixels(led_spy, led_lt);
121
122 pnp_dis := 0.18;
123 npn_dis := (1-pnp_dis);
124 tst_fac := 0.23333;
125 tst_phi := 20;
126 tst_iht := 3lLE;
127 tst_wd# := 1lLE#;
128 tst_lt# := 2lLE#;
129 tst_ht# := 4lLE#;
130 define_pixels(tst_ht,tst_lt,tst_wd);
131
132 cry_wd := .8lLE;
133 cry_spc := .32lLE;
134 cry_ht# := 2lLE#;
135 cry_lt# := 4lLE#;
136 define_pixels(cry_lt,cry_ht);
137
138 ioc_dia := .5lLE;
139 ioc_ht# := .5lLE#;
140 ioc_lt# := 1lLE#;
141 ioc_arr := 0.7lLE;
142 ioc_phi := 12;
143 define_pixels(ioc_ht,ioc_lt);
144
145 cdt_dia := .4lLE;
146 cdt_ht# := .4lLE#;
147 cdt_lt# := .2lLE#;
148 define_pixels(cdt_ht,cdt_lt);
149
150 GND_wd# := 1.4res_ht#;
151 gnd_wd# := 1.8lLE#;
152 gnd_ht# := 1lLE#;
153 gnd_spc# := .2lLE#;
154 gnd_q := .7;
155 define_pixels(gnd_ht,gnd_spc,gnd_wd,GND_wd);
156
157 inv_rad := .36lLE;
158 gat_ht# := 5lLE#;
159 gat_lt# := 7lLE#;
160 define_pixels(gat_lt,gat_ht);
161
162 bbd_wd# := 6lLE#;
163 bbd_ht# := 10lLE#;
164 bba_wd# := 8lLE#;
165 bba_ht# := 4lLE#;
166 define_pixels(bbd_wd,bbd_ht,bba_wd,bba_ht);
167
168 pin_lt# := 2lLE#; % pin length
169 ios_wd# := 2.5lLE#; % in out space
170 mid_wd# := 0lLE#; % middle width
171 pin_spc# := 2lLE#; % pin space
172 out_spc# := 1lLE#; % outer space between pin and box
173
174 define_pixels(pin_lt,ios_wd,mid_wd,pin_spc,pin_wht,out_spc);
175
176 val_lt# := 2lLE#;
177 val_phi := 7;
178 val_lft := 0;
179 val_rht := 0.9;
180 val_ht# := .2lLE#;
181 define_pixels(val_lt,val_ht);
182
183 cir_ht# := 1.2lLE#;
184 cir_lt# := 4lLE#;
185 cir_phi := 45;
186 cir_ara := 2.2lLE;
187 cir_arb := 1.8lLE;
188 define_pixels(cir_ht,cir_lt);
189
190 uso_ht# := 1.5lLE#;
191 uso_lt# := 4lLE#;
192 uso_min := 1lLE;
193 uso_pls := 3lLE;
194 uso_spc := .5lLE;
195 uso_rad := 3lLE;
196 uso_dis := 0.2;
197 uso_phi := 45;
198 uso_ara := 1.6lLE;
199 uso_arb := .8lLE;
200 define_pixels(uso_ht,uso_lt);
201
202 iso_ht# := 1.2lLE#;
203 iso_lt# := 4lLE#;
204 iso_dis := 0.7;
205 iso_rad := .8lLE;
206 iso_phi := 45;
207 iso_ara := 2.2lLE;
208 iso_arb := 1.8lLE;
209 define_pixels(iso_ht,iso_lt);
210
211 coi_ht# := .35lLE#;
212 coi_lt# := 4lLE#;
213 define_pixels(coi_ht,coi_lt);
214 coi_rad := coi_ht;
215 coi_num := 4;
216
217 swt_lt# := 4lLE#;
218 swt_phi := 30;
219 swt_dis := 0.3;
220 swt_ind := 0.8;
221 swt_slt := 0.4lLE;
222 swt_ht# := (1-2swt_dis)*sind(swt_phi)*swt_lt#;
223 define_pixels(swt_ht,swt_lt);
224
225 opv_ht# := 4.5lLE#;
226 opv_lt# := 14lLE#;
227 opv_dis# := 3lLE#;
228 opv_frc := 1.1;
229 define_pixels(opv_lt,opv_ht,opv_dis);
230
231 fet_SD# := 4lLE#; % Source--Drain
232 fet_GSx# := 2lLE#; % Gate--Source, x
233 fet_GSy# := 1lLE#; % Gate--Source, y
234 fet_Gsub := 1lLE; % Gate--Substrat
235 fet_soSD := 0.3lLE; % Substrat "uber Source und Drain
236 fet_sarr := 0.2lLE; % Substrat--Pfeil
237 define_pixels(fet_SD,fet_GSx,fet_GSy);
238
239 mos_SD# := fet_SD#;
240 mos_GSx# := fet_GSx#;
241 mos_GSy# := fet_GSy#;
242
243 mos_sd := 2.3lLE;
244 mos_Gsub := fet_Gsub;
245 mos_ox := 0.3lLE;
246 mos_soSD := fet_soSD;
247 mos_rad := 0.2lLE;
248 define_pixels(mos_SD,mos_GSx,mos_GSy);
249
250 sym# := 232/36pt#;
251 define_pixels(sym);
252
253
254 extra_endchar:=extra_endchar & "labels(range 0 thru 30);";
255
256 def {{ =
257 begingroup
258 save T; transform T;
259 T:=currenttransform;
260 save currenttransform;
261 transform currenttransform;
262 currenttransform:=T;
263 enddef;
264
265 def }} = endgroup; enddef;
266
267 def noarrowTF =
268 transform _aT;
269 numeric _x[],_y[];
270 _aT:=currenttransform;
271 for $=1 upto 20 : _x[$]:=x[$]; _y[$]:=y[$]; endfor;
272 endgroup;
273 for $=1 upto 20 : x[$]:=_x[$]; y[$]:=_y[$]; endfor;
274 {{
275 enddef;
276
277 def addTF(text t) = currenttransform:=currenttransform t; enddef;
278 def addxTF(text t) = currenttransform:=(identity t) transformed
279 currenttransform; enddef;
280
281 def triangle(expr p, l, alpha, phi) =
282 pair iz[];
283 iz0=(0,0);
284 iz1=iz0+((l,0) rotated (alpha+phi));
285 iz2=iz0+((l,0) rotated (-alpha+phi));
286 fill ((iz0--iz1--iz2--cycle) shifted round(p));
287 enddef;
288
289 def arrow(expr p, a, b, phi, l, alpha)(text doother) =
290 pair iz[];
291 iz0=(0,0);
292 iz1=iz0-((l,0) rotated (alpha+phi));
293 iz2=iz0-((l,0) rotated (-alpha+phi));
294 iz3=p transformed if known _aT : _aT; else: identity; fi;
295 iz3-iz4=(b,0) rotated phi;
296 iz5-iz3=(a,0) rotated phi;
297 iz6-iz3=(a-3*rt(0),0) rotated phi;
298 draw iz4--iz6;
299 doother;
300 draw ((iz1--iz0--iz2) shifted round(iz5));
301 transform _aT; %Transformation l"oschen
302 enddef;
303
304 def fillarrow(expr p, a, b, phi, l, alpha)(text doother) =
305 pair iz[];
306 iz0=(0,0);
307 iz1=iz0-((l,0) rotated (alpha+phi));
308 iz2=iz0-((l,0) rotated (-alpha+phi));
309 iz3=p transformed if known _aT : _aT; else: identity; fi;
310 iz3-iz4=(b,0) rotated phi;
311 iz5-iz3=(a,0) rotated phi;
312 iz6-iz3=(a-3*rt(0),0) rotated phi;
313 draw iz4--iz6;
314 doother;
315 fill ((iz1--iz0--iz2--cycle) shifted round(iz5));
316 transform _aT; %Transformation l"oschen
317 enddef;
318
319 lightarr_spc#=.5lLE#;
320 lightarr_lt#=1.5lLE#;
321 lightarr_alt=round(.7lLE);
322 lightarr_awd=round(.2lLE);
323 define_pixels(lightarr_spc,lightarr_lt);
324 def lightarrows(expr zpoint,lightarr_psi) =
325 z100=zpoint;
326 x100=x103=x105;
327 x101=x104=x106=x100+lightarr_lt;
328 y103=y104=y100+.5lightarr_spc;
329 y105=y106=y100-.5lightarr_spc;
330 x107=x108=x109=x110=x104-lightarr_alt;
331 y107-y108=y109-y110=good.y(lightarr_awd);
332 .5[y107,y108]=y104;
333 .5[y109,y110]=y106;
334 pickup pensquare scaled normalline rotated lightarr_psi;
335 draw (z107--z104--z108--cycle) rotatedaround(z100,lightarr_psi);
336 draw (z109--z106--z110--cycle) rotatedaround(z100,lightarr_psi);
337 draw (z103--z104) rotatedaround(z100,lightarr_psi);
338 draw (z105--z106) rotatedaround(z100,lightarr_psi);
339
340 enddef;
341
342 def eightchars(expr cfchar) % erster Zeichenkode
343 (text dochar) % Zeichenkommandos
344 (expr x, yf, ys, o) = % Abst"ande
345
346 beginchar(cfchar,x,ys,yf); charic:=o;
347 dochar;
348 endchar;
349 beginchar(cfchar+1,x,ys,yf); charic:=o;
350 {{addTF(reflectedabout(up,down)); dochar;}}
351 endchar;
352 beginchar(cfchar+2,yf,x,o+x); charic:=ys;
353 {{addTF(rotated 270); dochar;}}
354 endchar;
355 beginchar(cfchar+3,yf,x+o,x); charic:=ys;
356 {{addTF(rotated 270); addTF(reflectedabout(left,right)); dochar;}}
357 endchar;
358 beginchar(cfchar+4,x,yf,ys); charic:=o;
359 {{addTF(reflectedabout(left,right)); dochar;}}
360 endchar;
361 beginchar(cfchar+5,x,yf,ys); charic:=o;
362 {{addTF(rotated 180); dochar;}}
363 endchar;
364 beginchar(cfchar+6,ys,x,x+o); charic:=yf;
365 {{addTF(rotated 270); addTF(reflectedabout(up,down)); dochar;}}
366 endchar;
367 beginchar(cfchar+7,ys,x+o,x); charic:=yf;
368 {{addTF(rotated 90); dochar;}}
369 endchar;
370 enddef;
371
372 def twochars(expr cfchar)(text dochar)(expr ht, wd, dp) =
373 beginchar(cfchar,wd,ht,dp);
374 dochar;
375 endchar;
376 beginchar(cfchar+1,dp,wd,ht);
377 {{addTF(rotated 90); dochar;}}
378 endchar;
379 enddef;
380
381 def fourchars(expr cfchar)(text dochar)(text op)(expr ht, wd, dp) =
382 beginchar(cfchar,wd,ht,dp);
383 dochar;
384 endchar;
385 beginchar(cfchar+1,dp,wd,ht);
386 {{addTF(rotated 90); dochar;}}
387 endchar;
388 beginchar(cfchar+2,wd,dp,ht);
389 {{addTF(shifted -op rotated 180); dochar;}}
390 endchar;
391 beginchar(cfchar+3,ht,wd,dp);
392 {{addTF(shifted -op rotated -90); dochar;}}
393 endchar;
394 enddef;
395
396 def fourfourchars(expr cfchar)(text dochar)(text op)(expr ht, wd, dp) =
397 beginchar(cfchar,wd,ht,dp);
398 dochar;
399 endchar;
400 beginchar(cfchar+1,dp,wd,ht);
401 {{addTF(rotated 90); dochar;}}
402 endchar;
403 beginchar(cfchar+2,wd,dp,ht);
404 {{addTF(shifted -op rotated 180); dochar;}}
405 endchar;
406 beginchar(cfchar+3,ht,wd,dp);
407 {{addTF(shifted -op rotated -90); dochar;}}
408 endchar;
409 beginchar(cfchar+4,wd,dp,ht);
410 {{addTF(reflectedabout(left,right)); dochar;}}
411 endchar;
412 beginchar(cfchar+5,ht,wd,dp);
413 {{addTF(reflectedabout(left,right) rotated 90); dochar;}}
414 endchar;
415 beginchar(cfchar+6,wd,ht,dp);
416 {{addTF(reflectedabout (left,right) shifted -op rotated 180); dochar;}}
417 endchar;
418 beginchar(cfchar+7,dp,wd,ht);
419 {{addTF(reflectedabout(left,right) shifted -op rotated -90); dochar;}}
420 endchar;
421 enddef;
422
423
424 primarydef x gridmod y = if x>0: (x mod y) else: -(-x mod y) fi enddef;
425
426 def vshade(suffix pa, pb)(expr di, patternpath) = begingroup
427 path vl;
428 boolean ifshift;
429
430 if not cycle patternpath:
431 errmessage "patternpath has to be a cyclic path!" fi;
432
433 interim smoothing:=0; %change local only
434 interim autorounding:=0;
435
436 ifshift:=true;
437 ydi:=round(1.41di); % round against pattern in
438 xdi:=round(di); % pattern
439 if xdi<2: errmessage "di to small! di>=2" fi;
440 xs:=xpart(point 0 of pa);
441 xe:=xpart(point infinity of pa);
442 if xs>xe: ye:=xe; xe:=xs; xs:=ye; fi %force xs<xe
443 xs:=xs+((xe-xs) mod xdi) / 2; %adjust grid horizontally
444 vl:=(xs,infinity)--(xs,-infinity);
445 oys:=ypart(pa intersectionpoint vl);
446 oys:=oys-.5ydi; %adjust grid vertically
447 for xs:=xs step xdi until xe:
448 vl:=(xs,infinity)--(xs,-infinity); % new cut line
449 ys:=ypart(pa intersectionpoint vl);
450 ye:=ypart(pb intersectionpoint vl);
451 ifshift:=not(ifshift); %shift periodically
452 sy:=ydi-((ys-oys) gridmod ydi);
453 ys:=ys+sy if ifshift: if sy-.5ydi<0:+else:-fi .5ydi fi;
454 for ys:=ys step if ys>ye:-fi ydi until ye:
455 fill patternpath shifted (xs,ys);
456 endfor
457 endfor;
458 endgroup
459 enddef;
460
461 def hshade(suffix pa, pb)(expr di, patternpath) = begingroup
462 path hl;
463 boolean ifshift;
464
465 if not cycle patternpath:
466 errmessage "patternpath has to be a cyclic path!" fi;
467
468 interim smoothing:=0; %change local only
469 interim autorounding:=0;
470
471 ifshift:=true;
472 xdi:=round(1.41di); % round against pattern in
473 ydi:=round(di); % pattern
474 if ydi<2: errmessage "di to small! di>=2" fi;
475 ys:=ypart(point 0 of pa);
476 ye:=ypart(point infinity of pa);
477 if ys>ye: xe:=ye; ye:=ys; ys:=xe; fi %force ys<ye
478 ys:=ys+((ye-ys) mod ydi) / 2; %adjust grid vertically
479 hl:=(infinity,ys)--(-infinity,ys);
480 oxs:=xpart(pa intersectionpoint hl);
481 oxs:=oxs-.5ydi; %adjust grid horizontally
482 for ys:=ys step ydi until ye:
483 hl:=(infinity,ys)--(-infinity,ys); % new cut line
484 xs:=xpart(pa intersectionpoint hl);
485 xe:=xpart(pb intersectionpoint hl);
486 ifshift:=not(ifshift); %shift periodically
487 sx:=xdi-((xs-oxs) gridmod xdi);
488 xs:=xs+sx if ifshift: if sx-.5xdi<0:+else:-fi .5xdi fi;
489 for xs:=xs step if xs>xe:-fi xdi until xe:
490 fill patternpath shifted (xs,ys);
491 endfor
492 endfor;
493 endgroup
494 enddef;
495
496 endinput;
497 %%
498 %%
499 %% End of file `csym.mf'.