🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #7900

Font Listing Program

#7900
From: Malloy
Date: Mon, 30 Jan 1989 19:54
275 lines
8692 bytes
     The following is taken from 'PC Publishing' February 1989.  It
is posted without permission and without any testing of the program.
I will test the program on my Varityper VT600+ printer within the
next few days.

     I am posting as a service to other subscribers to 'PC Publishing'.
If you don't read the mag, then you shouldn't save this program.  On
the other hand, if you don't read the mag, I cannot stop you from
saving the program.  If you have any fixes for any of the possible
typos, mail them to me.

--------------------- Copyright 1988 PC Publishing ---------------------


                   Display PostScript Printer Fonts

     Our PostScript expert offers a program for displaying all
available type faces resident in a PostScript printer or add-on
PostScript controller.

By Ross Smith

     I would like very much to take credit for the PostScript program
that follows and bears my name - or should I say, a name that is the
same as my own.  Unfortunately, I cannot.  The program was written by
my very capable son, who would never let me get by with taking credit,
anyway.  So I am obliged to give credit where credit is due -
reluctantly, I might add, for this is one nifty program that no one
using a PostScript printer should be without.

     Actually, FONTLIST.PS is three programs in one, all of which are
designed primarily to apprise the user of what type faces - internal
and downloaded - are resident in any PostScript printer or add-in
PostScript controller.  The list is bubble sorted, and displayed in a
single Helvetica type face, which enables the program to run very
quickly on any PostScript printer.  FONTLIST is intended to be used to
report quickly the exact nomenclature of each type face - which is
essential for anyone doing PostScript programming.  Downloaded type
faces are distinguished from resident type faces with an asterisk, so
they can be quickly identified.  The program also provides some useful
information about the printer and PostScript interpreter, and memory
still unsued.

     In an second iteration, FONTSHOW.PS displays the same information
as FONTLIST, except that the faces themselves are displayed.  This can
be used to determine which type face would be appropriate for any job.
Because it takes the PostScript interperter much longer to make all
the necessary type face changes, FONTSHOW should be run infrequently.

     In the third iteration, FONT3COL.PS modifies FONTLIST or FONTSHOW
to display the fonts in three columns in landscape mode.  FONT3COL is
designed to be used with an interperter that can access a large number
of type faces from a hard disk, such as the EiconScript interperter
from Eicon Technology, which can currently access up to 100 typefaces.
There are five instructions that must be modified or added to FONTLIST
or FONTSHOW to obtain FONT3COL, all of which are found in the last
column of the program, near the asterisks. We also recommend deleting
the "footnote" command line near the bottom of the program when
FONT3COL is used with an interperter that does not require font
downloading.

     For downloading type face outlines, we use a batch file we call
PSDL.BAT, which looks like this:

echo off
rem psdl.bat 6/15/88 ross smith
:loop
if//==/%1/goto exit
echo Downloading %1
echo serverdict begin 0 exitserver lpt1:
copy c:\psfonts\%1+c:\psfonts\ctrl_d/a lpt1: null:
shift
goto loop
:exit
echo Done

The file CTRL_D is simply a file with a ^D.
LPT1: can be changed to reflect the proper parallel or serial post.

     PSDL can download ant number of type faces entered on the command
line, in the format PSDL CWPQ.PFA, CXPQ.PFA, etc.  Or, typefaces that
are downloaded routinely can be placed in another batch file called,
say, GALLIARD.BAT, where they can be easily downloaded each time they
are required by simply specifying the name of the batch file.  For
instance, the command GALLIARD would send the following string found
in GALLIARD.BAT;

   PSDL CUPQ.PFA CVPQ.PFA CWPQ.PFA CXPQ.PFA

     The same string can be placed at the end of the AUTOEXEC.BAT file
to download a standard set of type faces each time the computer is
booted.

============================== Snip Here ==============================
%!PS-Adobe-2.0
%%Title: fontlist.ps
%%Creator: Ross Smith
%%Freation date: 4 November 1988
%%For: Pc Publishing
%%Copyright (C) 1988 Ross Smith
%%End Comments
%
% procedures
%
% housekeeping procedures
/SaveOne save def
/Workdict 128 dict def
Workdict begin
statusdict/jobname (Fontlist 1.0) put
% prologue
% Program procedure
/bdef {
    bind def
}bind def

