Postscript Language Reference, Third Edition
Total Page:16
File Type:pdf, Size:1020Kb
PostScript® LANGUAGE REFERENCE third edition Adobe Systems Incorporated Addison-Wesley Publishing Company Reading, Massachusetts • Menlo Park, California • New York • Don Mills, Ontario Harlow, England • Amsterdam • Bonn • Sydney • Singapore • Tokyo Madrid • San Juan • Paris • Seoul • Milan • Mexico City • Taipei Library of Congress Cataloging-in-Publication Data PostScript language reference manual / Adobe Systems Incorporated. — 3rd ed. p. cm. Includes bibliographical references and index. ISBN 0-201-37922-8 1. PostScript (Computer program language) I. Adobe Systems. QA76.73.P67 P67 1999 005.13'3—dc21 98-55489 CIP © 1985–1999 Adobe Systems Incorporated. All rights reserved. NOTICE: All information contained herein is the property of Adobe Systems Incorporated. No part of this publication (whether in hardcopy or electronic form) may be reproduced or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written consent of the publisher. PostScript is a registered trademark of Adobe Systems Incorporated. All instances of the name PostScript in the text are references to the PostScript language as defined by Adobe Systems Incorporated unless otherwise stated. The name PostScript also is used as a prod- uct trademark for Adobe Systems’ implementation of the PostScript language interpreter. Except as otherwise stated, any mention of a “PostScript printer,” “PostScript software,” or similar item refers to a product that contains PostScript technology created or licensed by Adobe Systems Incorporated, not to one that purports to be merely compatible. Adobe, Adobe Illustrator, Adobe Type Manager, Chameleon, Display PostScript, Frame- Maker, Minion, Myriad, Photoshop, PostScript, PostScript 3, and the PostScript logo are trademarks of Adobe Systems Incorporated. LocalTalk, QuickDraw, and TrueType are trademarks and Mac OS is a registered trademark of Apple Computer, Inc. Helvetica and Times are registered trademarks of Linotype-Hell AG and/or its subsidiaries. Times New Roman is a trademark of The Monotype Corporation registered in the U.S. Patent and Trademark Office and may be registered in certain other jurisdictions. Unicode is a regis- tered trademark of Unicode, Inc. PANTONE is a registered trademark and Hexachrome is a trademark of Pantone, Inc. Windows is a registered trademark of Microsoft Corporation. All other trademarks are the property of their respective owners. This publication and the information herein are furnished AS IS, are subject to change without notice, and should not be construed as a commitment by Adobe Systems Incorpo- rated. Adobe Systems Incorporated assumes no responsibility or liability for any errors or inaccuracies, makes no warranty of any kind (express, implied, or statutory) with respect to this publication, and expressly disclaims any and all warranties of merchantability, fit- ness for particular purposes, and noninfringement of third-party rights. ISBN 0-201-37922-8 1 2 3 4 5 6 7 8 9 CRS 03 02 01 00 99 First printing February 1999 iii Contents Preface xiii Chapter 1: Introduction 1 1.1 About This Book 3 1.2 Evolution of the PostScript Language 5 1.3 LanguageLevel 3 Overview 6 1.4 Related Publications 7 1.5 Copyrights and Trademarks 9 Chapter 2: Basic Ideas 11 2.1 Raster Output Devices 11 2.2 Scan Conversion 12 2.3 Page Description Languages 13 2.4 Using the PostScript Language 15 Chapter 3: Language 23 3.1 Interpreter 24 3.2 Syntax 25 3.3 Data Types and Objects 34 3.4 Stacks 45 3.5 Execution 46 3.6 Overview of Basic Operators 51 3.7 Memory Management 56 3.8 File Input and Output 73 3.9 Named Resources 87 3.10 Functions 106 3.11 Errors 114 3.12 Early Name Binding 117 3.13 Filtered Files Details 123 3.14 Binary Encoding Details 156 Chapter 4: Graphics 175 4.1 Imaging Model 176 4.2 Graphics State 178 4.3 Coordinate Systems and Transformations 182 iv Contents 4.4 Path Construction 189 4.5 Painting 193 4.6 User Paths 197 4.7 Forms 206 4.8 Color Spaces 210 4.9 Patterns 248 4.10 Images 288 Chapter 5: Fonts 313 5.1 Organization and Use of Fonts 313 5.2 Font Dictionaries 321 5.3 Character Encoding 328 5.4 Glyph Metric Information 331 5.5 Font Cache 333 5.6 Unique ID Generation 335 5.7 Type 3 Fonts 337 5.8 Additional Base Font Types 343 5.9 Font Derivation and Modification 348 5.10 Composite Fonts 357 5.11 CID-Keyed Fonts 364 Chapter 6: Device Control 391 6.1 Using Page Devices 393 6.2 Page Device Parameters 398 6.3 In-RIP Trapping 439 6.4 Output Device Dictionary 455 Chapter 7: Rendering 457 7.1 CIE-Based Color to Device Color 459 7.2 Conversions among Device Color Spaces 473 7.3 Transfer Functions 478 7.4 Halftones 480 7.5 Scan Conversion Details 501 Chapter 8: Operators 505 8.1 Operator Summary 508 8.2 Operator Details 524 Appendix A: LanguageLevel Feature Summary 725 A.1 LanguageLevel 3 Features 725 A.2 LanguageLevel 2 Features 731 A.3 Incompatibilities 735 v Contents Appendix B: Implementation Limits 737 B.1 Typical Limits 738 B.2 Virtual Memory Use 742 Appendix C: Interpreter Parameters 745 C.1 Properties of User and System Parameters 746 C.2 Defined User and System Parameters 749 C.3 Details of User and System Parameters 753 C.4 Device Parameters 760 Appendix D: Compatibility Strategies 761 D.1 The LanguageLevel Approach 761 D.2 When to Provide Compatibility 763 D.3 Compatibility Techniques 765 D.4 Installing Emulations 769 Appendix E: Character Sets and Encoding Vectors 773 E.1 Times Family 775 E.2 Helvetica Family 776 E.3 Courier Family 777 E.4 Symbol 778 E.5 Standard Latin Character Set 779 E.6 StandardEncoding Encoding Vector 784 E.7 ISOLatin1Encoding Encoding Vector 785 E.8 CE Encoding Vector 786 E.9 Expert Character Set 787 E.10 Expert Encoding Vector 790 E.11 ExpertSubset Encoding Vector 791 E.12 Symbol Character Set 792 E.13 Symbol Encoding Vector 794 Appendix F: System Name Encodings 795 Appendix G: Operator Usage Guidelines 801 Bibliography 811 INDEX 817 vii Figures 2.1 How the PostScript interpreter and an application interact 16 3.1 Mapping with the Decode array 112 3.2 Homogeneous number array 161 3.3 Binary object sequence 164 4.1 The two squares produced by Example 4.1 186 4.2 Effects of coordinate transformations 188 4.3 Nonzero winding number rule 195 4.4 Even-odd rule 196 4.5 Color specification 212 4.6 Color rendering 213 4.7 Component transformations in the CIEBasedABC color space 222 4.8 Component transformations in the CIEBasedA color space 229 4.9 CIEBasedDEFG pre-extension to the CIEBasedABC color space 232 4.10 Output from Example 4.21 256 4.11 Output from Example 4.23 259 4.12 Starting a new triangle in a free-form Gouraud-shaded triangle mesh 272 4.13 Connecting triangles in a free-form Gouraud-shaded triangle mesh 272 4.14 Varying the value of the edge flag to create different shapes 273 4.15 Lattice-form triangular meshes 275 4.16 Coordinate mapping from a unit square to a four-sided Coons patch 277 4.17 Painted area and boundary of a Coons patch 279 4.18 Color values and edge flags in Coons patch meshes 281 4.19 Edge connections in a Coons patch mesh 282 4.20 Control points in a tensor-product mesh 284 4.21 Typical sampled image 288 4.22 Image data organization and processing 293 4.23 Source image coordinate system 294 4.24 Mapping the source image 295 viii Contents 5.1 Results of Example 5.2 317 5.2 Glyphs painted in 50% gray 318 5.3 Glyph outlines treated as a path 319 5.4 Graphics clipped by a glyph path 320 5.5 Encoding scheme for Type 1 fonts 329 5.6 Glyph metrics 331 5.7 Relationship between two sets of metrics 333 5.8 Output from Example 5.6 341 5.9 Composite font mapping example 359 5.10 CID-keyed font basics 367 5.11 Type 0 CIDFont character processing 372 6.1 Trapping example 440 6.2 Sliding trap 452 7.1 Various halftoning effects 486 7.2 Halftone cell with a nonzero angle 493 7.3 Angled halftone cell divided into two squares 493 7.4 Halftone cell and two squares tiled across device space 494 7.5 Tiling of device space in a type 16 halftone dictionary 497 7.6 Rasterization without stroke adjustment 504 8.1 arc operator 530 8.2 arc operator example 531 8.3 arcn operator example 532 8.4 arct operator 533 8.5 arct operator example 533 8.6 curveto operator 565 8.7 imagemask example 609 8.8 setflat operator 669 8.9 Line cap parameter shapes 673 8.10 Line join parameter shapes 674 8.11 Miter length 676 ix Tables 2.1 Control characters for the interactive executive 21 3.1 White-space characters 27 3.2 Types of objects 34 3.3 Standard local dictionaries 65 3.4 Standard global dictionaries 66 3.5 Access strings 79 3.6 Standard filters 85 3.7 Regular resources 91 3.8 Resources whose instances are implicit 91 3.9 Resources used in defining new resource categories 92 3.10 Standard procedure sets in LanguageLevel 3 96 3.11 Entries in a category implementation dictionary 101 3.12 Entries common to all function dictionaries 108 3.13 Additional entries specific to a type 0 function dictionary 109 3.14 Additional entries specific to a type 2 function dictionary 113 3.15 Additional entries specific to a type 3 function dictionary 114 3.16 Entries in the $error dictionary 116 3.17 Entries in an LZWEncode or LZWDecode parameter dictionary 133 3.18 Typical LZW encoding sequence 135 3.19 Entries in a FlateEncode or FlateDecode parameter dictionary 138 3.20 Predictor-related entries in an LZW or Flate filter parameter dictionary 141 3.21 Entries in a CCITTFaxEncode or CCITTFaxDecode parameter dictionary 144 3.22 Entries in a DCTEncode parameter dictionary 148 3.23 Entries in a SubFileDecode parameter dictionary