home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / clipart / gs22.zip / LISTFNTS.PS < prev    next >
Text File  |  1991-05-16  |  4KB  |  149 lines

  1. t%! => &.Laser.Utils.Font.Print
  2.  
  3. /reencsmalldict 12 dict def
  4. /ReEncodeSmall
  5. {reencsmalldict begin
  6.  /newcodesandnames exch def
  7.  /newfontname exch def
  8.  /basefontname exch def
  9.  /basefontdict basefontname findfont def
  10.  /newfont basefontdict maxlength dict def
  11.  basefontdict
  12.  {exch dup /FID ne
  13.   {dup /Encoding eq
  14.    {exch dup length array copy
  15.     newfont 3 1 roll put}
  16.    {exch newfont 3 1 roll put}
  17.    ifelse
  18.   }
  19.   {pop pop}
  20.   ifelse
  21.  }forall
  22.  newfont /FontName newfontname put
  23.  newcodesandnames aload pop
  24.  newcodesandnames length 2 idiv
  25.  {newfont /Encoding get 3 1 roll put}
  26.  repeat
  27.  newfontname newfont definefont pop
  28.  end
  29. } bind def
  30.  
  31. /display
  32. { /s exch def /i exch def
  33.   % -- s str cvs print (\n) print flush
  34.   i -1 eq
  35.    { vec 1 s put
  36.      save
  37.        displayfont /xyzzy vec ReEncodeSmall
  38.        /xyzzy findfont mainsize scalefont setfont
  39.        x y moveto ( ) show
  40.      restore
  41.      x 20 add y moveto s str cvs show
  42.    }
  43.    { x y moveto (&) show i 16 str cvrs show
  44.      chars s true put
  45.      s /.notdef ne
  46.        { disp setfont
  47.          x 30 add y moveto 1 string dup 0 i put show
  48.          maintext
  49.          x 50 add y moveto s str cvs show
  50.        } if
  51.    } ifelse
  52.      /y y mainsize sub 0.5 sub def
  53.       y 25 lt i 64 mod 63 eq or { /y 798 def /x x 110 add def
  54.                 x 510 gt {showpage /x 30 def} if
  55.               } if
  56. } bind def
  57.  
  58. /listallfonts {
  59.   % prints a single page with the names of all
  60.   % the fonts in the font directory.
  61.  
  62.   /Courier-Bold findfont 15 scalefont setfont
  63.   /str 40 string def
  64.   /entry 0 def
  65.   /y 800 def
  66.  
  67.   FontDirectory {
  68.     pop /displayfont exch def
  69.     (\n) print
  70.     displayfont str cvs dup print
  71.     60 y moveto show 
  72.     (, \() print
  73.     entry str cvs print
  74.     (\)) print flush
  75.     30 y moveto entry str cvs show
  76.     /y y 18 sub def
  77.     /entry entry 1 add def
  78.   } forall
  79.   showpage
  80. } bind def
  81.  
  82. /printallfonts {
  83.   % prints all the fonts in the font directory on page per font
  84.  
  85.   /which 0 def
  86.   FontDirectory {
  87.     pop which exch mark 3 1 roll
  88.     printentirefont
  89.     /which which 1 add def
  90.   } forall
  91. } bind def
  92.  
  93. /printentirefont {
  94.   % Takes a fontname and an optional number on the stack
  95.   % i.e. mark 99 /Times-Roman printentirefont
  96.   %      mark /Test printentirefont
  97.  
  98.   /displayfont exch def  % keep the first argument
  99.   /mainsize 8.8 def
  100.   /examplesize 16 def
  101.   /headingsize 14 def
  102.   /maintext { /Palatino-Roman findfont mainsize 1 sub scalefont setfont } bind d
  103. ef
  104.   /headingtext { /Times-Bold findfont headingsize scalefont setfont } bind def
  105.   /str 40 string def
  106.   /vec [ 32 /.notdef ] def
  107.  
  108.   headingtext
  109.   displayfont str cvs
  110.   30 810 moveto dup show print
  111.  
  112.   250 810 moveto
  113.   statusdict begin
  114.     40 string printername show
  115.     ( PS ) show version show ( Rev. ) show revision 20 string cvs show
  116.   end
  117.  
  118.   counttomark 0 ne {
  119.     str cvs
  120.     ( \() dup show print
  121.     dup show print
  122.     (\)) dup show print
  123.   } if
  124.   cleartomark (\n) print flush
  125.   displayfont findfont examplesize scalefont setfont
  126.   30 135 moveto (THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG) show
  127.   30 110 moveto (the quick brown fox jumps over the lazy dog) show
  128.   30  85 moveto (! " # $ % & ^ ~ @ * ? | _ 0 1 2 3 4 5 6 7 8 9) show
  129.   30  60 moveto (+ - = \( \) [ ] { } < > ` ' : ; . , / \\) show
  130.   maintext
  131.   save
  132.     /disp displayfont findfont mainsize scalefont def
  133.     /chs disp /CharStrings get def
  134.     /chars 400 dict def
  135.     chs { pop chars exch false put } forall
  136.     /enc disp /Encoding get def
  137.     /x 30 def
  138.     /y 798 def
  139.     0 1 255 { dup enc 2 -1 roll get display } for
  140.     chars { {pop} {-1 exch display} ifelse } forall
  141.     showpage
  142.   restore
  143. } bind def
  144.  
  145. % Insert test font here
  146.  
  147. % mark /Courier printentirefont
  148. % mark /Times-Roman printentirefont
  149.