[alt.sources] Printing list of available fonts on LW+

perry@ccssrv.UUCP (Perry Hutchison) (10/18/89)

In article <3564@dgis.daitc.mil> generous@dgis.daitc.mil (Curtis Generous)
writes:
>A while back, someone had posted a test program to get a LW+ to print
>a listing of all of the built-in fonts that were available.  Does
>someone have a copy of this?

Here is my version.  For each font in the FontDirectory, it will print the
name of the font and some sample text, at 10 points.  (The font name will
look a bit strange if the font uses a non-standard encoding.  Among the
"standard" 35 fonts, only Symbol and ZapfDingbats exhibit this problem.)

%!
% show a sample of each font in FontDirectory
%
/str 40 string def
/nf 0 def

50 700 translate

FontDirectory
{
    0 50 moveto
    pop dup findfont 10 scalefont setfont
    str cvs show
    0 currentpoint exch pop moveto
    0 12 neg rmoveto
    (The quick brown fox jumped over the lazy dogs.  1234567890) show
    0 currentpoint exch pop moveto
    0 12 neg rmoveto
    (THE QUICK BROWN FOX JUMPED OVER THE LAZY DOGS) show
    newpath
    /nf nf 1 add def
    nf 14 ge
    {
        showpage
        /nf 0 def
        50 700 translate
    } {
        0 50 neg translate
    } ifelse
} forall

nf 0 gt { showpage } if

% end of font sampler