AgateLib.DisplayLib.FontSurface Class Reference

Class which represents a font to draw on the screen. More...

List of all members.

Public Member Functions

 FontSurface (string fontFamily, float sizeInPoints)
 Creates a FontSurface object from the given fontFamily.
 FontSurface (string fontFamily, float sizeInPoints, FontStyle style)
 Creates a FontSurface object from the given fontFamily.
 FontSurface (AgateResourceCollection resources, string resourceName)
 Constructs a FontSurface object from a resource.
 FontSurface (BitmapFontOptions bitmapOptions)
 Creates a bitmap font using the options passed in. The Display driver must be capable of this, which is indicated in Display.Caps.CanCreateBitmapFont.
void Dispose ()
 Disposes of this object.
void SetScale (double x, double y)
 Sets the scale of the font.
void GetScale (out double x, out double y)
 Gets the scale of the font.
int StringDisplayWidth (string text)
 Measures the display width of the specified string.
int StringDisplayHeight (string text)
 Measures the display height of the specified string.
Size StringDisplaySize (string text)
 Measures the display size of the specified string.
void DrawText (int destX, int destY, string text)
 Draws the specified string at the specified location.
void DrawText (double destX, double destY, string text)
 Draws the specified string at the specified location.
void DrawText (Point destPt, string text)
 Draws the specified string at the specified location.
void DrawText (PointF destPt, string text)
 Draws the specified string at the specified location.
void DrawText (string text)
 Draws the specified string at the origin.

Static Public Member Functions

static FontSurface BitmapMonospace (string filename, Size characterSize)
 This function loads a monospace bitmap font from the specified image file. Only the character size is given. It is assumed that all ASCII characters from 0 to 255 are present, in order from left to right, and top to bottom.

Properties

FontSurfaceImpl Impl [get]
 Returns the implementation object.
StringTransformer StringTransformer [get, set]
 Gets or sets how strings are transformed when they are drawn to the screen. This is useful for bitmap fonts which contain only all uppercase letters, for example.
OriginAlignment DisplayAlignment [get, set]
 Sets the interpretation of the draw point used.
Color Color [get, set]
 Sets the color of the font.
double Alpha [get, set]
 Sets the transparency of the font. 0.0 is fully transparent 1.0 is completely opaque.
double ScaleWidth [get, set]
 Gets or sets the amount the width is scaled when the text is drawn. 1.0 is no scaling.
double ScaleHeight [get, set]
 Gets or sets the amount the height is scaled when the text is drawn. 1.0 is no scaling.
int FontHeight [get]
 Gets the height in pixels of a single line of text.


Detailed Description

Class which represents a font to draw on the screen.

When creating a FontSurface, if you are going to be scaling the font, it usually looks much better to make a large font and scale it to a smaller size, rather than vice-versa.


Constructor & Destructor Documentation

AgateLib.DisplayLib.FontSurface.FontSurface ( string  fontFamily,
float  sizeInPoints 
)

Creates a FontSurface object from the given fontFamily.

Parameters:
fontFamily 
sizeInPoints 

AgateLib.DisplayLib.FontSurface.FontSurface ( string  fontFamily,
float  sizeInPoints,
FontStyle  style 
)

Creates a FontSurface object from the given fontFamily.

Parameters:
fontFamily 
sizeInPoints 
style 

AgateLib.DisplayLib.FontSurface.FontSurface ( AgateResourceCollection  resources,
string  resourceName 
)

Constructs a FontSurface object from a resource.

Parameters:
resources 
resourceName 

AgateLib.DisplayLib.FontSurface.FontSurface ( BitmapFontOptions  bitmapOptions  ) 

Creates a bitmap font using the options passed in. The Display driver must be capable of this, which is indicated in Display.Caps.CanCreateBitmapFont.

Parameters:
bitmapOptions 


Member Function Documentation

static FontSurface AgateLib.DisplayLib.FontSurface.BitmapMonospace ( string  filename,
Size  characterSize 
) [static]

This function loads a monospace bitmap font from the specified image file. Only the character size is given. It is assumed that all ASCII characters from 0 to 255 are present, in order from left to right, and top to bottom.

[Experimental - The API is likely to change in the future.]

Parameters:
filename 
characterSize 
Returns:

void AgateLib.DisplayLib.FontSurface.Dispose (  ) 

Disposes of this object.

void AgateLib.DisplayLib.FontSurface.DrawText ( string  text  ) 

Draws the specified string at the origin.

Parameters:
text 

void AgateLib.DisplayLib.FontSurface.DrawText ( PointF  destPt,
string  text 
)

Draws the specified string at the specified location.

Parameters:
destPt 
text 

void AgateLib.DisplayLib.FontSurface.DrawText ( Point  destPt,
string  text 
)

Draws the specified string at the specified location.

Parameters:
destPt 
text 

void AgateLib.DisplayLib.FontSurface.DrawText ( double  destX,
double  destY,
string  text 
)

Draws the specified string at the specified location.

Parameters:
destX 
destY 
text 

void AgateLib.DisplayLib.FontSurface.DrawText ( int  destX,
int  destY,
string  text 
)

Draws the specified string at the specified location.

Parameters:
destX 
destY 
text 

void AgateLib.DisplayLib.FontSurface.GetScale ( out double  x,
out double  y 
)

Gets the scale of the font.

Parameters:
x 
y 

void AgateLib.DisplayLib.FontSurface.SetScale ( double  x,
double  y 
)

Sets the scale of the font.

Parameters:
x 
y 

int AgateLib.DisplayLib.FontSurface.StringDisplayHeight ( string  text  ) 

Measures the display height of the specified string.

Parameters:
text 
Returns:

Size AgateLib.DisplayLib.FontSurface.StringDisplaySize ( string  text  ) 

Measures the display size of the specified string.

Parameters:
text 
Returns:

int AgateLib.DisplayLib.FontSurface.StringDisplayWidth ( string  text  ) 

Measures the display width of the specified string.

Parameters:
text 
Returns:


Property Documentation

double AgateLib.DisplayLib.FontSurface.Alpha [get, set]

Sets the transparency of the font. 0.0 is fully transparent 1.0 is completely opaque.

Color AgateLib.DisplayLib.FontSurface.Color [get, set]

Sets the color of the font.

OriginAlignment AgateLib.DisplayLib.FontSurface.DisplayAlignment [get, set]

Sets the interpretation of the draw point used.

int AgateLib.DisplayLib.FontSurface.FontHeight [get]

Gets the height in pixels of a single line of text.

FontSurfaceImpl AgateLib.DisplayLib.FontSurface.Impl [get]

Returns the implementation object.

double AgateLib.DisplayLib.FontSurface.ScaleHeight [get, set]

Gets or sets the amount the height is scaled when the text is drawn. 1.0 is no scaling.

double AgateLib.DisplayLib.FontSurface.ScaleWidth [get, set]

Gets or sets the amount the width is scaled when the text is drawn. 1.0 is no scaling.

StringTransformer AgateLib.DisplayLib.FontSurface.StringTransformer [get, set]

Gets or sets how strings are transformed when they are drawn to the screen. This is useful for bitmap fonts which contain only all uppercase letters, for example.


The documentation for this class was generated from the following file:
AgateLib
Awesome Game and Tool Engine Library
SourceForge.net Logo