Lua Player Plus Vita
Documentation of lpp-vita
Font

Module that handles font writing stuffs. More...

Functions

int Font::load (string filename)
 Load a .ttf/.pgf/.pvf/.woff/.pfa/.pfb/.fnt/.bdf font file. More...
 
void Font::unload (int font)
 Unload a loaded font. More...
 
void Font::setPixelSizes (int font, int size)
 Set font size for drawing. More...
 
int Font::getTextWidth (int font, string text)
 Calculate width for a given text and a given font. More...
 
int Font::getTextHeight (int font, string text)
 Calculate height for a given text and a given font. More...
 
void Font::print (int font, number x, number y, string text, int color)
 Print a text on screen using a font. More...
 

Detailed Description

Module that handles font writing stuffs.

Function Documentation

◆ load()

int Font::load ( string  filename)

Load a .ttf/.pgf/.pvf/.woff/.pfa/.pfb/.fnt/.bdf font file.

Usage example:
fnt = Font.load("app0:/font.ttf")
Definition: luaFont.cpp:6
int load(string filename)
Load a .ttf/.pgf/.pvf/.woff/.pfa/.pfb/.fnt/.bdf font file.
Parameters
filename- The name of the font file
Returns
A valid font ID.

◆ unload()

void Font::unload ( int  font)

Unload a loaded font.

Usage example:
void unload(int font)
Unload a loaded font.
Parameters
font- A valid font loaded with Font.load.

◆ setPixelSizes()

void Font::setPixelSizes ( int  font,
int  size 
)

Set font size for drawing.

Usage example:
void setPixelSizes(int font, int size)
Set font size for drawing.
Parameters
font- A valid font loaded with Font.load.
size- Size to set for Font.print calls in pixels.

◆ getTextWidth()

int Font::getTextWidth ( int  font,
string  text 
)

Calculate width for a given text and a given font.

Usage example:
width = Font.getTextWidth(fnt, "Hello World")
int getTextWidth(int font, string text)
Calculate width for a given text and a given font.
Parameters
font- A valid font loaded with Font.load.
text- Text to calculate width of.
Returns
The text width in pixels.

◆ getTextHeight()

int Font::getTextHeight ( int  font,
string  text 
)

Calculate height for a given text and a given font.

Usage example:
width = Font.getTextHeight(fnt, "Hello World")
int getTextHeight(int font, string text)
Calculate height for a given text and a given font.
Parameters
font- A valid font loaded with Font.load.
text- Text to calculate width of.
Returns
The text height in pixels.

◆ print()

void Font::print ( int  font,
number  x,
number  y,
string  text,
int  color 
)

Print a text on screen using a font.

Usage example:
Font.print(fnt, 5, 10, "Hello World", Color.new(255, 255, 255))
Definition: luaColor.cpp:6
int new(int r, int g, int b, int a)
Create a new color.
void print(int font, number x, number y, string text, int color)
Print a text on screen using a font.
Parameters
font- A valid font loaded with Font.load.
x- X starting coordinate for the print.
y- Y starting coordinate for the print.
text- Text to print.
color- Color of the text (See Color).