Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

sjgui::CFont Class Reference

Font class. More...

#include <font.h>

Inheritance diagram for sjgui::CFont:

sjgui::CLabelCtrlTmpl< Tbase > sjgui::CTextCtrlTmpl< Tbase > sjgui::classic::CLabelTmpl< Tbase > sjgui::modern::CLabelTmpl< Tbase > sjgui::classic::CTextTmpl< Tbase > sjgui::modern::CTextTmpl< Tbase > sjgui::extra::CFPSLabel sjgui::extra::CFPSLabelDropIn List of all members.

Public Types

enum  eFontStyles { NORMAL = 0, ITALIC = 1 }
 Font styles.


Public Member Functions

void SetFontStyle (eFontStyles style)
 Set font style.

float GetFontScale ()
 Scale of the font.

void SetFontSize (int i)
 Set size of the font.

int GetFontSize ()
 Returns size of the font.

void FontDrawBegin ()
 Remember the state before changing it.

void FontDrawEnd ()
 Reset state to the previous.

void FontDraw (int iX, int iY, const char *msg, unsigned int uiLen, float *fC4fv)
 Draw given text at given location with a given size and color.


Static Public Member Functions

bool LoadFont (unsigned char *font_texture=NULL, int font_width=256, int font_height=256)
 Load font from array of unsigned char values.

void DestroyFont ()
 Release texture and font list.


Detailed Description

Font class.

Loads font data and draws it. Is used by CText and CLabel, because, these are the only classes drawing text. At the moment there is only one font for all controls, but you can change between normal and italic styles, individually for any control.

See also:
sjgui::CLabel; sjgui::CText
Author:
Alexander Shyrokov
Version:
Revision
1.1.1.1


Member Function Documentation

void sjgui::CFont::FontDraw int  iX,
int  iY,
const char *  msg,
unsigned int  uiLen,
float *  fC4fv
 

Draw given text at given location with a given size and color.

This function could be called multiple times between DrawMsgBegin() and DrawMsgEnd()

float sjgui::CFont::GetFontScale  )  [inline]
 

Scale of the font.

Required by CText only.

bool sjgui::CFont::LoadFont unsigned char *  font_texture = NULL,
int  font_width = 256,
int  font_height = 256
[static]
 

Load font from array of unsigned char values.

If font_texture is NULL, then default font is loaded. font_width and font_size denotes the size of the array. Array contains transparency map of the font. It should be square (at the moment) and contain 256 symbols. This is an example of the image:

font.bmp
There is a special program in the tools folder, which helps to create c array from a bmp image. There is also a good program to generate such font images, out there in the internet. Do not remember the name right now.

void sjgui::CFont::SetFontStyle eFontStyles  style  )  [inline]
 

Set font style.

See also:
eFontStyles.


The documentation for this class was generated from the following file:
sjgui logo
Quick Links:

 News
 Description
 Screen Shots
 Projects
 Downloads
 Source Code
 Help/FAQ
 Want to help?
 Credits
 Disclaimer


Documentation:

 Documentation
 Reference
 Lessons


Useful links:

sjcomp logo
sjcomp

opengl logo

nehe logo

SourceForge.net Logo

Last modified:


Started by Alexander Shyrokov. Generated at Wed Apr 28 12:31:06 2004 for the sjgui by doxygen 1.3.1. SourceForge.net Logo