NAME
CL_Font - ClanLib's font class.
DESCRIPTION
This class allows you to easilly draw text onto the backbuffer or to a renderer target.
The font can be created in two ways. Either it is loaded from a resource, or it is created using the font description interface. The font and its description have the same relationship/functionality as the surface and its provider.
Please read the CL_Font_Description page if you want an description on how to create your a font.
CLASS MEMBERS
- enum alignments(
-
ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT )
- static CL_Font *load(
-
const char *res_id, CL_ResourceManager *resource_manager)
- CL_Font(
-
CL_Font_Description *font_desc)
- virtual ~CL_Font()
- int get_height()
- int get_text_width(
-
const char *text)
- void print_left(
-
int x, int y, const char *text)
- void print_left(
-
int x, int y, float scale_x, float scale_y, const char *text)
- void print_center(
-
int x, int y, const char *text)
- void print_right(
-
int x, int y, const char *text)
- void put_target(
-
int x, int y, const char *text, CL_Target *target, int alignment=ALIGN_LEFT)
MEMBERS WITH DESCRIPTIONS
- enum alignments(
-
ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT )
Description:
- static CL_Font *load(
-
const char *res_id, CL_ResourceManager *resource_manager)
Parameters: res_id - The resource ID of the font. resource_manager - The resource manager used to load the resources from.
Description:
Loads the font from resources.
- CL_Font(
-
CL_Font_Description *font_desc)
Parameters: font_desc - The font description used to construct the font.
Description:
Loads the font from a font description.
- virtual ~CL_Font()
-
Description:
- int get_height()
-
Description:
Returns the height of the font.
Return value:
Width of the font.
- int get_text_width(
-
const char *text)
Parameters: text - Text string the width should be calculated from.
Description:
Return the width of text if drawn with this font.
Return value:
Width of the text (in pixels).
- void print_left(
-
int x, int y, const char *text)
Parameters: x - X coordinate (in pixels) the text is drawn at. y - Y coordiante (in pixels) the text is drawn at. text - The text to be drawn with this font.
Description:
Prints text left aligned at coordinates (x,y).
- void print_left(
-
int x, int y, float scale_x, float scale_y, const char *text)
Parameters: x - X coordinate (in pixels) the text is drawn at. y - Y coordiante (in pixels) the text is drawn at. scale_x - Scale font width scale_x times. scale_y - Scale font height scale_y times. text - The text to be drawn with this font.
Description:
Prints text left aligned at coordinates (x,y).
- void print_center(
-
int x, int y, const char *text)
Parameters: x - X coordinate (in pixels) the text is centered at. y - Y coordiante (in pixels) the text is centered at. text - The text to be drawn with this font.
Description:
Prints text center aligned at coordinates (x,y).
- void print_right(
-
int x, int y, const char *text)
Parameters: x - X coordinate (in pixels) the text is ends at. y - Y coordiante (in pixels) the text is drawn at. text - The text to be drawn with this font.
Description:
Prints text right aligned at coordinates (x,y).
- void put_target(
-
int x, int y, const char *text, CL_Target *target, int alignment=ALIGN_LEFT)
Parameters: x - X coordinate (in pixels) y - Y coordiante (in pixels) text - The text to be drawn with this font. target - the target surface to blit to. alignment - the alignment of the text, CL_Font::ALIGN_LEFT, CL_Font::ALIGN_CENTER, CL_Font::ALIGN_RIGHT
Description:
Prints text aligned with alignment at coordinates (x,y) to the target surface.If CL_Font::ALIGN_LEFT is specified the text is draw starting from x, y.If CL_Font::ALIGN_CENTER is specified the text is centered at x, y.If CL_Font::ALIGN_RIGHT is specified the text ends at x, y;
SEE ALSO
All ClanLib API classes can be found in clanlib (3).
AUTHORS
Originally written by Magnus Norddahl <[email protected]> and Martin Starch <[email protected]>. ClanLib is now developed by the ClanLib Development team as an Open Source project.
The ClanLib man pages was created using the Perceps documentation system (another excellent piece of Open Source software, available at http://somewhere.in.the.world.org).
See clanlib (3) to find out how to get a full list of contributors and details on how to submit bug reports, comments etc.