IText is the basic mechanism for storing and manipulating Unicode text strings throughout the Open Class libraries and frameworks. IText encapsulates Unicode characters and any associated styling information, and fully supports mixed style runs. IText keeps the styles with the characters, so you can pass text strings between objects and applications without loss of styling information.
IText is the primary string format supported by the Open Class International Framework. It is suitable for strings of any length, from a few characters to document-length strings. IText was also designed so that you can use it for unstyled strings without incurring the overhead in object size or performance associated with the styling mechanism.
This figure shows the IText interface and related classes:
IText manages its own storage. The characters and styles are stored in separate objects that the IText mechanism creates, deletes, and shares transparently. IText itself is very small and has very fast copy performance. This allows you to:
new and delete
operators. The framework manages this mechanism for you. However, you should be aware of it when using classes such as IFastTextIterator, which do not consider the underlying storage mechanism.
The storage mechanism handles both short and large strings efficiently. The storage allocation strategy changes dynamically as appropriate for the size of the string. For small strings, the characters are stored in a single, contiguous, heap-allocated array, resized only when necessary. Longer strings are broken up into non-contiguous storage blocks, or chunks, as illustrated in this figure: