ClanLib  2.3.7
List of all members
CL_Font_System Class Reference

Bitmap Font class. More...

#include <font_system.h>

Inheritance diagram for CL_Font_System:
Inheritance graph
[legend]

Public Member Functions

Construction
 CL_Font_System ()
 Constructs a CL_Texture bitmap font. More...
 
 CL_Font_System (CL_GraphicContext &context, const CL_StringRef &typeface_name, int height)
 Constructs a Font System. More...
 
 CL_Font_System (CL_GraphicContext &context, const CL_FontDescription &desc)
 Constructs a Font System. More...
 
 ~CL_Font_System ()
 
Attributes
CL_FontProvider_System * get_provider () const
 Retrieves the font provider. More...
 
CL_Font_TextureGlyphget_glyph (CL_GraphicContext &gc, int glyph)
 Get a glyph. Returns NULL if the glyph was not found. 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...
 

Operations

void set_texture_group (CL_TextureGroup &new_texture_group)
 Set the texture font to use a specified texture group. More...
 
void load_font (CL_GraphicContext &context, const CL_FontDescription &desc)
 Load a system font (for use by insert_glyph to load text from a system font) More...
 
void free_font ()
 Free the system font when it is no longer required. More...
 
void insert_glyph (CL_GraphicContext &gc, CL_Font_System_Position &position, CL_PixelBuffer &pixel_buffer)
 Insert a glyph from a pixel buffer. More...
 
void insert_glyph (CL_GraphicContext &gc, const CL_StringRef &text)
 Insert glyphs from a text string (using to system font) More...
 
void set_font_metrics (const CL_FontMetrics &metrics)
 Set the font metrics for the bitmap font. This is done automatically if the font is loaded from the system font. More...
 
static void register_font (const CL_StringRef &font_filename, const CL_StringRef &font_typeface)
 Registers a font for lookup when creating fonts. More...
 

Detailed Description

Bitmap Font class.

Constructor & Destructor Documentation

CL_Font_System::CL_Font_System ( )

Constructs a CL_Texture bitmap font.

CL_Font_System::CL_Font_System ( CL_GraphicContext context,
const CL_StringRef typeface_name,
int  height 
)

Constructs a Font System.

Parameters
context= Graphic Context
typeface_name= String Ref
height= value
CL_Font_System::CL_Font_System ( CL_GraphicContext context,
const CL_FontDescription desc 
)

Constructs a Font System.

Parameters
context= Graphic Context
desc= Font Description
CL_Font_System::~CL_Font_System ( )

Member Function Documentation

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
void CL_Font_System::free_font ( )

Free the system font when it is no longer required.

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_Font_TextureGlyph* CL_Font_System::get_glyph ( CL_GraphicContext gc,
int  glyph 
)

Get a glyph. Returns NULL if the glyph was not found.

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_System* CL_Font_System::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

void CL_Font_System::insert_glyph ( CL_GraphicContext gc,
CL_Font_System_Position position,
CL_PixelBuffer pixel_buffer 
)

Insert a glyph from a pixel buffer.

param: gc = The graphic context param: position = The bitmap font position param: pixel_buffer = Pixel buffer containing the glyph.

void CL_Font_System::insert_glyph ( CL_GraphicContext gc,
const CL_StringRef text 
)

Insert glyphs from a text string (using to system font)

param: gc = The graphic context param: text = The text to use

bool CL_Font::is_null ( ) const
inherited

Is Null.

Returns
true = null
void CL_Font_System::load_font ( CL_GraphicContext context,
const CL_FontDescription desc 
)

Load a system font (for use by insert_glyph to load text from a system font)

static void CL_Font_System::register_font ( const CL_StringRef font_filename,
const CL_StringRef font_typeface 
)
static

Registers a font for lookup when creating fonts.

void CL_Font_System::set_font_metrics ( const CL_FontMetrics metrics)

Set the font metrics for the bitmap font. This is done automatically if the font is loaded from the system font.

void CL_Font_System::set_texture_group ( CL_TextureGroup new_texture_group)

Set the texture font to use a specified texture group.


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