Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Text /
Chapter 1 - Introduction to Text on the Macintosh / Macintosh Text Overview


Planning Your Text Handling Capabilities

The Macintosh system of text handling--with its graphic approach to text drawing, separation of text storage from text rendering, ability to handle many writing systems, event-controlled text input, large library of utility routines, and availability of a simple text-handling service--is general and powerful. But you may not need all of its power, and the simpler your needs are the less you will have to do to meet them.

It may appear difficult at the outset to generalize your text-handling capabilities so that they can work across all script systems around the world. You may instead wish to customize your application to work with a specific regional variation or script system in a target market that interests you. Either approach is possible; you can use the Macintosh script management system to build in language-independence or language customization, as you wish. There are three general approaches you can take:

This book supports and describes the process of globalization; it helps you prepare your application to support all writing systems and regions. The process of localization is discussed in Guide to Macintosh Software Localization. This book does not discuss customization, beyond the few suggestions presented at the end of this section.

To achieve globalization, localization, or customization, the level of work required is related to the level of text-handling sophistication you need. There are three general levels to consider--rudimentary, moderate, and highly sophisticated.

Rudimentary Text Handling

Rudimentary text handling means that the user either cannot set fonts at all (the lowest level of sophistication) or that the user can set fonts and styles but not alignment (a slightly higher level). In either case large amounts of text and sophisticated formatting are not required.

If your application requires only rudimentary handling, use TextEdit--either directly or through the Dialog Manager--to handle user input and editing. TextEdit exhibits the correct behavior for editing and displaying text in multiple styles and different script systems.

In addition, at an absolute minimum, design your application so that it can display its own Roman text properly when operating with a non-Roman script system. For text in dialog boxes, menus, alert boxes, and so on, if you do not plan to translate the text for localization use only the low-ASCII character codes that are the same on all script systems. High-ASCII character codes may map to incomprehensible characters in another script. The ellipsis in menu items, for example, maps to other characters when displayed in other system scripts. Instead of using the ellipsis, a high-ASCII character code, you can use three periods, a low-ASCII string; the ellipsis is displayed regardless of the system script. (A better approach, however, is to use the script management system to retrieve the appropriate form of the ellipsis character for whatever script system you are running under. See the discussion of retrieving text from tokens in the chapter "Script Manager" in this book.)

Moderate Text Handling

Moderate text-handling sophistication means an application allows users to set font, style, alignment, tabs, writing direction, keyboard, input method, and so forth, across script systems. It handles large amounts of text and offers greater formatting sophistication than TextEdit provides.

The Macintosh script management system and all the text managers documented in this book are designed to support this level of sophistication. You can use these managers and the rest of Macintosh system software to include basic word-processing capabilities in your application, capabilities that work across the entire range of worldwide writing systems supported by Macintosh system software.

Within the range of moderate text handling, the level of complexity is largely a function of the number and types of script systems that are currently enabled. You may wish to structure your application's text-handling algorithms to allow for categories of increasing complexity, based on conditions such as the following four. (The item in parentheses following each condition is a selector or flag that tests for that condition. See the discussion of selectors for Script Manager variables and script variables in the chapter "Script Manager" in this book.)

These probably represent the major divisions in text-handling complexity that you address, although you may want to account for others. For example, you may want to test each individual script system to see if it is contextual (smsfContext set), 1-byte (smsfSingByte set), or bidirectional (smScriptRight = TRUE) before deciding how to handle its text.

With the moderate level of text-handling supported by the Macintosh script management system as documented in this book, your application can be powerful enough and general enough for worldwide acceptance.

Sophisticated Text Handling

Highly sophisticated text processing might be employed by a very powerful word processor that works across many script systems. If you write such a program, you will probably need to go beyond the capabilities provided by the Macintosh script management system.

Areas that may need special attention include specialization or customization of delimiters, higher-level grammatical structures, word selection, sorting, arrow keys, and line direction. All of these issues are addressed by the current Macintosh script management sytem, but if your needs go beyond what the system is now capable of, you may need to write your own code to accomplish them. Here are a few examples:

If you do write your own code to replace one or more of the Macintosh script management capabilities, make sure you do it in a modular fashion, so that you can work with current Macintosh text managers and also be prepared to take advantage of possible future enhancements to system software.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996