Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!wang!tegra!phillips From: phillips@tegra.COM (Steve Phillips) Newsgroups: comp.lang.postscript Subject: Re: Interrogating PS printers to find loaded fonts Keywords: fonts download interrogate Message-ID: <1307@harlie.tegra.COM> Date: 22 Aug 90 12:43:46 GMT References: <53@frcs.UUCP> Reply-To: phillips@harlie.UUCP (Steve Phillips) Distribution: comp Organization: Tegra-Varityper, Inc. Billerica, MA Lines: 55 In article <53@frcs.UUCP> paul@frcs.UUCP (Paul Nash) writes: >I have a problem, for which I would like to ask advice. I am in the >process of developing an intelligent printer spooler, which takes >various inputs and translates them to PostScript output, which is >then fed to a PostScript device. The device can be high or low >resolution, and can have any number of resident fonts. I need to be >able to download fonts under control of the spooler, if such fonts >are needed in the print job and are not resident. Obviously, a >downloaded font will remain in the printer's memory until that memory >is needed for, say, another font. That's not so obvious. PostScript doesn't have any automatic method for removing unused fonts - they just work with the save/restore mechanism like everything else in PostScript. In other words, if you download a font with your job without doing an exitserver, the font will disappear at the end of the job. This is because in normal "server mode" operation the printer does a save before each job and a restore afterwards. If you exit server mode before downloading the font (say "serverdict begin 0 exitserver") the font will stay loaded until the printer is turned off or reset. By the way, if you download the font in exitserver mode, make sure you reenter server mode before sending down the actual job to be printed. If you're running over a serial port, just send a control-D (ASCII 4) to do this. Otherwise the job might mess things up so that future jobs don't run correctly. >Is there any way in which I can interrogate the printer (via a serial >port) to find out either which fonts are available or whether a >specific font is available? I do not want to download the font afresh >every time the print job calls for it! Try the following piece of code: % Get list of memory-resident fonts. FontDirectory { pop == } forall % Search for disk-based fonts. First, make sure the % printer supports the filenameforall operator. systemdict /filenameforall known { % List all disk-resident fonts. (fonts/*) { % String is of the form (fonts/fontname). % Strip off "fonts/" prefix. dup length 6 sub 6 exch getinterval % Strip 1st 6 characters. == % Print it out. } 100 string filenameforall } if -- ============================================================================ Steve Phillips Tegra-Varityper, Inc. tegra!phillips@uunet.com Billerica, MA ============================================================================