Thonburi — Thai application-font reference, ©1993
From the originals
13 scansMachine-transcribed text and image descriptions. Check the linked original for uncertain words or fine print.
These are transcribed pages from the documents, not the full publications. Open the original for the remaining pages.
Image 1
CHAPTER 1 Introduction to Text on the Macintosh Remember these points about the system font and the application font, in relation to Chicago font, Geneva font, and the special designators: ■ On localized versions of system software in which the system script is Roman, Chicago is the system font and it has a font family ID of 0. The special designator 0 also refers to Chicago font. ■ When the system script is non-Roman, Chicago has a different font family ID (usually 16383), and the special font designator 0 refers to the system font for the non-Roman system script. On system software in which Japanese is the system script, for example, a value of 0 in the txFont field means the Osaka font, which has a font family ID of 16384. ■ When the system script is Roman, Geneva is the application font and it has a font family ID of 3. The special designator 1 also refers to Geneva font. ■ When the system script is non-Roman, Geneva has the same font family ID of 3, but the special font designator 1 refers to the application font for the non-Roman system script. On system software in which Thai is the system script, for example, a value of 1 in the txFont field means the Thonburi font, which has a font family ID of 26625. ■ The actual font family ID of the system font is specified in the low-memory global variable SysFontFam; the actual font family ID of the application font is specified in the low-memory global variable AppFontID. You can get the actual font family ID of the system font or the application font by making Font Manager calls; see the chapter "Font Manager" in this book. You can also get the actual font family ID of the preferred system font or application font for a script system by making Script Manager calls; see the discussion of script variables in the chapter "Script Manager" in this book. Perhaps the most common mistake developers make in adapting their applications to global markets is to assume that the application font is always Geneva. Do not assume that different script systems have the same system and application fonts. Roman Characters and Associated Fonts All Macintosh script systems include the low-ASCII Roman characters and control characters as part of their character sets. Most non-Roman fonts provide glyphs for those low-ASCII Roman characters. If the font itself does not contain those characters, the script system substitutes characters from an associated font—a Roman font that is associated with that script system—for character codes (mostly in the low-ASCII range) that the script system determines are Roman. Some contextual script systems must use associated fonts because they need more glyphs than can fit into the high-ASCII range normally available for native glyphs. Note A script system specifies the associated font for its system font and application font, but may allow the user to select a single Roman font to associate with all other fonts of the script system. ◆ 1-62 How Script Systems Work
A black-and-white book page with a chapter header at top, body paragraphs, bullet points, a section heading with underline, a Note block, and a page number footer.
Reading notes: Bullet glyphs and the diamond end mark are rendered as symbols; transcribed as ■ and ◆. Monospaced code names (txFont, SysFontFam, AppFontID) are shown in a different typeface; spelling preserved as printed. The sentence ending 'same system and application fonts' is set in a smaller condensed style; wording read as printed.
- Languages
- English
PDF page 1
Addison-Wesley Publishing Company Reading, Massachusetts Menlo Park, California New York Don Mills, Ontario Wokingham, England Amsterdam Bonn Sydney Singapore Tokyo Madrid San Juan Paris Seoul Milan Mexico City Taipei I N S I D E M A C I N T O S H Text
Reading notes: Transcript is set to an empty string because the exact text is preserved separately. The headline is the spaced-letter title I N S I D E M A C I N T O S H, normalized here to INSIDE MACINTOSH. The supplied copy is a publisher imprint list, not an advertisement, so no advertised products, prices, or dates were listed. The city names in the imprint block are office locations, not advertised content, and the list appears in three or four lines with no clear reading-order marker beyond line breaks. The word Text appears alone after the title and may be a series, format, or category label; its meaning is not confirmed by the copy.
- Languages
- English
PDF page 2
Apple Computer, Inc. © 1993, Apple Computer, Inc. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, mechanical, electronic, photocopying, recording, or otherwise, without prior written permission of Apple Computer, Inc. Printed in the United States of America. No licenses, express or implied, are granted with respect to any of the technology described in this book. Apple retains all intellectual property rights associated with the technology described in this book. This book is intended to assist application developers to develop applications only for Apple Macintosh computers. Apple Computer, Inc. 20525 Mariani Avenue Cupertino, CA 95014 408-996-1010 Apple, the Apple logo, APDA, AppleLink, AppleShare, ImageWriter, LaserWriter, Macintosh, MPW, and SANE are trademarks of Apple Computer, Inc., registered in the United States and other countries. Apple Desktop Bus, Balloon Help, Chicago, Finder, Geneva, KanjiTalk, Monaco, New York, PowerBook, QuickDraw, ResEdit, System 7, TrueType, and WorldScript are trademarks of Apple Computer, Inc. Adobe, Illustrator, and PostScript are trademarks of Adobe Systems Incorporated, which may be registered in certain jurisdictions. AGFA is a trademark of Agfa-Gevaert. America Online is a service mark of Quantum Computer Services, Inc. CompuServe is a registered service mark of CompuServe, Inc. FrameMaker is a registered trademark of Frame Technology Corporation. Helvetica and Palatino are registered trademarks of Linotype Company. Internet is a trademark of Digital Equipment Corporation. ITC Zapf Dingbats is a registered trademark of International Typeface Corporation. Microsoft is a registered trademark of Microsoft Corporation. SuperPaint is a registered trademark of Aldus Corporation. The world map in Plate 1 is reprinted from Writing Systems of the World by Akira Nakanishi, with the permission of the Charles E Tuttle Publishing Co., Tokyo, Japan. Simultaneously published in the United States and Canada. LIMITED WARRANTY ON MEDIA AND REPLACEMENT ALL IMPLIED WARRANTIES ON THIS MANUAL, INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE LIMITED IN DURATION TO NINETY (90) DAYS FROM THE DATE OF THE ORIGINAL RETAIL PURCHASE OF THIS PRODUCT. Even though Apple has reviewed this manual, APPLE MAKES NO WARRANTY OR REPRESENTATION, EITHER EXPRESS OR IMPLIED, WITH RESPECT TO THIS MANUAL, ITS QUALITY, ACCURACY, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. AS A RESULT, THIS MANUAL IS SOLD “AS IS,” AND YOU, THE PURCHASER, ARE ASSUMING THE ENTIRE RISK AS TO ITS QUALITY AND ACCURACY. IN NO EVENT WILL APPLE BE LIABLE FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES RESULTING FROM ANY DEFECT OR INACCURACY IN THIS MANUAL, even if advised of the possibility of such damages. THE WARRANTY AND REMEDIES SET FORTH ABOVE ARE EXCLUSIVE AND IN LIEU OF ALL OTHERS, ORAL OR WRITTEN, EXPRESS OR IMPLIED. No Apple dealer, agent, or employee is authorized to make any modification, extension, or addition to this warranty. Some states do not allow the exclusion or limitation of implied warranties or liability for incidental or consequential damages, so the above limitation or exclusion may not apply to you. This warranty gives you specific legal rights, and you may also have other rights which vary from state to state. ISBN 0-201-63298-5 1 2 3 4 5 6 7 8 9-MU-9796959493 First Printing, March 1993
Reading notes: Supplied copy is a copyright, trademark, and warranty page rather than an advertisement, so no advertised products or prices were identified. Product and trademark names such as Macintosh and LaserWriter appear only in legal notices and were not treated as advertised products. Printed dates are taken from the copyright line and the First Printing line; the ISBN and print code were not treated as dates.
- Printed dates
- © 1993 · March 1993
- Languages
- English
PDF page 3
iii Contents Figures, Tables, and Listings xxi Preface About This Book xxxi What to Read xxxi Format of a Typical Chapter xxxii Conventions Used in This Book xxxiii Special Fonts xxxiii Types of Notes xxxiii Development Environment xxxiv Developer Products and Support xxxiv Chapter 1 Introduction to Text on the Macintosh 1-1 Macintosh Text Overview 1-3 Separation of Tasks 1-4 Text Is Graphics 1-5 Characters, Glyphs, Character Codes, and Bytes 1-8 Text Storage 1-9 Keyboards and Input Methods 1-11 Writing Systems and Script Systems 1-14 Macintosh Text Utilities 1-16 TextEdit, a Text-Processing Service 1-16 Planning Your Text Handling Capabilities 1-18 Rudimentary Text Handling 1-18 Moderate Text Handling 1-19 Sophisticated Text Handling 1-20 Writing Systems and Script Systems 1-21 Features of the World’s Writing Systems 1-21 Character Representation 1-22 Line Direction and Alignment 1-23 Contextual Forms and Character Reordering 1-26 Diacritical Marks 1-29 Uppercase and Lowercase Characters 1-30 Word Demarcation 1-30 Styles 1-31 Numbers, Currencies, and Dates 1-32 Character Order and Text Sorting 1-34 Variations Among Languages and Regions 1-34
Reading notes: Source is a table of contents, not advertising copy; no headline or product or price data present.
- Languages
- English
PDF page 4
iv Components of the Macintosh Script Management System 1-35 The Macintosh Text Managers 1-36 The WorldScript Extensions 1-39 Components of a Script System 1-40 International Resources 1-41 Keyboard Resources 1-42 Fonts 1-44 How Script Systems Are Classified 1-45 Types of Script Systems 1-46 Script Codes, Language Codes, and Region Codes 1-48 The System Script and Auxiliary Scripts 1-51 Font Script and Keyboard Script 1-51 How Script Systems Work 1-52 Character Encoding 1-52 The Standard Roman Character Set 1-54 Other 1-Byte Character Encodings 1-56 2-Byte Character Encodings 1-57 Font Handling 1-60 Font Availability and Selection 1-61 System Font and Application Font 1-61 Roman Characters and Associated Fonts 1-62 Other Font Issues 1-63 Character Rendering and Text Display 1-64 Storage Order and Display Order 1-65 Line Direction and Alignment 1-67 Style Runs, Font Runs, Script Runs, Direction Runs 1-70 Text Layout 1-71 Caret Handling 1-74 Highlighting 1-80 Converting Screen Position to Text Offset 1-82 Printing 1-85 Text Input 1-87 Keyboards and Key Translation 1-87 Input Methods 1-91 Text Manipulation 1-94 Sorting Strings 1-94 Formatting Dates, Times, Numbers, and Symbols 1-96 Analyzing Characters 1-98 Searching, Modifying, and Converting Text 1-98 Finding Word Boundaries and Line Breaks 1-99 Script Systems in Use 1-100 Installing and Enabling Script Systems 1-100 Components of the System Script 1-101 Components of Auxiliary Scripts 1-102 Installing Modifications to a Script System 1-103 How the User Switches Among Script Systems 1-104 User Control of Script Settings 1-107
- Languages
- English
PDF page 5
v Chapter 2 TextEdit 2-1 About TextEdit 2-6 TextEdit and Standard Macintosh Features 2-6 Multistyled and Monostyled Text 2-7 Font and Keyboard Script Synchronization 2-8 Cutting, Copying, and Pasting Text 2-9 The TextEdit User Interface 2-10 The Selection Range, the Insertion Point, and Highlighting in TextEdit 2-10 Caret Position and Movement 2-11 Text Alignment 2-13 Line Measurement 2-14 Text Buffering 2-14 The TextEdit Private, Null, and Style Scraps 2-15 An Overview of the TextEdit Data Structures 2-16 An Overview of the Edit Record 2-16 Related Data Structures 2-17 Using TextEdit 2-21 Getting Started With TextEdit 2-22 Preparing to Use TextEdit 2-22 Displaying Static Text 2-24 Creating an Edit Record 2-24 Specifying the Destination and View Rectangles 2-28 Setting the Text of an Edit Record 2-29 Setting the Selection Range or the Insertion Point 2-30 Scrolling Text 2-31 Disposing of an Edit Record 2-32 Responding to Events Using TextEdit 2-32 Handling a Null Event 2-32 Activating an Edit Record 2-33 Handling Mouse-Down Events 2-34 Responding to an Update Event 2-36 Accepting Text Input Through Key-Down Events 2-36 Moving Text In and Out of Edit Records 2-38 Using TextEdit to Cut, Copy, and Paste Text 2-39 Inserting and Deleting Text 2-43 Text Attributes 2-43 Checking the Text Attributes Across a Selection Range 2-44 Toggling an Attribute 2-46 Handling a Font Menu 2-47 Handling a Font Size Menu 2-48 Handling a Style Menu 2-48 Changing the Text Alignment 2-50 Saving and Restoring a TextEdit Document, and Implementing Undo 2-51 Saving a TextEdit Document 2-51
- Languages
- English
PDF page 6
vi Restoring an Existing TextEdit Document 2-53 Handling Undo 2-55 Customizing TextEdit 2-56 Replacing the End-of-Line Routine 2-57 Replacing the Drawing Routine 2-58 Replacing the Width-Measuring Routines 2-58 Replacing the Hit Test Routine 2-60 Customizing Word Selection 2-60 Customizing Automatic Scrolling 2-61 Determining the Line Length 2-62 Advanced Customization 2-63 TextEdit Reference 2-64 Data Structures 2-64 The Edit Record 2-67 The High Hook and Caret Hook Fields 2-70 The Style Record 2-71 The Style Table 2-72 The Line Height Table 2-73 The Null Style Record 2-74 The Style Scrap Record 2-74 The Scrap Style Table 2-75 Text Style Record 2-76 Routines 2-76 Initializing TextEdit, Creating an Edit Record, and Disposing of an Edit Record 2-77 Activating and Deactivating an Edit Record 2-80 Setting and Getting an Edit Record’s Text and Character Attribute Information 2-81 Setting the Caret and Selection Range 2-84 Displaying and Scrolling Text 2-86 Modifying the Text of an Edit Record 2-93 Managing the TextEdit Private Scrap 2-98 Checking, Setting, and Replacing Styles 2-99 Using Byte Offsets and Corresponding Points 2-105 Additional TextEdit Features 2-107 Customizing TextEdit 2-110 Summary of TextEdit 2-118 Pascal Summary 2-118 Constants 2-118 Data Types 2-120 Routines 2-123 C Summary 2-125 Constants 2-125 Types 2-127 Routines 2-130
- Languages
- English
PDF page 7
vii Assembly-Language Summary 2-132 Trap Macros 2-132 Global Variables 2-133 Chapter 3 QuickDraw Text 3-1 About QuickDraw Text 3-4 Graphics Ports and Text Drawing 3-4 Font, Font Style, and Font Size 3-5 Transfer Modes 3-8 QuickDraw Text, Script Systems, and Other Managers 3-10 Text Formatting and Justification 3-13 Scaling 3-15 Carets and Highlighting 3-16 Using QuickDraw Text 3-17 Preparing to Use QuickDraw 3-17 Determining the Version and Initializing QuickDraw 3-18 Setting Up the Text-Drawing Environment 3-19 Specifying Text Characteristics 3-19 Setting the Font 3-20 Modifying the Text Style 3-21 Changing the Font Size 3-22 Changing the Width of Characters 3-22 Using Fractional Glyph Widths 3-23 Specifying the Transfer Mode 3-24 Basic Transfer Mode Operations 3-24 Arithmetic Transfer Mode Operations 3-25 The grayishTextOr Transfer Mode 3-26 Text Mask Mode 3-26 Transparent Transfer Mode 3-27 Transfer Modes and Multibit Fonts 3-27 Measuring and Drawing Single Segments of Text 3-27 Individual Glyphs 3-28 Pascal Strings 3-28 Text Segments 3-29 Measuring and Drawing Lines of Text 3-29 Determining Where to Break the Line 3-30 Determining the Display Order for Style Runs 3-33 Eliminating Trailing Spaces (for Justified Text) 3-36 Calculating the Slop Value (for Justified Text) 3-39 Allocating the Slop to Each Style Run (for Justified Text) 3-39 Drawing the Line of Text 3-42 Using Scaled Text 3-44 Drawing Carets and Highlighting 3-47 Converting an Onscreen Pixel Location to a Byte Offset 3-49 Finding a Caret Position and Drawing a Caret 3-49
- Languages
- English
PDF page 8
viii Synchronizing the Caret With the Keyboard Script 3-59 Highlighting a Text Selection 3-60 Customizing QuickDraw’s Text Handling 3-62 Text in QuickDraw Pictures 3-63 Fonts 3-63 Text With Multiple Style Runs 3-65 QuickDraw Text Reference 3-65 Data Structures 3-66 The Font Information Record 3-66 The Style Data Type 3-66 Routines 3-67 Setting Text Characteristics 3-68 Drawing Text 3-76 Measuring Text 3-81 Laying Out a Line of Text 3-87 Determining the Caret Position, and Selecting and Highlighting Text 3-91 Low-Level QuickDraw Text Routines 3-98 Application-Supplied Routine 3-100 Summary of QuickDraw Text 3-102 Pascal Summary 3-102 Constants 3-102 Data Types 3-102 Routines 3-103 C Summary 3-105 Constants 3-105 Types 3-105 Routines 3-106 Assembly-Language Summary 3-107 Trap Macros 3-107 Global Variables 3-108 Chapter 4 Font Manager 4-1 About Fonts 4-6 Characters, Character Codes, and Glyphs 4-6 Kinds of Fonts 4-7 Identifying Fonts 4-8 Font Measurements 4-8 About Font Resources 4-12 Font Resource Types 4-13 A Brief History of Font Resource Use 4-13 Font Family IDs 4-14 Restrictions on the Use of 'FONT' Resources 4-15 Font Resource Tables 4-16
Reading notes: Source is a table of contents excerpt with no primary heading or advertised products, prices, or dates.
- Languages
- English
PDF page 9
ix About the Font Manager 4-16 How QuickDraw Requests a Font 4-16 How the Font Manager Responds to a Font Request 4-17 How the Font Manager Scales Fonts 4-19 The Scaling Process for a Bitmapped Font 4-22 The Scaling Process for an Outline Font 4-23 How the Font Manager Calculates Glyph Widths 4-23 Synthetic Fonts 4-25 How the Font Manager Renders Outline Fonts 4-25 Using the Font Manager 4-31 Adding Font Sizes and Names to the Menu 4-32 Storing a Font Name in a Document 4-33 Getting Font Measurement Information 4-34 Favoring Outline or Bitmapped Fonts 4-35 Preserving the Shapes of Glyphs 4-35 Using Width Tables 4-36 Getting the System or Application Font ID 4-38 Using Fractional Glyph Widths and Font Scaling 4-38 Font Manager Reference 4-39 Data Structures 4-39 The Font Input Record 4-40 The Font Output Record 4-41 The Global Width Table 4-43 The Font Record 4-46 The Font Family Record 4-47 The Font Association Table Record 4-47 The Family Glyph-Width Table Record 4-48 The Style-Mapping Table Record 4-49 The Font Family Kerning Table Record 4-49 Routines 4-50 Initializing the Font Manager 4-50 Getting Font Information 4-51 Using the Current, System, and Application Fonts 4-53 Getting the Characteristics of a Font 4-54 Enabling Fractional Glyph Widths 4-58 Disabling Font Scaling 4-59 Favoring Outline Fonts Over Bitmapped Fonts 4-60 Scaling Outline Fonts 4-62 Accessing Information About a Font 4-64 Handling Fonts in Memory 4-65 The Bitmapped Font ('NFNT') Resource 4-66 The Font Type Element 4-70 The Offset to the Width/Offset Table 4-71 The Outline Font ('sfnt') Resource 4-72 The Font Directory 4-74 The Character-Code Mapping Table 4-76
Reading notes: Source appears to be a table of contents with no primary heading Printed page numbers are listed but no headline is present
- Languages
- English
PDF page 10
x The Control-Value Table 4-77 The Font Program Table 4-77 The Glyph Data Table 4-77 The Horizontal Device Metrics Table 4-78 The Font Header Table 4-79 The Horizontal Header Table 4-83 The Horizontal Metrics Table 4-83 The Kerning Table 4-84 The Location Table 4-84 The Maximum Profile Table 4-84 The Font Naming Table 4-85 The PostScript Table 4-89 The Preprogram Table 4-89 The Font Family ('FOND') Resource 4-90 The Font Style Code 4-94 The Font Association Table 4-95 The Offset Table 4-96 The Bounding-Box Table 4-97 The Family Glyph-Width Table 4-98 The Style-Mapping Table 4-99 The Font Family Kerning Table 4-106 Summary of the Font Manager 4-108 Pascal Summary 4-108 Constants 4-108 Data Types 4-108 Routines 4-112 C Summary 4-113 Constants 4-113 Data Types 4-114 Routines 4-118 Assembly-Language Summary 4-119 Trap Macros 4-119 Global Variables 4-120 Chapter 5 Text Utilities 5-1 About the Text Utilities 5-3 The Text Utilities and the International Resources 5-4 Obtaining Resource Information 5-4 Pascal Strings and Text Strings 5-6 Using the Text Utilities 5-7 Defining Strings 5-8 Working With String Handles 5-8 Working With String Resources 5-9
Reading notes: Source is a table of contents listing, not advertising copy; no headline, products, prices, or dates are identifiable. Leading character 'x' and page-number column formatting may be extraction artifacts.
- Languages
- English
PDF page 11
xi Sorting Strings in Different Languages 5-9 Sorting Strings in the Same Language 5-12 Primary and Secondary Sorting Order 5-12 Expansion and Contraction of Characters 5-14 Ignorable Characters 5-14 Converting and Stripping Characters 5-14 Special Cases for Sorting 5-14 Variations in Sorting Behavior 5-15 Choosing a Comparison Routine 5-15 Testing Two Strings for Equality 5-17 Comparing Two Strings for Ordering 5-18 Modifying Text 5-18 Converting Characters and Stripping Marks in Strings 5-19 Fitting a String Into a Screen Area 5-19 Replacing a Portion of a String 5-21 Finding Word, Line, and Script Run Boundaries 5-23 Finding Word Boundaries 5-23 Finding Line Breaks 5-24 Finding Subscripts Within a Script Run 5-28 Working With Date and Time Strings 5-29 Converting Formatted Date and Time Strings Into Internal Numeric Representations 5-31 Date and Time Value Representations 5-34 Converting Standard Date and Time Values Into Strings 5-34 Working With Numeric Strings 5-35 Converting Between Integers and Numeric Strings 5-38 Using Number Format Specification Strings 5-39 Converting Number Format Specification Strings Into Internal Numeric Representations 5-43 Converting Between Floating-Point Numbers and Numeric Strings 5-43 Text Utilities Reference 5-44 Data Structures 5-44 Routines 5-47 Defining and Specifying Strings 5-47 Comparing Strings for Equality 5-50 Determining Sorting Order for Strings in Different Languages 5-54 Determining Sorting Order for Strings in the Same Language 5-59 Modifying Characters and Diacritical Marks 5-64 Truncating Strings 5-71 Searching for and Replacing Strings 5-74 Working With Word, Script, and Line Boundaries 5-77 Converting Date and Time Strings Into Numeric Representations 5-82 Converting Numeric Representations Into Date and Time Strings 5-86 Converting Long Date and Time Values Into Strings 5-89 Converting Between Integers and Strings 5-91
Reading notes: Source appears to be a table of contents rather than advertising copy; no headline, products, prices, or dates are explicitly present.
- Languages
- English