% nl
% usage: -nl-
%
% move the currentpoint to the next line
% if the new line would print below the bottom margin
% begin a new column
%
/nl{
    currentpoint exch pop
    dup
    % if
    bottommargin sub 0 ge
    { % then
        leftmargin exch
        pointsize 2 add sub
        moveto
    }
    { % else
        pop
        /leftmargin leftmargin columnwidth add def
        leftmargin topmargin moveto
    } ifelse
} bdef

% printerinfo
% usage: -printerinfo-
%
% display pertinent printer/controller information
%
/printerinfor {
    /str 64 string def

    statusdict begin

    currentdict /product known{
        (Product: ) show
        product show nl
    }if

    currentdict/printername known {
        (Interperter: ) show
        str printername show nl
    }if

    currentdict/revision known {
        (Revision: ) show
        revision str cvs show nl
    }if
    edn %statusdict

    (Version: ) show
    version show nl
    vmstatus/maximum exch def/used exch def pop
    maximum used sub str cvs ( of ) show
    maximum str cvs show (bytes remaning) show nl nl
}bdef
% getfonts
% usage: getfonts array
%
% gets the list of fonts available from the printer
% returns an of string values on the stack
%
/getfonts {
    /fonts FontDirectory length def
    /FontArray fonts array def
    FontDirectory
    {} for all
    0 1 fonts 1 sub {
        /i exch def
        pop
        cvlit 64 string cvs
        /fontname exch def
        FontArray i fontname put
    } for
    FontArray
} bdef

% proc: bubblesort
% usage: array bubblesort sorted array
%
% sorts the array on the stack
% places a new sorted array on the stack
%
/bubblesort {
    dup length array copy
    /v exch def
    /n v length 1 sub def

    n-1 1 {
        /i exch def
        0 1 i 1 sub {
            /j exch def
            /t1 v j get def
            /t2 v j 1 add get def
            t1 t2 gt
            {
                v j t2 put
                v j 1 add t1 put
            } if
        } for
    }for
    v
} bdef

% listfonts
% usage: array listfonts-
% display list of fonts
/listfonts {
    helvetica setfont
    fonts str cvs show (typefaces available:) show nl nl
    {
        /fontname exch def
    fontname cvn findfont/FontType get 3 eq
        {
            -4 0 rmoveto (*) show
        } if
% ***********************************
% include following instruction for FONTSHOW.PS:
%        fontname cvn findfont pointsize scalefont setfont
% ***********************************
        fontname show
        helvetica setfont
        nl
    } forall
} bdef
/footnote {
    nl
    -4 0 rmoveto
    helvetica setfont
    (*Typeface downloaded) show
    } def
% constants
% ***********
/topmargin 720 def %change 720 to 517 for 3 col
/bottommargin 75 def %change 75 to 100 for 3 col
/columnwidth 185 def %change 185 to 250 for 3 col
% ***********
/leftmargin 50 def
/pointsize 10 def
/str 64 def
/helvetica/Helvetica findfont pointsize scalefont def
/helvetica-bold/Helvetica-Bold findfont pointsize scalefont def
%% EndProlog
% main program
% 611 0 translate %use for 3 col ***********
% 90 rotate %use dor 3 col ***********
leftmargin topmargin moveto
helvetica-bold setfont
printerinfo     % print printer/interperter information
getfonts        % get the list of fonts
bubblesort       % sort the list
listfonts       % display list of fonts
footnote        % display downloaded message
showpage        % print the page
%% Trailer
statusdict/jobname () put
end % Workdict
SaveOne restore
%% EOF
Technical Details
Message-ID: <7509@ihlpf.ATT.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!rochester!rutgers!att!ihlpf!cem

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!rochester!rutgers!att!ihlpf!cem
From: cem@ihlpf.ATT.COM (Malloy)
Newsgroups: comp.lang.postscript
Subject: Font Listing Program
Message-ID: <7509@ihlpf.ATT.COM>
Date: 30 Jan 89 19:54:01 GMT
Organization: AT&T Bell Laboratories - Naperville, Illinois
Lines: 275