The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Поиск:  Каталог документации | postscript

PostScript monthly FAQ v2.4 07-18-95 [01-04 of 11]

Useful facts about the PostScript graphics programming language
                              -- PostScript -- 

                            Answers to Questions 

                    (the comp.lang.postscript FAQ v2.4) 

                              Allen Braunsdorf 

                        [email protected] 






                     This FAQ is formatted as a digest. 

                Most news readers can skip from one question 

                to the next by pressing control-G. GNUs uses 

                   C-c C-n to skip to the next question. 


    Changes since the last version are marked with a '|' in the table 
    of contents and in the sections in the text-only format of the FAQ. 

    Now that there is Linux and NetBSD and BSD 386 UNIX IBM PC (and 
    clone) users can run any of the X-windows and UNIX programs in the 
    utilities section. See any of comp.os.linux.{ 
    admin,development,help,misc}. Also, there is now GhostScript for 
    the Macintosh. 

    Many thanks to Dan Carrigan for reformatting the books and 
    publishers section. 

    The utilities index from the comp.sources.postscript FAQ will be 
    posted in comp.lang.postscript now too. 

    Please help fix the FAQ! All comments should be mailed to 
    [email protected]. My favorite way to receive a change 
    suggestion is when it is accompanied by a section of the FAQ that 
    is edited and mailed to me verbatim as an example. If you would 
    like to contribute, please read the section ``about the FAQ'' 
    first. Thank you! 

    Books and programs are referred to by name only. See the book 
    sections for book information, and the comp.sources.postscript FAQ 
    for a full list of all PostScript related programs. I have archived 
    a number of the small utilities in 
    wilma.cs.brown.edu:pub/postscript. You can get the 
    comp.sources.postscript FAQ from 
    wilma.cs.brown.edu:pub/comp.sources.postscript. 

    Related FAQs: comp.text, comp.text.tex, comp.fonts, comp.graphics, 
    comp.sys.mac.apps, comp.sources.postscript. 

    Table of Contents 


    This FAQ has 11 sections. It is available by anonymous ftp to 
    wilma.cs.brown.edu:pub/comp.lang.postscript/FAQ.txt in ASCII, and 
    there are also LaTeX, DVI, and PostScript formats. 

  
      1 General Questions 
         1.1 What is PostScript? 
         1.2 How can I tell how many pages my document will have? 
         1.3 How can I print just one page or a few pages from a big 
         1.4 How can I print more than one page per sheet of paper? 
         1.5 How can I edit a PostScript picture? 
         1.6 How can I print PostScript on a non-PostScript printer? 
         1.7 How do I print a file containing 8-bit characters? 
         1.8 What other graphics languages are there? 
      2 Printers 
         2.1 How can I get my printer to talk back to me? 
         2.2 Should I leave my printer on? 
         2.3 How do you print double-sided on a single-sided printer? 
         2.4 How do I suppress the power-on start page? 
         2.5 How do I make a downloaded font ``persistent''? 
         2.6 How do I remove a persistent (``permanent'') downloaded font? 
         2.7 How do I reset the printer without power-cycling? 
         2.8 About saving files 
         2.9 What's the control-D business? 
         2.10 Why does the printer say ``still busy'' when my document is 
         2.11 How should I set up my spoolers? 
         2.12 What are PPD files? 
         2.13 What's a timeout error? 
         2.14 Can I tell if my printer is color or black/white? 
      3 Formats and Conversions 
         3.1 How can I convert PostScript to some other graphics format? 
         3.2 How can I convert PostScript to a bitmap or pixmap? 
         3.3 How can I convert HPGL to PostScript? 
         3.4 How can I convert DVI to PostScript? 
         3.5 How can I convert HP Laserjet language (PCL) to PostScript? 
         3.6 How can I convert TeX PK format font to PostScript? 
         3.7 How do I embed PostScript into troff? 
         3.8 How do I embed PostScript into LaTeX or TeX? 
         3.9 How can I convert an image to PostScript? 
         3.10 How can I convert ASCII text to PostScript? 
         3.11 How can I convert PostScript to ASCII? 
         3.12 How do I convert between PFB, PFA, Mac, PFM, and AFM? 
      4 Fonts  
         4.1 What are .PFB and .PFA files? 
         4.2 How does Macintosh Store PostScript Fonts?
         4.3 How can I convert a PostScript font to TeX's PK format? 
         4.4 Why are Adobe fonts hidden? 
         4.5 How do I get bitmap representations of Adobe fonts? 
         4.6 What are some good ftp sites for fonts? 
         4.7 How can I re-encode a font? 
         4.8 What's the difference between a Type 1 and a Type 3 font? 
         4.9 What vendors sell fonts for PostScript printers? 
         4.10 What are ATM fonts? 
         4.11 What are Multiple Master Fonts? 
         4.12 Do I need a Level Two printer to use Multiple Master Fonts? 
         4.13 What are Type 4 fonts? 
         4.14 What are Type 5 fonts? 
         4.15 Is there an editor for Type 1 Fonts? 
      5 Books 
         5.1 Books 
         5.2 Publishers 
      6 About Adobe 
         6.1 How do I get in touch with Adobe? 
         6.2 What can Adobe do for me? 
      7 Programming in PostScript 
         7.1 What is PostScript level 2? 
         7.2 Should I learn level 2 PostScript? 
         7.3 Where can I find examples of PostScript code? 
         7.4 What is the physical size of the page? 
         7.5 What is the Imagable Area of the page 
         7.6 Why can't I do a pathforall after a charpath ? 
         7.7 How do I center a string of text around a point? 
         7.8 How can I concatenate two strings together? 
         7.9 What do I do when I get stack overflow/underflow? 
         7.10 How can I print in landscape mode? 
      8 Computer-specific PostScript 
         8.1 Sun Workstations 
         8.2 IBM PC 
         8.3 Apple Macintosh 
         8.4 NEXTSTEP
      9 Encapsulated PostScript 
         9.1 What is Encapsulated PostScript? 
         9.2 What are EPSI and EPSF? 
         9.3 How do I convert PostScript to EPS? 
         9.4 How do I get the bounding box of a PostScript picture? 
      10 About The Comp.Lang.PostScript FAQ 
         10.1 The PostScript FAQ: What is it? 
         10.2 How to get the FAQ files 
         10.3 How to write a FAQ answer 
         10.4 The FAQ can contain LaTeX and PostScript inserts 
         10.5 Revising the FAQ 
         10.6 How to submit new information 
         10.7 How to add a program description to the FAQ index 
         10.8 How to add a book description to the FAQ 
         10.9 Questions that need answers 
      11 About PostScript 2 
         11.1 What printers support Level 2 PostScript? 
         11.2 What is PostScript Level 2? 
         11.3 [ Color Extensions ] 
         11.4 [ Composite Font Extensions ] 
         11.5 [ Display PostScript Extensions ] 
         11.6 [ Overview of Level 2 Features ] 
         11.7 Filters 
         11.8 Binary Encoding 
         11.9 Optimized graphics operators 
         11.10 Optimized text operators 
         11.11 Forms 
         11.12 Patterns 
         11.13 Images 
         11.14 Composite Fonts 
         11.15 New Color Spaces 
         11.16 New screening/halftoning technology 
         11.17 Improved printer support features 
         11.18 Interpreter parameters 
         11.19 Resources 
         11.20 Dictionaries 
         11.21 When did Level 2 products come available? 
         11.22 Are Level 1 and Level 2 implementations compatible? 
  


    1 General Questions 


    1.1 What is PostScript? 

    PostScript is a page description programming language. 

    It is perhaps the most versatile and loved language for printers, 
    being used in printers world-wide. It is capable of drawing to 
    computer screens and any kind of drawing device. PostScript is 
    interpreted, stack based and has latent typing. It somewhat 
    resembles the computer language FORTH. 

    A number of programmers write PostScript programs directly for a 
    variety of drawing applications. The NeXTSTEP Operating System, 
    running on Intel-486 and Motorola machines, uses Display PostScript 
    Level II to manage the display. However, PostScript programs are 
    usually documents meant to be printed that have been generated by a 
    program written in some compiled language. 


    1.2 How can I tell how many pages my document will have? 

    The easiest way to count pages is view your document on-line with a 
    PostScript previewer. Some previewers like Ghostview and GSPreview 
    count the pages for you. (See the comp.sources.postscript FAQ, 
    which has a section ``PostScript Interpreters and Utilities''.) 

    If your document is generated by a program compliant with the 
    Document Structuring Conventions, you should be able to just count 
    the number of ``%%Page:'' comments imbedded in the document. 
    With UNIX you can type 
  
  grep -c %%Page: document.ps
  
    to do this counting. (See Section 9, ``Encapsulated PostScript''.) 

    You could use the program pspages posted to 
    comp.sources.postscript, volume 2, issue 5, by Kevin Grover. 

    The only completely reliable way to count pages is to ask the 
    printer after the job is printed. PostScript printers maintain a 
    page counter that can be queried before and and after the job is 
    printed, and the page count is a simple subtraction. This tends to 
    require rather sophisticated spooling systems and a communications 
    channel that is bidirectional. However, some printers allow you to 
    submit jobs on one port, and issue queries on another. 

    Send this PostScript through a bidirectional I/O port and you'll 
    get back the page count, nominally the total number of pages 
    printed since manufacture: 

    statusdict begin pagecount == end flush 

    Experts using a level 2 printer can use the SerialOff.PS and 
    SerialEHandlder.ps programs to communicate bidirectionally to the 
    printer. 


    1.3 How can I print just one page or a few pages from a big 
    document? How can I print pages in reverse order? 

    Try using a host-specific program, like the UNIX command psrev, 
    which is part of the TranScript suite of software from Adobe 
    Systems. Or use the more general utilities Ghostview, psutils or 
    psxlate. 

    There is no guarantee that a given PostScript document can be split 
    in such a manner. The reason is that some programs which generate 
    PostScript code don't conform to the Adobe Document Structuring 
    Conventions (DSC). (See Section 9, ``Encapsulated PostScript''.) A 
    notable example of this is Microsoft Word. 


    1.4 How can I print more than one page per sheet of paper? 

    Use psnup or pstext or enscript. 

    These programs redefine the PostScript ``showpage'' command to do 
    multiple PostScript pages per physical page. If one program doesn't 
    work with a complex document, try out other ones. 

    Some PostScript programs can't work with these programs because 
    they break the EPS conventions (See Section 9, ``Encapsulated 
    PostScript''.). The reason is that some Postscript operators (such 
    as initgraphics, the list is in the Red book) change the printer 
    state so "violently", that software trying to do things like n-up 
    will get confused. Theoretically, an EPS shouldn't have any of 
    these operators, but it may not really be an EPS, or there may be a 
    weird interaction between TeX, the EPS and the inclusion mechanism 
    that breaks psnup. 


    1.5 How can I edit a PostScript picture? 

    If you know the PostScript programming language, just use any text 
    editor to edit the code directly. 

    If you want to do it visually, you can use Canvas on the Macintosh. 
    Arts & Letters software package from Computer Support Corporation 
    is supposed to be able to read arbitrary EPS files, using a 
    software converter called Decipher. Also, Island Graphics has a 
    trio of software packages called, appropriately, Island 
    Draw/Paint/Write. This is also supposed to include a full-blown 
    PostScript interpreter, and be able to read and edit arbitrary 
    PostScript files. 


    1.6 How can I print PostScript on a non-PostScript printer? 

    You need a tool that converts to something that your printer knows 
    how to print. Use Freedom of Press, GhostScript, pageview, TScript, 
    or UltraScript PC. Or, use a printer cartridge if your printer 
    manufacturer sells one. 


    1.7 How do I print a file containing 8-bit characters? 

    If you only have Transcript you just don't. Transcript uses 
    "enscript" to convert a "text" file to a PostScript file and 
    "enscript" is not able to deal with 8-bit characters. 

    You have to use one of the many programs that convert text to 
    PostScript, like a2ps, which not only handles the 8-bit characters 
    in a very nice way using the standard ISO Latin 1 character 
    encoding, but it also produces outputs in a series of very well 
    set, nice an paper saving formats, much nicer than the ones 
    produced by enscript. 


    1.8 What other graphics languages are there? 

    HPGL is for pen plotters. PCL is for HP Laser printers (and 
    compatibles). Both are by HP, and PCL5 is supposed to allow 
    inclusion of HPGL commands, preceded by an appropriate escape code, 
    however I have found this to give errors and abort even for simple 
    HPGL code that plots fine on a plotter. 

    2 Printers 


    2.1 How can I get my printer to talk back to me? 

    Experts using a level 2 printer can use the SerialOff.PS and 
    SerialEHandlder.ps programs to communicate bidirectionally to the 
    printer. 

    If you just need the error returns from the printer, you can spawn 
    a 
  
  cat < port >> logfile&
  
    in your system startup. Then you will get a log of everything the 
    printer says. This works on any serial-port connected printer. 


    2.2 Should I leave my printer on? 

    Most laser printers consume several hundred watts while idle in 
    order to keep the fuser warm. A few models shut down automatically 
    after a while, and this feature seems to be the wave of the future. 

    Wear-and-tear due to power cycling is no longer the problem it once 
    was. The advice in the FAQ would have been appropriate in the 
    1970s, but no longer. A good modern rule of thumb is to turn off 
    electronic equipment if it won't be used for a few hours (overnight 
    or weekends), otherwise to leave it on. 


    2.3 How do you print double-sided on a single-sided printer? 

    The biggest problem comes in jamming when you feed the document 
    through the second time to print the backside. To minimize this 
    problem, you want to minimize the curl that the paper acquires in 
    passing through the printer. So, if your printer normally stacks 
    face down (to make the page order come out right) rearrange it 
    (often this involves flipping out a plastic paper catcher on the 
    end) so the pages feed straight through and stack face up. Then 
    acquire and build psutils, and run your document through the 
    following commands: 

  
       pstops '2:0'           <original.ps >odd.ps
       pstops '2:1U@1(1w,1h)' <original.ps >even.ps
  
    This puts the even and odd pages in different files, and rotates 
    the even pages 180 degrees so the top and bottom are reversed. This 
    lets you feed the paper back through with the old trailing edge at 
    the front; since pages get the most severe curl at the leading edge 
    this also helps reduce jamming. Print odd.ps, flip the output pile 
    face down and backwards, put it back in the input magazine, and 
    print even.ps. 

    If the printer is fed by a shared print queue, you can leave the 
    paper magazine out after you put the first pass pages into it, 
    before you submit the second half, then make sure your job is at 
    the front of the queue (waiting for you to replace the paper tray) 
    before you reinsert the tray. 

    Alternatively, particularly with serially-interfaced printers, 
    there's a long enough delay to pull the paper tray out between two 
    print jobs, so you can submit them both, then pull the tray out as 
    soon as the last page of the first job finishes. The ``pstops'' 
    invocations report how many pages they emit, so you can count pages 
    to determine when the first one is done. 


    2.4 How do I suppress the power-on start page? 

    Disabling the start page is described in your printer's PostScript 
    supplement. The most common sequence is ``serverdict begin 0 
    exitserver statusdict begin false setdostartpage end''. 


    2.5 How do I make a downloaded font ``persistent''? 

  
  %!PS-Adobe-2.0 ExitServer
  %%BeginExitServer: 0
  serverdict begin 0 exitserver
  %%EndExitServer
  % Test for existence of font, abort if present.
  % This won't work on a printer with a hard disk!
  /str 32 string def
  /Eurostile dup FontDirectory exch known
  { str cvs print ( is already loaded!\n) print flush quit }
  { (loading font ) print str cvs print (\n) print flush }
  ifelse
  %% Font follows...
  
    The part following ``%%EndExitServer'' is optional. If you use 
    it, change Eurostile to the name of the font. The default PFA 
    behavior is to use up additional VM for the new copy if another 
    copy has already been downloaded. 


    2.6 How do I remove a persistent (``permanent'') downloaded font? 

    In PostScript Level 2, you can use the undefinefont operator to 
    remove fonts selectively. 

    The only reliable method in PostScript Level 1 is to restart the 
    printer, for example with: 

  
    serverdict begin 0 exitserver
    systemdict /quit get exec
  
    Of course, the real solution is just to not download persistent 
    fonts unless you really want them to persist indefinitely. If you 
    want them only for one job, download them as part of the job. 


    2.7 How do I reset the printer without power-cycling? 

    Most printers can be reset by issuing ``serverdict begin 0 
    exitserver systemdict /quit get exec''. 


    2.8 About saving files 

    Adobe recommends that driver writers do not put EOT (control-D) 
    into files when saving to disk. Normally, the EOT is a part of the 
    protocol for parallel and serial ports and never hits the 
    PostScript interpreter. 

    Drivers that do embed EOD can create problems for devices that 
    allow other communication methods (e.g. AppleTalk, Ethernet, and 
    SCSI) where the EOT is not part of the communications protocol. It 
    is useful to redefine EOT in these instances so that the 
    interpreter does not generate an error. The recommended 
    redefinition is: 

  
                   (\004) cvn {} def
  
    This should convert any stand-alone embedded EOTs into a null 
    procedure. This definition does not cause all 004 characters to be 
    consumed, it just prevents an "undefined" error if you try to 
    execute one. 


    2.9 What's the control-D business? 

    PostScript printers communicating over serial lines use control-D 
    as an end of job indicator. The host computer should then wait for 
    the printer to send a control-D back to indicate that the job has 
    finished. Managing the serial protocol between host and printer 
    should be done by some form of print service, but if you're unsure 
    whether your print service is doing it, it's an idea to send one 
    yourself. 

    PC type computers frequently do not have any kind of printer 
    manager and applications end up sending control-D characters to the 
    printer, sometimes before and after a job. PC applications 
    frequently embed a control-D as the first character in the print 
    file, presumably to flush out any other jobs, and thereby breaking 
    the Adobe Document Structuring Conventions. There is a way to turn 
    off generation off the control-D in Windows (anybody know it?). 

    According to the PRINTERS.WRI file that is included with MS Windows 
    3.x and up, you can place a line 

  
                  CtrlD=0
  
    in the WIN.INI sections for any postscript printers for which you 
    wish to supress the Control-D generation. This usually works as 
    long as you're using a specific printer, i.e. Apple LaserWriter, 
    QMS820, etc ] . However if you use the generic ``PostScript 
    printer'' driver, it does not work. There is a freeware program 
    called ctrld that will let users select if a given ps driver should 
    output control-D's or not. It can be found at ftp.cica.indiana.edu 
    in the file ftp/pub/pc/win3/misc/ctrld10.zip. 

    The shareware package WLPRSPL (an LPR spooler for Windows) includes 
    a convenient utility program for listing the relevant printers and 
    turning the option off or on. 

    If you want to prevent applications from doing this, you could use 
    a spooler which would look at the end of every outgoing file and 
    drop the control-D on the end if there happened to be one. 

    If you want a spooler, check out lprps. 


    2.10 Why does the printer say ``still busy'' when my document is 
    done printing? 

    Sometimes when you finish a print job, the printer ``Ready'' light 
    keeps flashing for a minute or so. Somehow, the printer has 
    received some character(s) after the control-D which was sent 
    immediately after the PostScript file. The most common is that a 
    newline has been inserted after the control-D. The printer took 
    these character(s) to be another program, and eventually timed-out 
    while waiting for the rest of it. This can happen because of the 
    host not waiting for the printer to finish. 


    2.11 How should I set up my spoolers? 

    Since PostScript usually is prefixed with ``%!'', it's easy to 
    educate your spooler to autoselect between passing raw PostScript 
    through to the printer or doing an ``ASCII-to-PostScript'' 
    conversion first. There are many packages that will do this, 
    including Transcript and psxlate. 

    Unfortunately, many PostScript applications generate PostScript 
    without a proper ``%!'' magic cookie. 

    The spooler should be responsible for transmitting the ``job 
    termination code'' (a control-D on serially-connected printers) to 
    the printer, not the application. Do yourself a favor and disable 
    (or filter out) control-Ds in your applications and generate them 
    in the spooler. This will be far more reliable in the face of 
    arbitrary input. 


    2.12 What are PPD files? 

    Adobe Postscript Printer Description (PPD) files describe how to 
    use the special features for a specific Postscript printer. They 
    are suppose to be human-readable, but they are really only readable 
    by PostScript gurus. It is the responsibility of the printer 
    manufacturer to supply PPD files. However, the Adobe mail server 
    has many of them. (see the Section 6, ``About Adobe'') 

    Adobe Technical Document 5003 - PPD Specification describes how to 
    read and parse PPD files. You can find it on the Adobe mail server, 
    or by anonymous ftp to ftp.adobe.com:/pub/adobe/Documents/5003.PPD 
    _Spec.ps. 


    2.13 What's a timeout error? 

    The wait timeout is the maximum time the PostScript interpreter 
    will wait for input before aborting. The timeout interval begins 
    when the interpreter finishes executing everything it has received 
    so far and starts waiting for the host to send it more data. If 
    this timeout expires and no more data arrives, a timeout occurs. 

    In particular, a compute-bound job (or one that goes into an 
    infinite loop) will not encounter a wait timeout, since it is not 
    waiting. The long diatribe about the need to "keep sending stuff" 
    and problems with long compute-bound jobs is totally off the mark. 
    The data channel may stop due to flow control, and may stay stopped 
    for long periods if the printer is very busy. This is perfectly OK 
    and won't cause a timeout. 

    Don't disable the wait timeout. The whole point of the wait timeout 
    is to prevent the interpreter from being indefinitely tied up by a 
    host application that has crashed, a communication channel that has 
    been disconnected, or whatever. This is particularly important for 
    networked printers. The only situation in which disabling timeouts 
    is appropriate is when debugging applications or drivers, since you 
    don't want the printer timing out while the host is at a breakpoint 
    or something. 


    2.14 Can I tell if my printer is color or black/white? 

    If you tried testing for the presence of ``colorimage'', your 
    application will fail on PostScript level 2 printers. Several 
    applications make this mistake, simply testing for the presence of 
    a color operator (``colorimage'', ``setcmykcolor'', etc.). This is 
    not sufficient -- some level 1 PostScript black and white devices 
    and all level 2 devices include the color operators. 

    However, before you do this, you should ask yourself *why* you want 
    to know. There are really two reasons an application might care 
    about the color capabilities of a printer. 

    1. To determine if the printer will accept PostScript language 
    programs using the color extensions (colorimage, setcmykcolor, 
    etc.) 

    2. To determine if the printer, as currently configured, will 
    actually produce color output. This is what processcolors tells 
    you. 

    These are entirely different questions, and developers should make 
    sure they are asking the right one. (1) is a language compatibility 
    question, similar to the issue of Level 1 versus Level 2 (see red 
    book, appendices A and D). (2) is a device dependent query, which 
    is essentially independent of (1). 

    In particular, it makes sense to ask (2) only if the application 
    intends to take different actions depending on the outcome. For 
    example, a CAD application might paint objects with stipple 
    patterns on a monochrome device but true color on a color device. 
    Or a prepress application might want to query and/or change the 
    many Level 2 page device parameters dealing with production of 
    separations (see PostScript Language Supplement for version 2012 or 
    greater). 

    On the other hand, if an application is not going to do such 
    things, it should ask only question (1). If the printer will accept 
    the color extensions, the application should sent it color output, 
    whether or not the printer will actually produce color. That way, 
    the PostScript language file captures the application's intent, and 
    color will be produced if the file is later diverted to a color 
    printer. 

    Some times it's sensible to make such a test, though. For example, 
    an application might want to display red and green on a color 
    device, but a varying fill pattern on a black and white device 
    since red and green are difficult to distinguish when rendered as 
    gray. 

    In ``statusdict'', the ``processcolors'' operator, if present, 
    returns the number of device colors. Black and white level 2 
    devices I have tested (TI microLaser Turbo, Apple LaserWriter IIg) 
    omit ``processcolors''. Level 2 Color devices (such as the 
    Tektronix Phaser III PXi) include it, and it returns the number of 
    device colors. 

    So, on both level 1 and level 2, the correct technique is to test 
    for the presence of ``processcolors'' in ``statusdict'' and assume 
    black and white if it is not present. If it is present, execute it 
    and test the result for a ``1'', indicating black and white. 

  
          % returns true for black & white, false otherwise
   
          /black-and-white-device
          {       statusdict begin
                  /processcolors where
                  { pop processcolors } { 1 } ifelse
                  end
                  1 eq
          } def
  

    3 Formats and Conversions 

    This section describes formats that can be converted to and from 
    PostScript, and how to convert them. Encapsulated PostScript and 
    Fonts have their own sections. 


    3.1 How can I convert PostScript to some other graphics format? 

    Since PostScript is not just a picture-description language, but in 
    fact a complete programming language, you will need a complete 
    PostScript interpreter to convert or display a PostScript graphic. 
    See the comp.sources.postscript FAQ for an index of all PostScript 
    related programs. 

    Try using Ghostscript or Tailor. 


    3.2 How can I convert PostScript to a bitmap or pixmap? 

    Use Ghostscript, and build the devices under gs pbmraw, pbm.dev, 
    etc. (See devs.mak under the sources for gs) The following converts 
    file.ps in file.ppm: 

    gs -sDEVICE=ppmraw -sOutputFile=file.ppm file.ps 

    Or try using the Ghostscript tools ps2image.ps or pstoppm.ps. Or 
    use the NETPBM tool pstopnm. Netpbm (a descendant of the PBMPLUS 
    utilities) can then convert that image into whatever format you 
    want. 

    You can also use the ImageMagick-tools program ``convert''. Try 
    ftp.x.org in contrib/ImageMagick.tar.Z. 

    If you have the new xv installed, it can now read PostScript files, 
    and it stores them to any format. 


    3.3 How can I convert HPGL to PostScript? 

    Use hp2ps. 


    3.4 How can I convert DVI to PostScript? 

    Use dvips. 


    3.5 How can I convert HP Laserjet language (PCL) to PostScript? 

    Use lj2ps for simple PCL. Alternatively, another lj2ps, from 
    psroff3.0, is a little more complete. 

    hp2pbm can convert all of PCL4 (up to and including rasters, 
    downloaded fonts and macros) into PostScript, G3 and any other 
    PBM-supposed format. 


    3.6 How can I convert TeX PK format font to PostScript? 

    Psroff3.0 contains programs that can convert TeX PK format or HP 
    SFP format fonts into PostScript bitmap fonts along with 
    rearranging encoding, etc. While bitmap bfonts scale poorly, this 
    is sometimes of use in special circumstances. 


    3.7 How do I embed PostScript into troff? 

    Most troffs can be ``coerced'' into including PostScript figures. 
    The best approach is a configuration that takes EPS PostScript and 
    can automatically scale it, or tell troff how big the picture is. 
    Groff and DWB 3 have this built in. 

    psfig is an add-on EPS inclusion handler that can add this 
    capability to other versions of troff, provided that a compatible 
    PostScript driver is used (Psroff 3.0 for ditroff or CAT troff, 
    Transcript for ditroff). See the comp.text FAQ for more detail. 


    3.8 How do I embed PostScript into LaTeX or TeX? 

    You should use an add-on program for seamless PostScript inclusion. 

    Use psfig. 

    If your LaTeX is simple, but your PostScript is fancy, try using 
    LameTeX. 

    If you need a good compromise, use pstricks. 

    See the comp.text.tex FAQ. 


    3.9 How can I convert an image to PostScript? 

    First determine what format your images are in. PBMPLUS will have 
    converters for most image formats. 

    To convert an image to PostScript with the X Window System, you can 
    display the image on the screen, and grab it with xv, which can 
    save the image in a PostScript file. 

    A more general alternative in X Window System would be to use the 
    PPM, PGM and PBM utilities in the X11R4 and X11R5 distributions. 


    3.10 How can I convert ASCII text to PostScript? 

    Unless your printer is smart about raw ASCII, you can't just send 
    the ASCII to a PostScript printer, because the printer will attempt 
    to interpret your ASCII file as PostScript code. You need a program 
    which will wrap some PostScript code around your ASCII file. 

    Try any of the following programs: asciiprint.ps, ato2pps, cz, 
    ETSR, i2ps, lpp, lwf, POSTPRN, printer, psf, psfx80, PSR, ps2txt, 
    pstext, swtext, text2ps, TranScript, spike.ps, enscript, nenscript, 
    a2ps, asc2ps, ascii2ps, crossword.ps, double.ps, landscape.ps, 
    numbered.ps, portrait.ps, or wide.ps. 

    If you want to make something fancy, why not use a word processor? 
    Most of them can ``include'' ASCII directly from a file and produce 
    PostScript. 


    3.11 How can I convert PostScript to ASCII? 

    In general, when you say ``I want to convert PostScript to ASCII'' 
    what you really mean is ``I want to convert MacWrite (which makes 
    PostScript output) to ASCII'' or ``I want to convert somebody's TeX 
    document (which I have in PostScript) to ASCII''. 

    Unfortunately, programs like these (if they're smart) do a lot of 
    fancy stuff like kerning, which means that where they would 
    normally execute the postscript command for 

  
      ``print water fountain''
  
    instead they execute the postscript command for 

  
      ``print wat''      (move a little to get the spacing *just* right)
      ``print er''       (move a little to get the spacing *just* right)
      ``print foun''     (move a little to get the spacing *just* right)
      ``print tain''     (move a little to get the spacing *just* right)
  
    So if I write a program to look through a PostScript file for 
    strings, like ps2ascii.pl, It can't tell where the words really 
    end. Here my program would see 4 strings 

  
  ``wat'' ``er'' ``foun'' ``tain''
  
    And it doesn't see any difference between the spacing between 
    ``found'' and ``tain'' (not a word break) and the spacing between 
    ``er'' and ``foun'' (a real word break). 

    The problem is that PostScript for text formatting is usually 
    produced machine generated by a text formatter. A PostScript 
    generator like dvips might have a special command like ``boop'' 
    that differentiates between a real world break and a fake one. But 
    every text formatter that generates PostScript has their own name 
    for the ``boop'' command. 

    So you really want a ``PostScript to ASCII converter for dvips 
    output''. 

    The only general solution I can see would be to redefine the show 
    operator to print out the currentpoint for every letter being 
    printed, like gs2asc, and then make up an ASCII page based on this 
    by sticking ASCII characters where they go in a two-dimensional 
    array. That would convert PostScript to ASCII ``formatted''. 

    But even that wouldn't solve the problem, because special bitmap 
    fonts and and standard fonts like Symbol don't always print a ``P'' 
    when you say the letter ``P''. Sometimes they print the greek Pi 
    symbol or a chess piece or a ZapfDingBat. 

    Use ps2a, ps2ascii, ps2txt, ps2ascii.ps or ps2ascii.pl. 


    3.12 How do I convert between PFB, PFA, Mac, PFM, and AFM? 

    Write or call Y and Y Software, listed in the fonts section as a 
    vendor. For NEXTSTEP systems, write or call Trilithon Software, 
    also listed in the fonts section as a vendor. 


    4 Fonts 

    This section answers questions about fonts as they pertain to 
    PostScript. See the comp.fonts FAQ for more information about 
    fonts. 


    4.1 What are .PFB and .PFA files? 

    ``PFB'' stands for Printer Font Binary, and is a STORAGE FORMAT in 
    which Adobe Type 1 font programs are usually distributed for IBM PC 
    and compatibles. Many application programs support fonts in PFB 
    format, and refer to them as ``downloadable''. 

    Macintosh uses a radically different binary storage format than PC. 
    See below for some details. 

    PFB files usually appear in several sections, each section preceded 
    by a binary header containing the type of the section (ASCII, 
    binary, or end of file) and the length of the section. Because of 
    the presence of the binary section headers, and the possible 
    presence of binary data sections, PFB files cannot in general be 
    sent directly to a PostScript printer. Application programs like 
    dvips which use fonts in PFB format unpack the font into ASCII 
    format before sending it to the printer. If you would like to use a 
    font which is in PFB format, you must unpack the font to make a PFA 
    (Printer Font ASCII) file. Adobe Systems supply a font downloader 
    for PC's which turns the PFB format into PFA format on the fly as 
    it's being downloaded. 

    ``PFA'' stands for Printer Font ASCII, which is the unpacked 
    version of a PFB file. In PFB, the data is stored as-is. In a PFA, 
    any binary data present in a former PFB file is stored as ``ascii 
    hex''--meaning each byte of binary data is turned into two ASCII 
    characters representing the hexdecimal value. 

    Once you have the PFA file, just send it to the printer ahead of 
    your file, and use the font like any other. There are several 
    programs which can do the conversion from PFB to PFA for you. Try 
    t1utils. 

    Details of the PFB format can be found in Adobe Technical Note # 
    5040, ``Supporting Downloadable PostScript Fonts''. 


    4.2 How does Macintosh Store PostScript Fonts? 

    To start off understanding how Macintosh stores PostScript fonts, 
    first you need to know that a Macintosh file consists of two 
    different parts, called ``forks''. The two forks of a Macintosh 
    file are called the ``resource fork'' and the ``data fork''. 

    The data fork normally contains the data of the file. In the case 
    of a text editor, for instance, the data fork contains the text. 

    The resource fork contains system (resource) information about the 
    file: who owns the file, its icon maybe, and other information. The 
    various bits of information in the resource fork are contained in a 
    complex structure. One of the items is a resource map, detailing 
    the different kinds of resources and their positions in the 
    resource fork. 

    The reason you need to know all this is because PostScript Type 1 
    fonts are stored in the resource fork of Macintosh files. Why this 
    was done is a historical mystery now, because the information could 
    just as easily have been stored in the data fork in a format 
    similar to PFB, and unpacking fonts would have been a whole lot 
    easier. 

    PostScript Type 1 fonts are stored in resources with the name 
    POST''. If you aren't familiar with the layout of resource forks, 
    study the ``Resource Manager'' chapter of the Inside Macintosh 
    books. Details of Macintosh PostScript Type 1 storage format can be 
    found in Adobe Technical Note # 5040, ``Supporting Downloadable 
    PostScript Fonts''. The information in the Adobe Technical Note is 
    incomplete in the sense that you need to understand the layout of 
    Macintosh resource forks to make sense of the information. 

    In the majority of cases, you can assume that the POST resources 
    are stored contiguously in the resource fork. Unfortunately, there 
    are a few cases where this isn't true, and the resulting PFA file 
    will be incorrect. 

    POST resources occur in five types. Type 0 are comments. Type 1 are 
    ASCII data. Type 2 are binary data. Type 3 are end of this font 
    program. Type 4 means that the remainder of this font appears in 
    the data fork of the file! Type 5 means end of file. 

    Having talked about PostScript Type 1 fonts being stored in the 
    resource fork, why is there a case where the font comes out of the 
    data fork? Some PostScript Type 3 fonts are stored in this manner. 


    4.3 How can I convert a PostScript font to TeX's PK format? 

    Use ps2pk or try out the GNU font utilities in fontutils. 


    4.4 Why are Adobe fonts hidden? 

    In PostScript level 1, Adobe's fonts were hidden because they 
    didn't want people pirating copies instead of paying for them. 
    That's why you can't do a pathforall on a charpath. 

    PostScript Level Two has removed the restriction, in the words of 
    the new Red Book, ``for most fonts''. There will still be some 
    vendors who will want to restrict access. Japanese font vendors, 
    for example, are concerned about piracy -- given the work that goes 
    into an 8,000-character Kanji font. 


    4.5 How do I get bitmap representations of Adobe fonts? 

    On the IBM PC, use the Font Foundry program included with the font. 
    If you don't have it, contact Adobe for an upgrade. 


    4.6 What are some good ftp sites for fonts? 

  
  ftp.cs.umb.edu
  sumex-aim.stanford.edu
  archive.umich.edu
  ftp.cica.indiana.edu    /pub/pc/win3/fonts
  colonsay.dcs.ed.ac.uk   /pub/postscript/fonts
  
  
  For the NeXT platform, fonts are available on the NeXT-FTP-archives,
          sonata.cc.purdue.edu :/pub/next/graphics/fonts
          fiasko.rz-berlin.mpg.de :/pub/next/fonts
  
    For Macintosh, look in sumex-aim.stanford.edu, 
    mac.archive.umich.edu, and ftp.cs.umb.edu (192.12.26.23), in 
    pub/tex/ps-screenfonts.tar.Z. 

    Color PostScript samples and many other PostScript programs are 
    available from irisa.irisa.fr. 


    4.7 How can I re-encode a font? 

    See ddev.ps for an example for code that does this. You can find it 
    by ftp to wilma.cs.brown.edu:pub/postscript/ddev.ps. 


    4.8 What's the difference between a Type 1 and a Type 3 font? 

    The Type 1 font format is a compact way of describing a font 
    outline using a well-defined language that can be quickly 
    interpreted. The language contains operations to provide the 
    rasterizer with additional information about a character, known as 
    hints. The hints are additional information which describes how to 
    adjust the representation of the character to make it look good 
    when the font size is small compared to the device resolution. The 
    Type 1 font format is defined in the book ``The Adobe Type 1 Font 
    Format'', also known as the black book, for the colors on its 
    cover. 

    The Type 1 font format has nothing to do with TrueType, which is 
    another font format defined by Apple. The Type 1 font format has 
    been around quite a while, and is used on a wide variety of 
    platforms to obtain scalable fonts. 

    Most clone interpreters will not have Adobe's proprietary rendering 
    technology which interprets font hints to improve the appearance of 
    fonts shown at small sizes on low-resolution devices. The 
    exceptions (PowerPage and UltraScript) have their own hint 
    interpreters. 

    The Type 3 font format is a way of packaging up PostScript 
    descriptions of characters into a font, so that the PostScript 
    interpreter can rasterize them. 

    It is easier to create a Type 3 font program by hand than to create 
    the corresponding Type 1 font program. Type 3 font programs have 
    access to the entire PostScript language to do their imaging, 
    including the 'image' operator. They can be used for bitmapped 
    fonts, although that is certainly not a requirement. The Type 3 
    font format contains no provisions for 'hinting', and as such Type 
    3 font programs cannot be of as high a quality at low resolutions 
    as the corresponding Type 1 font program. 

    Both formats are scalable formats, and both can be run on any 
    PostScript interpreter. However, because of the requirement that a 
    Type 3 font program have a full PostScript interpreter around, Type 
    3 font programs cannot be understood by the Adobe Type Manager. 
    Only Type 1 font programs can. 

    Why bother making a font that's just made up of bitmaps? Once a 
    character from a font has been rendered, the bitmap will be saved 
    in a cache, and another instance of the same character at the same 
    size and orientation can be quickly drawn without recalculation. 

    Because of Adobe Type Manager's wide availability on a large number 
    of platforms (PC, Mac, and Unix), the Type 1 font format makes an 
    excellent cross-platform scalable font standard. 


    4.9 What vendors sell fonts for PostScript printers? 

    PostScript font vendors are many and varied. Here is a partial 
    list. 



    Adobe Systems 
      sells a variety of fonts. With the huge number of third-party 
      Type 1 vendors, in recent years Adobe have specialized in 
      creating their own ``Adobe Originals'' -- high-quality fonts, 
      some of which are their renditions of classic faces (Adobe 
      Garamond) and some of their own devising (Stone, Utopia, ...). 
      Adobe Systems, 1585 Charleston Road, Mountain View, CA 94039. 
      (415) 961-4400 


    AGFA Compugraphic, 
      90 Industrial Way, Wilmington, Massachusetts 01887. (508) 
      658-5600. 


    Bear Rock Technologies 
      specializes in bar code fonts. 4140 Mother Lode Drive, Suite 100, 
      Shingle Springs California 95682. Toll-free sales: (800) 
      232-7625. International: (916) 672-0244. FAX: (916) 672-1103. 
      E-mail: [email protected]. 


    Bitstream, 
      Athenaeum House, Cambridge, MA 02142. (617) 497-6222. 


    Callifonts 
      has a really nice looking set of calligraphy typefaces. P.O. Box 
      224891, Dallas, TX 75222. (214) 504-8808. 


    Casady and Greene, 
      22734 Portola Drive, Salinas, CA 93908. (408) 484-9228. 


    Ecological Linguistics, 
      specializes in non-Roman alphabets. Ecological Linguistics, P. O. 
      Box 15156, Washington D. C. 20003. 


    Emigre Graphics 
      4475 ``D'' Street / Sacramento CA 95819 (800) 944 9021 ] Over 70 
      faces, all PostScript Type 1 ATM compatible, including the 
      omnipresent Modula and infamous Template Gothic. Almost all faces 
      are ``must haves'' for graphic designers. Call for free catalog. 


    The Font Company 
      12629 North Tatum Boulevard, Suite 210, Phoenix Arizona 85032. 
      (602) 998-9711. 


    Image Club, 
      # 5 1902 11th St Southeast, Calgary, Alberta T2G 2G2, Canada. 
      (403) 262-8008. 


    Lanston 
      specializes in display faces. 


    Letraset 
      specializes in fancy kinds of script fonts, Letraset, 40 
      Eisenhower Drive, Paramus, New Jersey 07652. (201) 845-6100 


    Linguists Software 
      specializes in non-Roman alphabets (Farsi, Greek, Hangul, Kanji, 
      etc.) Linguists Software, P. O. Box 580, Edmonds, Washington 
      98020-0580. (206) 775-1130. 


    Monotype, 
      53 West Jackson Boulevard, Suite 504, Chicago, IL 60604. 


    Page Studio Graphics, 
      Chandler, Arizona, specialize in symbols fonts such as Mac icons, 
      keyboards, and others, Page Studio Graphics, 3175 North Price 
      Road, # 1050, Chandler, Arizona 85224. (602) 839-2763. 


    Software Complement 
      specializes in creating logo fonts. 8 Penn Avenue, Metamoras, 
      Pennsylvania 18366 USA. 


    The Font Company 


    TreacyFaces 


    Trilithon Software, 
      Portola Valley, California can supply fonts from the Adobe Type 
      library for NEXTSTEP. If you're working on NEXTSTEP, getting 
      fonts in the correct form with ancillary information and 
      downloaders and such is important. You can convert Mac fonts to 
      NEXTSTEP (PFA) format, but NEXTSTEP demands AFM files as well, 
      and many Mac/PC font vendors omit AFM files because Mac/PC apps 
      don't use them. For Adobe fonts for NEXTSTEP, save yourself a lot 
      of hassle by getting the fonts from Trilithon. 

      If you want non-Adobe fonts for NEXTSTEP, Trilithon Software can 
      supply font conversion tools to go from Macintosh or PC format to 
      NEXTSTEP format. The conversion tools generate AFM files if none 
      are supplied with the fonts, and sanity check AFM files for 
      correctness when they are supplied. 

      Two Ohlone, Portola Valley, California 94028 USA. Telephone: 
      (415) 325-0767, FAX: (415) 325-0768. E-Mail: [email protected]. 


    URW 
      supplies high-quality fonts at low prices. They are also the 
      creators of the top of the line font creation and editing 
      software called Ikarus. URW, 4 Manchester Street, Nashua, New 
      Hampshire 03060. (603) 882-7445. 


    Y and Y Software 
      , 106 Indian Hill, Carlisle Massachusetts 10741 USA. (508) 
      371-3286. Sells a Font Metric Manipulation Package for DOS with 
      lots of interesting utilities. 

    Many more font vendors exist. Look in magazines and other sources. 
    Check the Usenet newsgroup comp.fonts. Look in U & lc, published by 
    ITC, for long lists of vendors. 


    4.10 What are ATM fonts? 

    There has been a rash of misunderstanding about the nature of Type 
    1 fonts and what people call ATM fonts. ATM fonts are Adobe Type 1 
    fonts. ATM stands for Adobe Type Manager -- a utility to render 
    smooth characters on Macintosh and PC screens, from font outlines 
    (Type 1 fonts) instead of using bitmap fonts. In one sense, there's 
    no such thing as an ``ATM font'' -- ATM interprets Type 1 fonts, so 
    there's no need to create a new name. A correctly constructed Type 
    1 font can be interpreted by ATM. 


    4.11 What are Multiple Master Fonts? 

    Multiple Master Fonts are an extension to the Adobe font format. 
    providing the ability to interpolate smoothly between several 
    ``design axes'' from a single font. Design axes can include weight, 
    size, and even some whacko notions like serif to sans serif. 
    Adobes' first Multiple Master Font was Myriad -- a two-axis font 
    with WEIGHT (light to black) on one axis, and WIDTH (condensed to 
    expanded) along the other axis. In the case of Myriad, there are 
    four ``polar'' designs at the ``corners'' of the design space. The 
    four designs are light condensed, black condensed, light expanded, 
    and black expanded. 

    Given polar designs, you can set up a ``weight vector'' which 
    interpolates to any point within the design space to produce a 
    unique font for a specific purpose. So you can get a ``more or less 
    condensed, somewhat black face''. 


    4.12 Do I need a Level Two printer to use Multiple Master Fonts? 

    No -- Multiple Master Fonts can be used on any PostScript printer. 
    Multiple Master Fonts need a new PostScript operator known as 
    makeblendedfont. The current crop of Multiple Master Fonts supply 
    an emulation of this operator so the printer doesn't need this 
    operator. 

    A short tutorial on Multiple Master Fonts and makeblendedfont 
    appears in PostScript by Example, by Henry McGilton and Mary 
    Campione, published by Addison-Wesley. 


    4.13 What are Type 4 fonts? 

    Type 4 fonts are actually Type 3 fonts which contains a Type 1 
    font. They're stored on hard disk in a special way to save space 
    when they're loaded into printer RAM by findfont. Your interpreter 
    must have the extra PostScript operator CCrun to handle Type 4 
    fonts. They are usually used for Kanji (Japanese) characters. 


    4.14 What are Type 5 fonts? 

    Type 5 fonts are actually Type 1 fonts, but stored in printer ROM 
    in a special compressed format. They're also known as CROM fonts 
    (for Compressed ROM fonts). The contents of the CharStrings entries 
    in Type 5 will probably be different from Type 1. 


    4.15 Is there an editor for Type 1 Fonts? 

    Fontographer for the Macintosh and MS-Windows under DOS is 
    available from Altsys Corporation, 269 West Renner Road, 
    Richardson, Texas 75080 USA. (214) 680-2060. 

    Ikarus-M is availble for the Macintosh from URW, Harksheider 
    Strasse 102, 2000 Hamburg 65, GERMANY. (040) 60 60 50 Or URW 
    Software and Type, 4 Manchester Street, Nashua, New Hampshire 
    03060. (800) 229-8791 in USA. (603) 882-7445 otherwise. 

    Acknowledgments 


    This FAQ was compiled based heavily on the contributions of and 
    with the help of Henry McGilton, Dick Dunn, Howard Gayle, Dan 
    Carrigan, Carl Orthlieb, Ed Garay, Robert Lerche, Bruno Hall, Tom 
    Epperly, and Chris Lewis. 

    Also thanks to contributors Paul Balyoz, Karl Berry, Jerry Black, 
    Charles Cashion, Jim DeLaHunt, Leonard Hamey, Chris Herborth, Steve 
    Kinzler, Bill Lee, Timo Lehtinen, Carl Lydick, Otto Makela, Bill 
    Pringle, Tony Valsamidis, and Jamie Zawinski. 

    Special thanks to Ken Porter, who originally compiled and organized 
    this FAQ, and to Jon Monsarrat who built it from there. 

  
  
  Ver  Date     Reason
  ----------------------------------------------------------------
  1.00 12-18-90 Creation by Ken Porter
  1.06  5-29-91 expanded on EPS explanation, general updates
  2.00 10-25-92 Brought up to date and expanded, by Jon Monsarrat
  2.1   5-21-93 Revised because of new comp.sources.postscript group.
  2.2  12-26-93 Finally incorporated all the '93 comments and suggestions.
  2.3  07-07-94 Incorporated early '94 comments and suggestions.  
  2.4  03-04-95 Mostly changed references to maintainer (ab).  
  
  
    This FAQ is copyright (C) 1995 by Allen Braunsdorf. Permission is 
    granted to freely edit and distribute as long as this copyright 
    notice is included. 

    This document was written with the LaTeX language and formatted by 
    LameTeX, the PostScript hacker's LaTeX. 



Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру