Introduction to text handling

Text handling facilities begin with descriptors. These provide a basic API for constructing strings, passing them to functions, manipulating them, and extracting data. Additionally, they work with both 8-bit and 16-bit character sets.

For graphics applications, the support for text begins with the font classes provided by the GDI, and the CGraphicsContext::DrawText() function. These provide facilities to select a font, and to draw a single descriptor to any kind of graphics device.

These basic facilities are provided, in various forms, by most operating systems. For most real applications, there are several key requirements which go beyond this:

  • text of unbounded length — i.e., any length from 0 to infinity

  • paragraphs, pictures and other document-type objects in the text

  • formats for characters and/or paragraphs, including fonts, style, indents, borders, colour etc.

  • layout on a graphics device — screen, printer etc. — including all the details of line wrapping, justification and honouring the details of the text's format

  • storage and retrieval of text, in files, clipboards etc.

  • manipulation and editing of such text

  • efficiency in terms of speed, memory utilisation, and ease of programming