Debian Codegraph @

reports/ps-fan/ps-fan.ps

raw
1 %!PS-Adobe-2.0 EPSF-1.2
2 %%BoundingBox:0 0 1100 790
3 /maxlevel 5 def
4 /color false def
5 /lr 0 def /lg 1 def /lb 1 def
6 /Lr 0 def /Lg 0 def /Lb 1 def
7 /tr 0 def /tg 1 def /tb 1 def
8 /Tr 0 def /Tg 0 def /Tb 1 def
9 /fontname /Helvetica def
10 /encvec [
11 16#80 /Ccedilla
12 16#81 /udieresis
13 16#82 /eacute
14 16#83 /acircumflex
15 16#84 /adieresis
16 16#85 /agrave
17 16#86 /aring
18 16#87 /ccedilla
19 16#88 /ecircumflex
20 16#89 /edieresis
21 16#8a /egrave
22 16#8b /idieresis
23 16#8c /icircumflex
24 16#8d /igrave
25 16#8e /Adieresis
26 16#8f /Aring
27 16#90 /Eacute
28 16#91 /ae
29 16#92 /AE
30 16#93 /ocircumflex
31 16#94 /odieresis
32 16#95 /ograve
33 16#96 /ucircumflex
34 16#97 /ugrave
35 16#98 /ydieresis
36 16#99 /Odieresis
37 16#9a /Udieresis
38 16#9b /cent
39 16#9c /sterling
40 16#9d /yen
41 16#9f /florin
42 16#a0 /aacute
43 16#a1 /iacute
44 16#a2 /oacute
45 16#a3 /uacute
46 16#a4 /ntilde
47 16#a5 /Ntilde
48 16#a6 /ordfeminine
49 16#a7 /ordmasculine
50 16#a8 /questiondown
51 16#aa /logicalnot
52 16#ab /onehalf
53 16#ac /onequarter
54 16#ad /exclamdown
55 16#ae /guillemotleft
56 16#af /guillemotright
57 ] def
58 % Copyright (c) 1991-1993 Thomas P. Blumer. All Rights Reserved.
59 /border true def
60
61 color {
62 /setcmykcolor where { pop
63 Tr Tg Tb add add 0 eq {
64 /Tk 1 def
65 } {
66 /Tk 0 def
67 /Tr 1 Tr sub def /Tg 1 Tg sub def /Tb 1 Tb sub def
68 } ifelse
69
70 Lr Lg Lb add add 0 eq {
71 /Lk 1 def
72 } {
73 /Lk 0 def
74 /Lr 1 Lr sub def /Lg 1 Lg sub def /Lb 1 Lb sub def
75 } ifelse
76
77 /textcolr0 {Tr Tg Tb Tk setcmykcolor} bind def % direct ancestor name
78 /lincolr0 {Lr Lg Lb Lk setcmykcolor} bind def % direct ancestor lines
79 } {
80 /textcolr0 {Tr Tg Tb setrgbcolor} bind def % direct ancestor name
81 /lincolr0 {Lr Lg Lb setrgbcolor} bind def % direct ancestor lines
82 } ifelse
83 } {
84 /textcolr0 {} bind def
85 /lincolr0 {} bind def
86 } ifelse
87
88 % get printable area
89 clippath pathbbox newpath
90 /ury exch def /urx exch def
91 /lly exch def /llx exch def
92 /lly lly 5 add def
93 /ury ury 10 sub def
94
95 % set landscape mode, get width and height
96 /w ury lly sub def
97 /h urx llx sub def
98 w h lt {
99 % stay in portrait mode
100 llx lly translate
101 /tmp h def
102 /h w def
103 /w tmp def
104 } {
105 % set landscape mode
106 urx lly translate 90 rotate
107 } ifelse
108
109 % decorative border
110 border {
111 /bwid1 2.5 def
112 /gapwid 1.5 def
113 /bwid2 0.7 def
114 /rect {
115 /rh exch def
116 /rw exch def
117 moveto
118 rw 0 rlineto
119 0 rh rlineto
120 rw neg 0 rlineto
121 closepath stroke
122 } def
123
124 bwid1 setlinewidth
125 lincolr0
126 bwid1 2 div dup w bwid1 sub h bwid1 sub rect
127
128 bwid2 setlinewidth
129 bwid1 gapwid bwid2 2 div add add dup
130 w bwid1 2 mul sub gapwid 2 mul sub bwid2 sub
131 h bwid1 2 mul sub gapwid 2 mul sub bwid2 sub rect
132
133 % cut the border out of the imageable area
134 /tmp bwid1 gapwid bwid2 gapwid add add add def
135 tmp tmp translate
136 /w w tmp 2 mul sub def
137 /h h tmp 2 mul sub def
138 } if
139
140 % Reencode the font so that we can use the IBMPC set of international chars
141 /encdict 12 dict def
142 /reenc {
143 encdict begin
144 /newenc exch def
145 /nfont exch def
146 /ofont exch def
147 /ofontdict ofont findfont def
148 /newfont ofontdict maxlength 1 add dict def
149 ofontdict {
150 exch dup /FID ne {
151 dup /Encoding eq
152 {exch dup length array copy newfont 3 1 roll put}
153 {exch newfont 3 1 roll put} ifelse
154 }
155 {pop pop}
156 ifelse
157 } forall
158 newfont /Fontname nfont put
159 newenc aload pop
160 newenc length 2 idiv
161 { newfont /Encoding get 3 1 roll put}
162 repeat
163 nfont newfont definefont pop
164 end
165 } def
166
167 fontname /gedfont encvec reenc
168 /fontname /gedfont def
169 % end font reencoding
170
171 % clear path
172 newpath
173
174 % get radius of circular chart
175 /r w 2 div def
176 /dy h r sub def
177 /dx r r mul dy dy mul sub sqrt def
178 /a dy dx atan def
179
180 % get center of circle, make it origin
181 /cx r def
182 /cy dy def
183 cx cy translate
184
185 % ang1 = end angle for chart
186 % ang2 = begin angle for chart
187 /ang1 a 180 add def
188 /ang2 a neg def
189 /ang ang1 ang2 sub def
190
191 % draw outline of chart
192 %0 0 moveto 0 0 r ang2 ang1 arc closepath stroke
193
194 % 1-icf = fraction of radius segment for inner circle
195 /icf .67 def
196
197 % length of one radius segment
198 /rl r maxlevel icf sub div def
199
200 % calculate base font size from segment length
201 /fntsize rl 9.0 div def
202 fontname findfont fntsize scalefont setfont
203 /space ( ) stringwidth pop def
204
205 % calc line width from segment length - .24 pts = 1 pixel
206 /linwid fntsize .1 mul def
207 linwid setlinewidth
208 /namey linwid 2 mul def
209
210 2 setlinecap
211
212 % name string length for 0 generation
213 /len0 rl def
214
215 % name string length for other generations
216 /len1 rl space 2 mul sub def
217
218 % show string given as argument
219 % select font size so that string fits in available length
220 /wshow {
221 /s exch def
222 /len exch def
223 fontname findfont fntsize scalefont setfont
224 s stringwidth pop dup len lt {
225 pop
226 } {
227 % compute new font size for exact fit
228 len exch div fntsize mul /fsize exch def
229 fontname findfont fsize scalefont setfont
230 } ifelse
231 textcolr0
232 s show
233 } bind def
234
235 % starting y for root children
236 /siby fntsize -2 mul def
237
238 % called once for each individual on chart
239 /i {
240 /leaf exch def
241 /level exch def
242 /death exch def
243 /birth exch def
244 /name exch def
245 level maxlevel lt {
246 level 0 eq {
247 % print name, birth date, death date
248 gsave
249 len0 -2 div siby translate
250 /x 0 def
251 x namey moveto
252 len0 name wshow
253 /siby siby fntsize 2 mul sub def
254
255 fontname findfont fntsize scalefont setfont
256 birth length 0 gt {
257 x fntsize neg moveto
258 len0 birth wshow
259 /siby siby fntsize sub def
260 } if
261 death length 0 gt {
262 x fntsize neg 2 mul moveto
263 len0 death wshow
264 /siby siby fntsize sub def
265 } if
266 grestore
267 } {
268 % x1 = inner radius, x2 = outer radius
269 /x1 level icf sub rl mul def
270 /x2 x1 rl add def
271
272 % aw = angle of wedge for one individual in this generation
273 /aw ang 2 level bitshift div def
274
275 % a = angular position of this individual
276 /a aw leaf 2 mul 1 add mul def
277 /a ang1 a sub def
278
279 % rotate coord system so this individual is on x axis
280 % display name and other info
281 gsave
282 a 90 lt {
283 a rotate
284 lincolr0
285 x1 0 moveto x2 0 lineto stroke
286 /x x1 space add def
287 } {
288 a 180 sub rotate
289 lincolr0
290 x2 neg 0 moveto x1 neg 0 lineto stroke
291 /x x2 neg space add def
292 } ifelse
293
294 % print name, birth date, death date
295 x namey moveto
296 len1 name wshow
297
298 fontname findfont fntsize scalefont setfont
299 birth length 0 gt {
300 x fntsize neg moveto
301 len1 birth wshow
302 } if
303 death length 0 gt {
304 x fntsize neg 2 mul moveto
305 len1 death wshow
306 } if
307 grestore
308
309 % draw arc connecting this individual to his/her child
310 level 0 gt {
311 leaf 1 and 0 eq {
312 % father
313 lincolr0
314 0 0 x1 a aw sub a arc stroke
315 } {
316 % mother
317 lincolr0
318 0 0 x1 a a aw add arc stroke
319 } ifelse
320 } if
321 } ifelse
322 } if
323 } bind def