- Main Page
- Classes

- Class List
- Class Hierarchy
- Class Members

# JLBFont Class Reference

`#include <JLBFont.h>`

Collaboration diagram for JLBFont:

List of all members.

## 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)

## Detailed Description

Bitmap font class for LMNOpc's Bitmap Font Builder: http://www.lmnopc.com/bitmapfontbuilder/

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).

## Constructor & Destructor Documentation

JLBFont::JLBFont | ( | const char * | fontname,
|  | int | lineheight,
|  | bool | useVideoRAM = `false` |
| ) |  |  |

Constructor.

Parameters:

  | 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).

## Member Function Documentation

void JLBFont::DrawString | ( | const char * | string,
|  | float | x,
|  | float | y,
|  | int | align = `JGETEXT_LEFT` |
| ) |  |  |

Rendering text to screen.

Parameters:

  | 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++.

Parameters:

  | x | - X position of text.
  | y | - Y position of text.
  | format | - String formatting.

void JLBFont::SetColor | ( | PIXEL_TYPE | color | ) |

Set font color.

Parameters:

  | color | - color of font.

void JLBFont::SetScale | ( | float | scale | ) |

Set scale for rendering.

Parameters:

  | scale | - Scale for rendering characters.

void JLBFont::SetRotation | ( | float | rot | ) |

Set angle for rendering.

Parameters:

  | rot | - Rotation angle in radian.

void JLBFont::SetTracking | ( | float | tracking | ) |

Set font tracking.

Parameters:

  | tracking | - Font tracking.

PIXEL_TYPE JLBFont::GetColor | ( |  | ) | const

Get font color.

Returns:
  Font color.

float JLBFont::GetScale | ( |  | ) | const

Get rendering scale.

Returns:
  Rendering scale.

float JLBFont::GetRotation | ( |  | ) | const

Get rendering angle.

Returns:
  Rendering angle.

float JLBFont::GetTracking | ( |  | ) | const

Get font tracking.

Returns:
  Font tracking.

float JLBFont::GetHeight | ( |  | ) | const

Get height of font.

Returns:
  Height of font.

float JLBFont::GetStringWidth | ( | const char * | string | ) | const

Get width of rendering string on screen.

Parameters:

  | string | - NULL terminated string.

Returns:
  - Width in pixels

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.

Parameters:

  | base | - Base for the character set to use.