CFont Class Reference

The CFont class represents fonts and font metrics. More...

#include <CFont.h>

List of all members.

Public Member Functions

INT8 GetCharWidth (CHAR ch)
 Gets the advance width of the specified character in this Font.
INT16 GetCharsWidth (const CHAR *ch, UINT16 offset, UINT16 length)
 Returns the advance width of the characters in ch, starting at the specified offset and for the specified number of characters (length).
INT16 GetStringWidth (const CString *str)
 Gets the total advance width for showing the specified String in this Font.
INT16 GetSubstringWidth (const CString *str, UINT16 offset, UINT16 length)
 Gets the total advance width for showing the specified substring in this Font.
INT8 GetHeight ()
 Gets the standard height of a line of text in this font.
const UINT8 * GetCharData (CHAR ch)
 Gets the pointer to specified char.

Static Public Member Functions

static CFontGetDefaultFont ()
 Gets the default font of the system.
static CFontGetFont (INT8 face, INT8 style, INT8 size)
 Obtains an object representing a font having the specified face, style, and size.

Detailed Description

The CFont class represents fonts and font metrics.

Fonts cannot be created by applications. Instead, applications query for fonts based on font attributes and the system will attempt to provide a font that matches the requested attributes as closely as possible. A Font's attributes are style, size, and face.


Member Function Documentation

const UINT8 * CFont::GetCharData ( CHAR  ch  ) 

Gets the pointer to specified char.

Returns:
the pointer to char's data.
INT16 CFont::GetCharsWidth ( const CHAR *  ch,
UINT16  offset,
UINT16  length 
)

Returns the advance width of the characters in ch, starting at the specified offset and for the specified number of characters (length).

The advance width is the horizontal distance that would be occupied if the characters were to be drawn using this Font, including inter-character spacing following the characters necessary for proper positioning of subsequent text. The offset and length parameters must specify a valid range of characters within the character array ch. The offset parameter must be within the range [0..(ch.length)], inclusive. The length parameter must be a non-negative integer such that (offset + length) <= ch.length.

Parameters:
ch - the array of characters
offset - the index of the first character to measure
length - the number of characters to measure
Returns:
the width of the character range
INT8 CFont::GetCharWidth ( CHAR  ch  ) 

Gets the advance width of the specified character in this Font.

The advance width is the horizontal distance that would be occupied if ch were to be drawn using this Font, including inter-character spacing following ch necessary for proper positioning of subsequent text.

Parameters:
ch - the character to be measured
Returns:
the total advance width (a non-negative value)
CFont * CFont::GetDefaultFont (  )  [static]

Gets the default font of the system.

Returns:
the default font
CFont * CFont::GetFont ( INT8  face,
INT8  style,
INT8  size 
) [static]

Obtains an object representing a font having the specified face, style, and size.

If a matching font does not exist, the system will attempt to provide the closest match. This method always returns a valid font object, even if it is not a close match to the request.

Parameters:
face - one of FACE_SYSTEM, FACE_MONOSPACE, or FACE_PROPORTIONAL
style - STYLE_PLAIN, or a combination of STYLE_BOLD, STYLE_ITALIC, and STYLE_UNDERLINED
size - one of SIZE_SMALL, SIZE_MEDIUM, or SIZE_LARGE
Returns:
instance the nearest font found
INT8 CFont::GetHeight (  ) 

Gets the standard height of a line of text in this font.

Returns:
the standard height of the font.
INT16 CFont::GetStringWidth ( const CString *  str  ) 

Gets the total advance width for showing the specified String in this Font.

The advance width is the horizontal distance that would be occupied if str were to be drawn using this Font, including inter-character spacing following str necessary for proper positioning of subsequent text.

Parameters:
str - the String to be measured
Returns:
the total advance width
INT16 CFont::GetSubstringWidth ( const CString *  str,
UINT16  offset,
UINT16  length 
)

Gets the total advance width for showing the specified substring in this Font.

The advance width is the horizontal distance that would be occupied if the substring were to be drawn using this Font, including inter-character spacing following the substring necessary for proper positioning of subsequent text.

The offset and length parameters must specify a valid range of characters within str. The offset parameter must be within the range [0..(str.length())], inclusive. The length parameter must be a non-negative integer such that (offset + len) <= str.length().

Parameters:
str - the String to be measured
offset - zero-based index of first character in the substring
length - length of the substring
Returns:
the total advance width

The documentation for this class was generated from the following files:
Generated on Tue Jun 29 18:34:06 2010 for guilib by  doxygen 1.6.3