TextSnippets

These three collections of snippets illustrate how to work with TText and the default implementation class TStandardText. Snippets illustrate applying and using styles, transcoding, and iterating over styles and text. A sample derived class of TSharedStyle is also provided.

To run the snippets, use either the SnippetBrowser or RunSnippet utilities. RunSnippet can be invoked like this:

Files and classes

TStyleSnippets, defined in StyleSnippets.h and StyleSnippets.C, defines snippets that illustrate how to apply styles to text. It uses classes such as TTextColorStyle, TFontPointSizeStyle, TFontFamilyStyle, TStyleSet, TStyleCategory, TStyleName, and TStyleSetIterator.

TSharedColorStyle, defined in SharedColorStyle.h and SharedColorStyle.C, is an example custom style using TSharedStyle. However, styles created in this way cannot be displayed by the standard line layout objects. Therefore they are useful only for carrying data, not for display, unless you do significant additional work to support them. TSharedColorStyle is used in the UseSharedStyles snippet of TStyleSnippets.

TTextIterationSnippets, defined in TextIterationSnippets.h and TextIterationSnippets.C, defines snippets that illustrate how to iterate through character and style information. It uses classes such as TCharacterIterator, TTextIterator, TStyleRunIterator, TSingleTypeStyleFilter, TNotStyleFilter, TExactTextPatternIterator, TSpanTextPatternIterator, and TStandardTextPatternIterator, to iterate through characters, styles, and do language-sensitive iteration.

TTranscodingSnippets, defined in TranscodingSnippets.h and TranscodingSnippets.C, defines snippets that illustrate how to transcode text information between Unicode and other character sets such as ASCII. It uses the TASCIITranscoder class, and utility classes such as TGeneralPunctuation and TASCII, to convert ASCII text to Unicode and back.


Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.