#include <JLBFont.h>
Public Member Functions | |
JLBFont (const char *fontname, int lineheight, bool useVideoRAM=false) | |
void | DrawString (const char *string, float x, float y, int align=JGETEXT_LEFT) |
void | printf (float x, float y, const char *format,...) |
void | SetColor (PIXEL_TYPE color) |
void | SetScale (float scale) |
void | SetRotation (float rot) |
void | SetTracking (float tracking) |
PIXEL_TYPE | GetColor () const |
float | GetScale () const |
float | GetRotation () const |
float | GetTracking () const |
float | GetHeight () const |
float | GetStringWidth (const char *string) const |
void | SetBase (int base) |
Two files are used for each font: 1: xxx.png, font bitmap. 2: xxx.dat, widths for each character Each font contains 2 sets of characters ASCII code (32-159).
JLBFont::JLBFont | ( | const char * | fontname, | |
int | lineheight, | |||
bool | useVideoRAM = false | |||
) |
Constructor.
fontname | - Name of the font WITHOUT extensions. | |
lineheight | - Font height. | |
useVideoRAM | - Indicate to use video RAM to store the font image or not (PSP only). |
void JLBFont::DrawString | ( | const char * | string, | |
float | x, | |||
float | y, | |||
int | align = JGETEXT_LEFT | |||
) |
Rendering text to screen.
string | - text for rendering. | |
x | - X position of text. | |
y | - Y position of text. - Text aligment. |
void JLBFont::printf | ( | float | x, | |
float | y, | |||
const char * | format, | |||
... | ||||
) |
Rendering text to screen with syntax similar to printf of C/C++.
x | - X position of text. | |
y | - Y position of text. | |
format | - String formatting. |
void JLBFont::SetColor | ( | PIXEL_TYPE | color | ) |
Set font color.
color | - color of font. |
void JLBFont::SetScale | ( | float | scale | ) |
Set scale for rendering.
scale | - Scale for rendering characters. |
void JLBFont::SetRotation | ( | float | rot | ) |
Set angle for rendering.
rot | - Rotation angle in radian. |
void JLBFont::SetTracking | ( | float | tracking | ) |
Set font tracking.
tracking | - Font tracking. |
PIXEL_TYPE JLBFont::GetColor | ( | ) | const |
Get font color.
float JLBFont::GetScale | ( | ) | const |
Get rendering scale.
float JLBFont::GetRotation | ( | ) | const |
Get rendering angle.
float JLBFont::GetTracking | ( | ) | const |
Get font tracking.
float JLBFont::GetHeight | ( | ) | const |
Get height of font.
float JLBFont::GetStringWidth | ( | const char * | string | ) | const |
Get width of rendering string on screen.
string | - NULL terminated string. |
void JLBFont::SetBase | ( | int | base | ) |
There are usually 2 sets of characters in the font image. The first set is from index 0-127 and the second from 128-255. You should use this function to select which set of characters you want to use. The index base should be either 0 or 128.
base | - Base for the character set to use. |