Rich Text and Porting Multilingual Text

Windows 95–based applications can inherit some multilingual functionality simply by using RichEdit common controls, which support formatted text. These controls handle charsets just as they do any other character fomatting property, so the system preserves charset information whenever text is imported or exported from the control. RichEdit controls, along with the clipboard formats and the Font common dialog box, are the only "free" pieces of multilingual support that come with the system. (See Chapter 3 for information about the clipboard.) You'll need to add code to your application to take full advantage of Windows 95's multilingual features.

Formatted text is also a convenient mechanism for porting text to other platforms, such as Windows NT, that do not yet support multilingual text. Unicode is, of course, an alternative plaintext standard, but as described in Chapter 3, it can be difficult to accurately convert text expressed in Unicode to text expressed in Windows code pages. Unless your Windows 95–based application saves text in a Unicode-based file format, you might want to port documents using a formatted text standard such as Rich Text Format (RTF). RTF defines several keywords that are related to charsets and language. The charset and code page values for the RTF keywords \fcharsetN and \cpgN are the same as those listed in the Charset Name and Code- Page ID columns in Figure 6-5.. The RTF keywords \deflangN and \langN take Windows language IDs, expressed in decimal form, as arguments.

Saving files in formatted text is not the only requirement for sharing multilingual documents. Both sender and recipient need applications that can understand multilingual documents, and their systems need enough font and locale support to create and display multilingual data. If the text recipient needs only to read the document—for example, when downloading messages from an electronic bulletin board—the sender could embed the necessary fonts at the end of the text stream. Obviously, embedding fonts involves some overhead costs at run time.