Module that handles font writing stuffs.
More...
Module that handles font writing stuffs.
◆ load()
int Font::load |
( |
string |
filename | ) |
|
Load a .ttf/.pgf/.pvf/.woff/.pfa/.pfb/.fnt/.bdf font file.
- Usage example:
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
-
◆ 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
-
◆ getTextWidth()
int Font::getTextWidth |
( |
int |
font, |
|
|
string |
text |
|
) |
| |
Calculate width for a given text and a given font.
- Usage example:
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:
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:
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). |