[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Downloading fonts to printer...



Jefferson R. Lowrey writes 14 May 1999:

>>I don't know the PS routine for adding a font to the FontDict, but
>>I guess it's to be found in the PS Reference somewhere.
>
>Oh darn.  An excuse to buy a postscript reference.  Drat. :-)

I thought you might say something like that. Bart is right: the PS
Reference Manual is on-line. Also, behind Adobe's web site is an ftp
machine:

        ftp://ftp.adobe.com/pub/adobe/devrelations/devtechnotes/

which might be less frustrating.

I'm sorry I can't help directly -- I have three PS books and none of them
say what you have to do to download a font. On  "FontDirectory" the
reference says "Entries are placed in FontDirectory by 'definefont' and are
looked up by 'findfont'." which gives some clue as to where to start.

>It does help.  But, I've still got some what I hope are still MacPerl
>questions...
>
>1) How do I find all printers on the network that are postscript capable?
>     My first thought on this is to do a brute force approach.  Find all
>printers, send postscript to them and trap for errors.
>
>2) Since I do know what printers are on the network, and which ones are
>postscript capable, and which of those I want to monitor the fonts of, how
>do I use that to redirect Dev:Printer to some particular printer device?

It may be easier to find an answer to question 2. If you have a list of PS
printers by name you can get each of them up in turn using the 'Chooser' -
yes?
Now there is an OSAX called 'Set Printer to' which will alllow you to do
this from MacPerl using AppleScript. The following works (once the OSAX is
installed):

        #!perl
        use Mac::AppleEvents;
        $dnam = 'LaserWriter';      # Chooser extension name
        $pnam = 'LaserWriter Plus'; # Printer name

        $evt = AEBuildAppleEvent('gtqp', 'sprt', 'sign', 'MACS', 0, 0,
               "'----':TEXT(\@), pnme:TEXT(\@)", $dnam, $pnam) or die $^E;

        AESend($evt, kAENoReply) or die $^E;
        AEDisposeDesc $evt;

Having got a particular printer connected to the machine, you can then
address it with 'Dev:Printer'. You have two options I think. You could ask
the printer (in PostScript) whether the fonts you are interested in are in
defined in the FontDirectory, or you could ask the printer to send a list
of all the fonts it has in the FontDirectory and then get Perl to look at
the list and see if any of the ones you're interested in are missing. I
think the second option must be preferable. To do this you could modify the
MacPerl script (as before) to read something like:

        while (<PRINTER>) {
            s/\012//g;
            push(@fonts, $_)
        }

        foreach (@fonts) { &look_for_missing_fonts }

Question 1 implies you have a list of printers on the network, but the list
may include non-PS printers. It may be that the 'Chooser' can help here,
since if a PostScript driver icon is clicked on the left-hand side of the
Chooser window only PS printers will appear in the list on the right hand
side. At least I think that is so -- I can't set up a mini-network to test
that statement.

That being so, if you send an AppleEvent which asks for <set printer to
"LaserWriter 8" named "StyleWriter"> an error should result. If you can
find a way of trapping the error without crashing the machine, it will have
established that that particular printer in the list is a non-PS printer.

Hope these thoughts are some help.

Alan Fry



===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org