🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #6000

Re: font listing

#6000
From: Bruce Cockburn
Date: Tue, 14 May 1991 20:50
147 lines
4350 bytes
%! => &.Laser.Utils.Font.Print

/reencsmalldict 12 dict def
/ReEncodeSmall
{reencsmalldict begin
 /newcodesandnames exch def
 /newfontname exch def
 /basefontname exch def
 /basefontdict basefontname findfont def
 /newfont basefontdict maxlength dict def
 basefontdict
 {exch dup /FID ne
  {dup /Encoding eq
   {exch dup length array copy
    newfont 3 1 roll put}
   {exch newfont 3 1 roll put}
   ifelse
  }
  {pop pop}
  ifelse
 }forall
 newfont /FontName newfontname put
 newcodesandnames aload pop
 newcodesandnames length 2 idiv
 {newfont /Encoding get 3 1 roll put}
 repeat
 newfontname newfont definefont pop
 end
} bind def

/display
{ /s exch def /i exch def
  % -- s str cvs print (\n) print flush
  i -1 eq
   { vec 1 s put
     save
       displayfont /xyzzy vec ReEncodeSmall
       /xyzzy findfont mainsize scalefont setfont
       x y moveto ( ) show
     restore
     x 20 add y moveto s str cvs show
   }
   { x y moveto (&) show i 16 str cvrs show
     chars s true put
     s /.notdef ne
       { disp setfont
         x 30 add y moveto 1 string dup 0 i put show
         maintext
         x 50 add y moveto s str cvs show
       } if
   } ifelse
     /y y mainsize sub 0.5 sub def
      y 25 lt i 64 mod 63 eq or { /y 798 def /x x 110 add def
                x 510 gt {showpage /x 30 def} if
              } if
} bind def

/listallfonts {
  % prints a single page with the names of all
  % the fonts in the font directory.

  /Courier-Bold findfont 15 scalefont setfont
  /str 40 string def
  /entry 0 def
  /y 800 def

  FontDirectory {
    pop /displayfont exch def
    (\n) print
    displayfont str cvs dup print
    60 y moveto show 
    (, \() print
    entry str cvs print
    (\)) print flush
    30 y moveto entry str cvs show
    /y y 18 sub def
    /entry entry 1 add def
  } forall
  showpage
} bind def

/printallfonts {
  % prints all the fonts in the font directory on page per font

  /which 0 def
  FontDirectory {
    pop which exch mark 3 1 roll
    printentirefont
    /which which 1 add def
  } forall
} bind def

/printentirefont {
  % Takes a fontname and an optional number on the stack
  % i.e. mark 99 /Times-Roman printentirefont
  %      mark /Test printentirefont

  /displayfont exch def  % keep the first argument
  /mainsize 8.8 def
  /examplesize 16 def
  /headingsize 14 def
  /maintext { /Palatino-Roman findfont mainsize 1 sub scalefont setfont } bind def
  /headingtext { /Times-Bold findfont headingsize scalefont setfont } bind def
  /str 40 string def
  /vec [ 32 /.notdef ] def

  headingtext
  displayfont str cvs
  30 810 moveto dup show print

  250 810 moveto
  statusdict begin
    40 string printername show
    ( PS ) show version show ( Rev. ) show revision 20 string cvs show
  end

  counttomark 0 ne {
    str cvs
    ( \() dup show print
    dup show print
    (\)) dup show print
  } if
  cleartomark (\n) print flush
  displayfont findfont examplesize scalefont setfont
  30 135 moveto (THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG) show
  30 110 moveto (the quick brown fox jumps over the lazy dog) show
  30  85 moveto (! " # $ % & ^ ~ @ * ? | _ 0 1 2 3 4 5 6 7 8 9) show
  30  60 moveto (+ - = \( \) [ ] { } < > ` ' : ; . , / \\) show
  maintext
  save
    /disp displayfont findfont mainsize scalefont def
    /chs disp /CharStrings get def
    /chars 400 dict def
    chs { pop chars exch false put } forall
    /enc disp /Encoding get def
    /x 30 def
    /y 798 def
    0 1 255 { dup enc 2 -1 roll get display } for
    chars { {pop} {-1 exch display} ifelse } forall
    showpage
  restore
} bind def

% Insert test font here

% mark /Courier printentirefont
% mark /Times-Roman printentirefont
Technical Details
Message-ID: <7064@acorn.co.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!acorn!bcockburn
References: <JNP.91May13122843@tnds09.tele.nokia.fi>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!acorn!bcockburn
From: bcockburn@acorn.co.uk (Bruce Cockburn)
Newsgroups: comp.lang.postscript
Subject: Re: font listing
Message-ID: <7064@acorn.co.uk>
Date: 14 May 91 20:50:27 GMT
References: <JNP.91May13122843@tnds09.tele.nokia.fi>
Sender: daemon@acorn.co.uk
Distribution: comp
Organization: Acorn Computers Ltd, Cambridge, England
Lines: 147