home *** CD-ROM | disk | FTP | other *** search
/ Internet Magazine 2002 February / INTERNET88.ISO / pc / software / windows / bits / pdf995 / data1.cab / Program_Executable_Files / res / showchar.ps < prev    next >
Encoding:
Text File  |  2001-12-08  |  3.2 KB  |  97 lines

  1. %    Copyright (C) 1993, 1994, 1996 Aladdin Enterprises.  All rights reserved.
  2. % This file is part of GNU Ghostscript.
  3. % GNU Ghostscript is distributed in the hope that it will be useful, but
  4. % WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  5. % to anyone for the consequences of using it or for whether it serves any
  6. % particular purpose or works at all, unless he says so in writing.  Refer
  7. % to the GNU General Public License for full details.
  8. % Everyone is granted permission to copy, modify and redistribute GNU
  9. % Ghostscript, but only under the conditions described in the GNU General
  10. % Public License.  A copy of this license is supposed to have been given
  11. % to you along with GNU Ghostscript so you can know your rights and
  12. % responsibilities.  It should be in a file named COPYING.  Among other
  13. % things, the copyright notice and this notice must be preserved on all
  14. % copies.
  15.  
  16. % $RCSfile: showchar.ps,v $ $Revision: 1.2.2.1 $
  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
  94.