Font Class Reference

Font. More...

List of all members.

Public Member Functions

 Font (string filename, int size, FontStyle style)
 Font constructor (from filename, size, and style)
 Font (FontAlias alias, int size, FontStyle style)
 Font constructor (from separate name, size, and style)
virtual Object ShallowClone ()
 Font constructor (copied from another Font object)
void Dispose ()
 Frees unmanaged resources of Font.
int GetTextWidth (string text)
 Calculates the width required to render the provided character string with this font (entire character string)
int GetTextWidth (string text, int offset, int len)
 Calculates the width required to render the provided character string (part of a character string)
CharMetrics[] GetTextMetrics (string text)
 Obtains metrics information of each character in the provided character string (entire character string)
CharMetrics[] GetTextMetrics (string text, int offset, int len)
 Obtains metrics information of each character in the provided character string (part of the character string)

Protected Member Functions

 Font (Font font)
 Font constructor (copied from another Font object)

Properties

string Name [get]
 Font name.
int Size [get]
 Size.
FontStyle Style [get]
 Style.
FontMetrics Metrics [get]
 Font metrics.

Detailed Description


Constructor & Destructor Documentation

Font ( string  filename,
int  size,
FontStyle  style 
)

Font constructor (from filename, size, and style)

Parameters:
filenameFont filename
sizeSize
styleStyle

The argument size must be between 1 and 1024. Also, depending on the font, the font may not be generated because its size is too small.

Font ( FontAlias  alias,
int  size,
FontStyle  style 
)

Font constructor (from separate name, size, and style)

Parameters:
aliasFont separate name
sizeSize
styleStyle

The argument size must be between 1 and 1024. Also, depending on the font, the font may not be generated because its size is too small.

Font ( Font  font) [protected]

Font constructor (copied from another Font object)

Parameters:
fontCopy source Font object

A separate Font object is copied to create a new Font object. However, the actual body of the Font is not copied and one unmanaged resource will be shared. To free an unmanaged resource of a Font , Dispose() must be called for all the copied Font objects.


Member Function Documentation

CharMetrics [] GetTextMetrics ( string  text)

Obtains metrics information of each character in the provided character string (entire character string)

Parameters:
textCharacter string
Returns:
Array of metrics information per character
CharMetrics [] GetTextMetrics ( string  text,
int  offset,
int  len 
)

Obtains metrics information of each character in the provided character string (part of the character string)

Parameters:
textAll of the character string
offsetOffset of the section to obtain the character string's metrics information
lenLength of the section to obtain the character string's metrics information
Returns:
Array of metrics information per character
int GetTextWidth ( string  text)

Calculates the width required to render the provided character string with this font (entire character string)

Parameters:
textCharacter string
Returns:
Width
int GetTextWidth ( string  text,
int  offset,
int  len 
)

Calculates the width required to render the provided character string (part of a character string)

Parameters:
textAll of the character string
offsetOffset of the section to be used for calculating the character string's width
lenLength of the section to be used for calculating the character string's width
Returns:
Width
virtual Object ShallowClone ( ) [virtual]

Font constructor (copied from another Font object)

Parameters:
fontCopy source Font object

A separate Font object is copied to create a new Font object. However, the actual body of the Font is not copied and one unmanaged resource will be shared. To free an unmanaged resource of a Font , Dispose() must be called for all the copied Font objects.