WT_Text Class Reference
[Drawable objects]

#include <text.h>

Inheritance diagram for WT_Text:

Inheritance graph
[legend]
Collaboration diagram for WT_Text:

Collaboration graph
[legend]
List of all members.

Detailed Description

A drawable describing text.

See also:
WT_Font

Text options

Working with international text is not as straightforward as it may seem. It may help to know a little about character encoding and display before using international text in WHIP! data. These notes are provided as a brief overview of supporting international text.

Using International Character Sets

Text characters are written to a file as either single-byte characters, double-byte characters, or both single and double-byte character sets. The method used to encode characters usually depends on the written local language of the operating system. English has a relatively small character set of only 256 written characters. The 256 English characters are commonly referred to as the ASCII character set. ASCII characters can each be represented in one byte (8 bits) of computer memory. ASCII has a limited number of characters, but most written languages have many more characters than 256. As a result, international languages (other than English) must be represented using two byte (16 bits) character sets.

Note:
Although computer applications could simply represent all languages using two bytes of memory per character, this is not done for the English character set since the characters would consume twice as much memory as is needed using ASCII , and resulting file sizes would be unnecessarily large.
Using international character sets is complicated by the fact that there are two different ways to encode multiple bytes of computer memory for text: Unicode and Multi-Byte Character Set (MBCS):

Another difference between MBCS and Unicode is that different MBCS platforms (such as Unix, Microsoft Windows, or Macintosh) may have different character sets for the same written language. For example, when using MBCS a given number might map to a Japanese character on Japanese Windows, but the same number may map to another character on English Windows.

Operating Systems and International Characters

Another consideration in supporting international characters is that different operating systems support different character encoding methods. For example, Windows NT/2000/XP fully support both Unicode and MBCS, but Windows9x fully supports MBCS, and only partially supports Unicode. To maximize the efficiency with which WHIP! operates, and to ensure the smallest possible file size, the strategy for WHIP! data is:

TextBounding.png

Text baseline and bounding box details

Examples:

WhipExamples/ColorMap.cpp, WhipExamples/Font.cpp, WhipExamples/Text.cpp, and WhipExamples/Visibility.cpp.

Definition at line 90 of file text.h.

Public Member Functions

 WT_Text ()
 Constructs a WT_Text object.
 WT_Text (WT_Text const &)
 Overrides default copy constructor.
 WT_Text (WT_Logical_Point const &position, WT_String const &string, WT_Logical_Point const *bbox, WT_Unsigned_Integer16 overscore_count, WT_Unsigned_Integer16 const *overscore_pos, WT_Unsigned_Integer16 underscore_count, WT_Unsigned_Integer16 const *underscore_pos)
 Constructs a WT_Text object with the given data.
 WT_Text (WT_Logical_Point const &position, WT_String const &string)
 Constructs a WT_Text object with the given data.
virtual ~WT_Text ()
 Destroys a WT_Text object.
WT_Text const & operator= (WT_Text const &)
 Overrides default assignment operator.
WT_Text_Option_Bounds const & bounds () const
 Returns the string bounding box option object.
WT_Text_Option_Boundsbounds ()
WT_Text_Option_Overscore const & overscore () const
 Returns the string overscore option object.
WT_Text_Option_Overscoreoverscore ()
WT_Logical_Point const & position () const
 Returns the insertion point at the baseline of the text (lower left point.).
WT_Logical_Pointposition ()
WT_String const & string () const
 Returns the text string.
WT_Stringstring ()
WT_Text_Option_Underscore
const & 
underscore () const
 Returns the string underscore option object.
WT_Text_Option_Underscoreunderscore ()
virtual void de_relativize (WT_File &file)
 Returns the position and bounding box points to absolute values based on their relative position to last materialized point.
virtual void relativize (WT_File &file)
 Relativizes the position and bounding box points to the last serialized point.
virtual void transform (WT_Transform const &transform)
 Applies the given transform to the position and bounding box points.
WT_ID object_id () const
 Returns the WT_ID for this object.
