]> git.lizzy.rs Git - plan9front.git/blob - sys/lib/ghostscript/showchar.ps
Import sources from 2011-03-30 iso image - lib
[plan9front.git] / sys / lib / ghostscript / showchar.ps
1 %    Copyright (C) 1993, 1994, 1996 Aladdin Enterprises.  All rights reserved.
2
3 % This software is provided AS-IS with no warranty, either express or
4 % implied.
5
6 % This software is distributed under license and may not be copied,
7 % modified or distributed except as expressly authorized under the terms
8 % of the license contained in the file LICENSE in this distribution.
9
10 % For more information about licensing, please refer to
11 % http://www.ghostscript.com/licensing/. For information on
12 % commercial licensing, go to http://www.artifex.com/licensing/ or
13 % contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14 % San Rafael, CA  94903, U.S.A., +1(415)492-9861.
15
16 % $Id: showchar.ps,v 1.4 2002/02/21 21:49:28 giles Exp $
17 % showchar.ps
18 % Show the outline and rasterized forms of a character.
19
20 /F where { pop } { /F /Times-Roman def } ifelse
21 /P where { pop } { /P 16 def } ifelse
22 /Rx where { pop } { /Rx 100 def } ifelse
23 /Ry where { pop } { /Ry 100 def } ifelse
24 /Cs where { pop } { /Cs (M) def } ifelse
25 /Pr where { pop } { /Pr false def } ifelse
26 /Delay where { pop } { /Delay 0 def } ifelse
27
28 0 setgray
29 (markpath.ps) runlibfile
30 (markhint.ps) runlibfile
31 /mmx [1 0 0 1 0 0] def
32 /getpath                % - getpath <pathproc>
33  { [
34     { /moveto cvx } { /lineto cvx } { /curveto cvx } { /closepath cvx }
35    pathforall
36    ] cvx
37  } def
38 /bitselectfont          % <fontname> <scale> bitselectfont -
39  { exch findfont exch scalefont setfont
40         % Compute the bounding box in device coordinates.
41    gsave [Rx 72 div 0 0 Ry 72 div 0 0] setmatrix
42    currentfont /FontMatrix get concat
43    currentfont /FontBBox get aload pop
44    transform ceiling cvi /ury exch def ceiling cvi /urx exch def
45    transform floor cvi /lly exch def floor cvi /llx exch def
46    /bbx urx llx sub def /bby ury lly sub def
47    grestore
48  } def
49 /bitshow                % <string> bitshow -
50  { /S exch def gsave
51    /W bbx 8 add 7 or 1 add def
52    /H bby 8 add def
53    /buf W 8 idiv string def
54    /M [Rx 72 div 0 0 Ry -72 div 4 llx sub H 4 sub] def
55    M W H <ff 00> makeimagedevice
56    /dev exch def
57    gsave dev setdevice
58    newpath 0 lly idtransform moveto
59    0 setgray
60    gsave
61      /hpath S false charpath getpath def
62    grestore
63    S show grestore
64    20 20 translate
65    50000 Rx Ry .max P mul div dup scale
66    0.7 setgray
67    0 W H true M
68     { dup 1 add exch dev exch buf copyscanlines
69     } imagemask pop
70    0 setlinewidth
71    gsave 0.5 1 0.5 setrgbcolor hpath exec mmx markpath grestore
72    0 0.5 1 setrgbcolor hpath exec stroke
73         % Show the hints for Type 1 fonts also.
74    currentfont /FontType get 1 eq
75     { gsave 1 0 0 setrgbcolor
76       0 lly M idtransform translate
77       currentfont /FontMatrix get
78       dup Pr markfonthints
79       currentfont /Encoding get S 0 get get exch Pr markcharhints
80       grestore
81     }
82    if
83  } def
84 F P bitselectfont
85 /S1 1 string def
86 Cs
87  { /C exch def
88    currentfont /Encoding get C get /.notdef ne
89     { save S1 0 C put S1 bitshow
90       showpage restore
91     } if
92  } forall
93 quit