home *** CD-ROM | disk | FTP | other *** search
/ Acorn User 10 / AU_CD10.iso / Updates / GhostScript / !GhostScr / 6_01 / lib / showchar.ps < prev    next >
Text File  |  2000-03-09  |  3KB  |  96 lines

  1. %    Copyright (C) 1993, 1994, 1996 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. % $Id: showchar.ps,v 1.1 2000/03/09 08:40:40 lpd Exp $
  16. % showchar.ps
  17. % Show the outline and rasterized forms of a character.
  18.  
  19. /F where { pop } { /F /Times-Roman def } ifelse
  20. /P where { pop } { /P 16 def } ifelse
  21. /Rx where { pop } { /Rx 100 def } ifelse
  22. /Ry where { pop } { /Ry 100 def } ifelse
  23. /Cs where { pop } { /Cs (M) def } ifelse
  24. /Pr where { pop } { /Pr false def } ifelse
  25. /Delay where { pop } { /Delay 0 def } ifelse
  26.  
  27. 0 setgray
  28. (markpath.ps) runlibfile
  29. (markhint.ps) runlibfile
  30. /mmx [1 0 0 1 0 0] def
  31. /getpath        % - getpath <pathproc>
  32.  { [
  33.     { /moveto cvx } { /lineto cvx } { /curveto cvx } { /closepath cvx }
  34.    pathforall
  35.    ] cvx
  36.  } def
  37. /bitselectfont        % <fontname> <scale> bitselectfont -
  38.  { exch findfont exch scalefont setfont
  39.     % Compute the bounding box in device coordinates.
  40.    gsave [Rx 72 div 0 0 Ry 72 div 0 0] setmatrix
  41.    currentfont /FontMatrix get concat
  42.    currentfont /FontBBox get aload pop
  43.    transform ceiling cvi /ury exch def ceiling cvi /urx exch def
  44.    transform floor cvi /lly exch def floor cvi /llx exch def
  45.    /bbx urx llx sub def /bby ury lly sub def
  46.    grestore
  47.  } def
  48. /bitshow        % <string> bitshow -
  49.  { /S exch def gsave
  50.    /W bbx 8 add 7 or 1 add def
  51.    /H bby 8 add def
  52.    /buf W 8 idiv string def
  53.    /M [Rx 72 div 0 0 Ry -72 div 4 llx sub H 4 sub] def
  54.    M W H <ff 00> makeimagedevice
  55.    /dev exch def
  56.    gsave dev setdevice
  57.    newpath 0 lly idtransform moveto
  58.    0 setgray
  59.    gsave
  60.      /hpath S false charpath getpath def
  61.    grestore
  62.    S show grestore
  63.    20 20 translate
  64.    50000 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.5 1 0.5 setrgbcolor hpath exec mmx markpath grestore
  71.    0 0.5 1 setrgbcolor hpath exec stroke
  72.     % Show the hints for Type 1 fonts also.
  73.    currentfont /FontType get 1 eq
  74.     { gsave 1 0 0 setrgbcolor
  75.       0 lly M idtransform translate
  76.       currentfont /FontMatrix get
  77.       dup Pr markfonthints
  78.       currentfont /Encoding get S 0 get get exch Pr markcharhints
  79.       grestore
  80.     }
  81.    if
  82.  } def
  83. F P bitselectfont
  84. /S1 1 string def
  85. Cs
  86.  { /C exch def
  87.    currentfont /Encoding get C get /.notdef ne
  88.     { save S1 0 C put S1 bitshow
  89.       showpage restore
  90.     } if
  91.  } forall
  92. quit
  93.