File: showchar.ps

package info (click to toggle)
gs 3.33-7
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 7,436 kB
  • ctags: 15,511
  • sloc: ansic: 92,150; asm: 684; sh: 486; makefile: 91
file content (88 lines) | stat: -rw-r--r-- 2,662 bytes parent folder | download
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
%    Copyright (C) 1993, 1994 Aladdin Enterprises.  All rights reserved.
% 
% This file is part of GNU Ghostscript.
% 
% GNU Ghostscript is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility to
% anyone for the consequences of using it or for whether it serves any
% particular purpose or works at all, unless he says so in writing.  Refer
% to the GNU Ghostscript General Public License for full details.
% 

% showchar.ps
% Show the outline and rasterized forms of a character.

/F where { pop } { /F /Times-Roman def } ifelse
/P where { pop } { /P 16 def } ifelse
/Rx where { pop } { /Rx 100 def } ifelse
/Ry where { pop } { /Ry 100 def } ifelse
/Cs where { pop } { /Cs (M) def } ifelse
/Pr where { pop } { /Pr false def } ifelse
/Delay where { pop } { /Delay 0 def } ifelse

0 setgray
(markpath.ps) run
(markhint.ps) run
/mmx [1 0 0 1 0 0] def
/getpath		% - getpath <pathproc>
 { [
    { /moveto cvx } { /lineto cvx } { /curveto cvx } { /closepath cvx }
   pathforall
   ] cvx
 } def
/bitselectfont		% <fontname> <scale> bitselectfont -
 { exch findfont exch scalefont setfont
	% Compute the bounding box in device coordinates.
   gsave [Rx 72 div 0 0 Ry 72 div 0 0] setmatrix
   currentfont /FontMatrix get concat
   currentfont /FontBBox get aload pop
   transform ceiling cvi /ury exch def ceiling cvi /urx exch def
   transform floor cvi /lly exch def floor cvi /llx exch def
   /bbx urx llx sub def /bby ury lly sub def
   grestore
 } def
/bitshow		% <string> bitshow -
 { /S exch def gsave
   /W bbx 8 add 7 or 1 add def
   /H bby 8 add def
   /buf W 8 idiv string def
   /M [Rx 72 div 0 0 Ry -72 div 4 llx sub H 4 sub] def
   M W H <ff 00> makeimagedevice
   /dev exch def
   gsave dev setdevice
   newpath 0 lly idtransform moveto
   0 setgray
   gsave
     /hpath S false charpath getpath def
   grestore
   S show grestore
   20 20 translate
   50000 Rx Ry .max P mul div dup scale
   0.7 setgray
   0 W H true M
    { dup 1 add exch dev exch buf copyscanlines
    } imagemask pop
   0 setlinewidth
   gsave 0 setgray hpath exec mmx markpath grestore
   0 0.5 1 setrgbcolor hpath exec stroke
	% Show the hints for Type 1 fonts also.
   currentfont /FontType get 1 eq
    { gsave 1 0 0 setrgbcolor
      0 lly M idtransform translate
      currentfont /FontMatrix get
      dup Pr markfonthints
      currentfont /Encoding get S 0 get get exch Pr markcharhints
      grestore
    }
   if
 } def
F P bitselectfont
/S1 1 string def
Cs
 { /C exch def
   currentfont /Encoding get C get /.notdef ne
    { save S1 0 C put S1 bitshow
      showpage restore
    } if
 } forall
quit