ClanLib  2.3.7
List of all members
CL_Font_Sprite Class Reference

Sprite Font class. More...

#include <font_sprite.h>

Inheritance diagram for CL_Font_Sprite:
Inheritance graph
[legend]

Public Member Functions

Construction
 CL_Font_Sprite ()
 Constructs a sprite font. More...
 
 CL_Font_Sprite (CL_GraphicContext &gc, const CL_StringRef &resource_id, CL_ResourceManager *resources)
 Constructs a Font Sprite. More...
 
 ~CL_Font_Sprite ()
 
Attributes
CL_FontProvider_Sprite * get_provider () const
 Retrieves the font provider. More...
 
Operations
void set_font_metrics (const CL_FontMetrics &metrics)
 Set the font metrics for the font. More...
 
void draw_text (CL_GraphicContext &gc, float xpos, float ypos, float scale_x, float scale_y, const CL_StringRef &text, const CL_Colorf &color=CL_Colorf::white)
 Draw scaled text. More...
 
Attributes
bool is_null () const
 Is Null. More...
 
Operations
void draw_text (CL_GraphicContext &gc, int x, int y, const CL_StringRef &text, const CL_Colorf &color=CL_Colorf::white)
 Print text on gc. More...
 
void draw_text (CL_GraphicContext &gc, float x, float y, const CL_StringRef &text, const CL_Colorf &color=CL_Colorf::white)
 Print text on gc. More...
 
void draw_text (CL_GraphicContext &gc, const CL_Pointf &position, const CL_StringRef &text, const CL_Colorf &color=CL_Colorf::white)
 Print text on gc. More...
 
void draw_text_ellipsis (CL_GraphicContext &gc, int x, int y, CL_Rect content_box, const CL_StringRef &text, const CL_Colorf &color=CL_Colorf::white)
 Print text on gc adding elipses if it does not fit. More...
 
void draw_text_ellipsis (CL_GraphicContext &gc, float x, float y, CL_Rectf content_box, const CL_StringRef &text, const CL_Colorf &color=CL_Colorf::white)
 Print text on gc adding elipses if it does not fit. More...
 
void draw_text_ellipsis (CL_GraphicContext &gc, const CL_Pointf &position, CL_Rectf content_box, const CL_StringRef &text, const CL_Colorf &color=CL_Colorf::white)
 Print text on gc adding elipses if it does not fit. More...
 
CL_Size get_text_size (CL_GraphicContext &gc, const CL_StringRef &text)
 Calculate size of text string. More...
 
CL_Size get_glyph_size (CL_GraphicContext &gc, unsigned int glyph)
 Gets the size of a specified glyph. More...
 
CL_FontMetrics get_font_metrics ()
 Retrieves font metrics description for the selected font. More...
 
int get_character_index (CL_GraphicContext &gc, const CL_String &text, const CL_Point &point)
 Get the character index at a specified point. More...
 

Detailed Description

Sprite Font class.

Constructor & Destructor Documentation

CL_Font_Sprite::CL_Font_Sprite ( )

Constructs a sprite font.

CL_Font_Sprite::CL_Font_Sprite ( CL_GraphicContext gc,
const CL_StringRef resource_id,
CL_ResourceManager resources 
)

Constructs a Font Sprite.

Parameters
gc= Graphic Context
resource_id= String Ref
resources= Resource Manager
CL_Font_Sprite::~CL_Font_Sprite ( )

Member Function Documentation

void CL_Font_Sprite::draw_text ( CL_GraphicContext gc,
float  xpos,
float  ypos,
float  scale_x,
float  scale_y,
const CL_StringRef text,
const CL_Colorf color = CL_Colorf::white 
)

Draw scaled text.

Multiline text (seperated by /n) is supported

Parameters
gc= Graphic Context
xpos= X position
ypos= Y position
scale_x= X scale
scale_y= Y scale
text= The text to draw
color= The text color
void CL_Font::draw_text ( CL_GraphicContext gc,
int  x,
int  y,
const CL_StringRef text,
const CL_Colorf color = CL_Colorf::white 
)
inherited

Print text on gc.

Multiline text (seperated by /n) is supported

Parameters
gc= Graphic Context
x= X position
y= Y position
text= The text to draw
color= The text color
void CL_Font::draw_text ( CL_GraphicContext gc,
float  x,
float  y,
const CL_StringRef text,
const CL_Colorf color = CL_Colorf::white 
)
inherited

Print text on gc.

Multiline text (seperated by /n) is supported

Parameters
gc= Graphic Context
x= X position
y= Y position
text= The text to draw
color= The text color
void CL_Font::draw_text ( CL_GraphicContext gc,
const CL_Pointf position,
const CL_StringRef text,
const CL_Colorf color = CL_Colorf::white 
)
inherited

Print text on gc.

Multiline text (seperated by /n) is supported

Parameters
gc= Graphic Context
position= Dest position
text= The text to draw
color= The text color
void CL_Font::draw_text_ellipsis ( CL_GraphicContext gc,
int  x,
int  y,
CL_Rect  content_box,
const CL_StringRef text,
const CL_Colorf color = CL_Colorf::white 
)
inherited

Print text on gc adding elipses if it does not fit.

Multiline text (seperated by /n) is supported

Parameters
gc= Graphic Context
x= X position
y= Y position
content_box= Rectangle the text is allowed within
text= The text to draw
color= The text color
void CL_Font::draw_text_ellipsis ( CL_GraphicContext gc,
float  x,
float  y,
CL_Rectf  content_box,
const CL_StringRef text,
const CL_Colorf color = CL_Colorf::white 
)
inherited

Print text on gc adding elipses if it does not fit.

Multiline text (seperated by /n) is supported

Parameters
gc= Graphic Context
x= X position
y= Y position
content_box= Rectangle the text is allowed within
text= The text to draw
color= The text color
void CL_Font::draw_text_ellipsis ( CL_GraphicContext gc,
const CL_Pointf position,
CL_Rectf  content_box,
const CL_StringRef text,
const CL_Colorf color = CL_Colorf::white 
)
inherited

Print text on gc adding elipses if it does not fit.

Multiline text (seperated by /n) is supported

Parameters
gc= Graphic Context
position= Dest position
content_box= Rectangle the text is allowed within
text= The text to draw
color= The text color
int CL_Font::get_character_index ( CL_GraphicContext gc,
const CL_String text,
const CL_Point point 
)
inherited

Get the character index at a specified point.

Multiline text (seperated by /n) is supported

Parameters
gc= The Graphic Context
text= The string
point= The point
Returns
The character index. -1 = Not at specified point
CL_FontMetrics CL_Font::get_font_metrics ( )
inherited

Retrieves font metrics description for the selected font.

CL_Size CL_Font::get_glyph_size ( CL_GraphicContext gc,
unsigned int  glyph 
)
inherited

Gets the size of a specified glyph.

The size is the increment value to the next glyph

Parameters
glyph= The glyph to get
Returns
The size
CL_FontProvider_Sprite* CL_Font_Sprite::get_provider ( ) const

Retrieves the font provider.

CL_Size CL_Font::get_text_size ( CL_GraphicContext gc,
const CL_StringRef text 
)
inherited

Calculate size of text string.

Multiline text (seperated by /n) is supported

Note: The height also includes whitespace (to give the maximum font height), so "." and "X" returns the same height.
The width is the pixel width

The size is the increment value to the next glyph

bool CL_Font::is_null ( ) const
inherited

Is Null.

Returns
true = null
void CL_Font_Sprite::set_font_metrics ( const CL_FontMetrics metrics)

Set the font metrics for the font.


The documentation for this class was generated from the following file: