home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 February / PCWK0296.iso / sharewar / dos / inne / gs300ini / showchar.ps < prev    next >
Encoding:
Text File  |  1994-08-02  |  2.7 KB  |  88 lines

  1. %    Copyright (C) 1993 Aladdin Enterprises.  All rights reserved.
  2. % This file is part of Aladdin Ghostscript.
  3. % Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  4. % or distributor accepts any responsibility for the consequences of using it,
  5. % or for whether it serves any particular purpose or works at all, unless he
  6. % or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  7. % License (the "License") for full details.
  8. % Every copy of Aladdin Ghostscript must include a copy of the License,
  9. % normally in a plain ASCII text file named PUBLIC.  The License grants you
  10. % the right to copy, modify and redistribute Aladdin Ghostscript, but only
  11. % under certain conditions described in the License.  Among other things, the
  12. % License requires that the copyright notice and this notice be preserved on
  13. % all copies.
  14.  
  15. % showchar.ps
  16. % Show the outline and rasterized forms of a character.
  17.  
  18. /F /Helvetica-Bold def
  19. /P 24 def
  20. /Rx 154 def
  21. /Ry 187 def
  22. /Cs (8) def
  23. /Delay 0 def
  24.  
  25. 0 setgray
  26. (markpath.ps) run
  27. /mmx [1 0 0 1 0 0] def
  28. /getpath        % - getpath <pathproc>
  29.  { [
  30.     { /moveto cvx } { /lineto cvx } { /curveto cvx } { /closepath cvx }
  31.    pathforall
  32.    ] cvx
  33.  } def
  34. /bitselectfont        % <fontname> <scale> bitselectfont -
  35.  { exch findfont exch scalefont setfont
  36.     % Compute the bounding box in device coordinates.
  37.    gsave [Rx 72 div 0 0 Ry 72 div 0 0] setmatrix
  38.    currentfont /FontMatrix get concat
  39.    currentfont /FontBBox get aload pop
  40.    transform ceiling cvi /ury exch def ceiling cvi /urx exch def
  41.    transform floor cvi /lly exch def floor cvi /llx exch def
  42.    /bbx urx llx sub def /bby ury lly sub def
  43.    grestore
  44.  } def
  45. /bitshow        % <string> bitshow -
  46.  { /S exch def gsave
  47.    /W bbx 8 add 7 or 1 add def
  48.    /H bby 8 add def
  49.    /buf W 8 idiv string def
  50.    /M [Rx 72 div 0 0 Ry -72 div 4 llx sub H 4 sub] def
  51.    M W H <ff 00> makeimagedevice
  52.    /dev exch def
  53.    gsave dev setdevice
  54.    newpath 0 lly idtransform moveto
  55.    0 setgray
  56.    gsave
  57.      /hpath S false charpath getpath def
  58.    grestore
  59.    gsave 0.0001 rotate
  60.      /npath S false charpath getpath def
  61.    grestore
  62.    S show grestore
  63.    20 20 translate
  64.    150000 Rx Ry max P mul div dup scale
  65.    0.7 setgray
  66.    0 W H true M
  67.     { dup 1 add exch dev exch buf copyscanlines
  68.     } imagemask pop
  69.    0 setlinewidth
  70.    gsave 0 setgray hpath exec mmx markpath grestore
  71.    1 0 0 setrgbcolor hpath exec stroke
  72.    gsave 0 setgray npath exec mmx markpath grestore
  73.    0 1 0 setrgbcolor npath exec stroke
  74.  } def
  75. F P bitselectfont
  76. /S1 1 string def
  77. Cs
  78.  { /C exch def
  79.    currentfont /Encoding get C get /.notdef ne
  80.     { save S1 0 C put S1 bitshow
  81.       showpage restore
  82.     } if
  83.  } forall
  84. quit
  85.