WT_Result materialize (WT_Opcode const &opcode, WT_File &file)
 Materializes the contents of the object from the file and the given opcode.
WT_Result process (WT_File &file)
 Calls the configured action handler for this object (passes in the file reference.).
virtual WT_Result serialize (WT_File &file) const
 Causes the serialization of the object to the file.
WT_Result skip_operand (WT_Opcode const &opcode, WT_File &file)
 Causes the file reading to proceed to the end of this object.
virtual void update_bounds (WT_File *file)
 Forces the drawable bounds to be updated.

Static Public Member Functions

static WT_Result default_process (WT_Text &item, WT_File &file)
 Provides a default action handler for this object.

Friends

class WT_W2D_Class_Factory
class WT_Opcode


Constructor & Destructor Documentation

WT_Text::WT_Text WT_Logical_Point const &  position,
WT_String const &  string,
WT_Logical_Point const *  bbox,
WT_Unsigned_Integer16  overscore_count,
WT_Unsigned_Integer16 const *  overscore_pos,
WT_Unsigned_Integer16  underscore_count,
WT_Unsigned_Integer16 const *  underscore_pos
 

Constructs a WT_Text object with the given data.

Parameters:
position  Insertion point at the baseline of the text (lower left point.)
string  Text string.
bbox  Bounding box into which text must fit (the lower left point should equal the position argument.)
overscore_count  The number of overscore position indices in the following array argument.
overscore_pos  An array containing the position indicies of characters in the string which should receive overscores.
underscore_count  The number of underscore position indices in the following array argument.
underscore_pos  An array containing the position indicies of characters in the string which should receive underscores.

WT_Text::WT_Text WT_Logical_Point const &  position,
WT_String const &  string
 

Constructs a WT_Text object with the given data.

Parameters:
position  Insertion point at the baseline of the text (lower left point.)
string  Text string.


Member Function Documentation

static WT_Result WT_Text::default_process WT_Text item,
WT_File file
[static]
 

Provides a default action handler for this object.

Warning:
This is used by the framework and should not be called by client code.
Parameters:
item  The object to process.
file  The file being read.

WT_Result WT_Text::materialize WT_Opcode const &  opcode,
WT_File file
[virtual]
 

Materializes the contents of the object from the file and the given opcode.

Reads in the object data and causes the file reading to proceed to the end of this object.

Warning:
This is used by the framework and should not be called by client code.
Return values:
WT_Result::Success The operation was successful.
WT_Result::Opcode_Not_Valid_For_This_Object The object does not support the opcode type.
WT_Result::Internal_Error Something went very wrong.

Implements WT_Object.

WT_Result WT_Text::process WT_File file  )  [virtual]
 

Calls the configured action handler for this object (passes in the file reference.).

Warning:
This is used by the framework and should not be called by client code.

Implements WT_Object.

virtual WT_Result WT_Text::serialize WT_File file  )  const [virtual]
 

Causes the serialization of the object to the file.

If this is a WT_Drawable derived object, this method may cause the object to be delayed (in case a coincident like-object follows) and/or merged (in case a coincident like-object preceeded) so as to optimize the output.

Return values:
WT_Result::Success The operation was successful.

Implements WT_Object.

Examples:
WhipExamples/Font.cpp, WhipExamples/Text.cpp, and WhipExamples/Visibility.cpp.

WT_Result WT_Text::skip_operand WT_Opcode const &  opcode,
WT_File file
[virtual]
 

Causes the file reading to proceed to the end of this object.

Warning:
This is used by the framework and should not be called by client code.
Bug:
Not all objects perform skip_operand() correctly; this is a known problem. For best results, if client code must use WT_File::get_next_object_shell() manually, it should also call the corresponding WT_Object::materialize() method to avoid this problem.
See also:
WT_File::get_next_object_shell(), WT_File_Heuristics::set_deferred_delete().

Reimplemented from WT_Object.


The documentation for this class was generated from the following file:
Generated on Tue Jan 6 22:41:26 2009 for Autodesk DWF Whip 2D Toolkit by  doxygen 1.4.5