ML_font.h File Reference
This file contains font headers.
More...
#include "uthash.h"
Data Structures |
struct | ML_Font |
| This is the structure for fonts. More...
|
struct | ML_TextInfo |
| This is the structure for info about a text drawn or about to be drawn. More...
|
Defines |
#define | FONT_NULL 0x0000 |
| There won't be any formatting or styling.
|
#define | FONT_JUSTIFY_LEFT 0x0001 |
#define | FONT_JUSTIFY_CENTER 0x0002 |
#define | FONT_JUSTIFY_RIGHT 0x0004 |
#define | FONT_ALIGN_TOP 0x0010 |
#define | FONT_ALIGN_MIDDLE 0x0020 |
#define | FONT_ALIGN_BOTTOM 0x0040 |
#define | FONT_STYLE_UNDERLINE 0x0100 |
#define | FONT_STYLE_STRIKE 0x0200 |
#define | FONT_DEFAULT FONT_JUSTIFY_LEFT | FONT_ALIGN_TOP |
| This is the default value you should use generally.
|
Functions |
bool | ML_InitFont () |
| This function initializes the font system. You do no have to call it because it does it automatically.
|
void | ML_QuitFont () |
| This function quits the font system. You do no have to call it because it does it automatically.
|
void | ML_DeleteFont (ML_Font *font) |
| This function frees and deletes the font memory. You have to call it.
|
bool | ML_LoadFontFromBuffer (ML_Font *font, const uint8_t *filename, FT_Long bufferSize, FT_UInt pointSize) |
| This function loads a font from a buffer.
|
bool | ML_LoadFontFromFile (ML_Font *font, const char *filename, FT_UInt pointSize) |
| This function loads a font from a file.
|
u16 | ML_DrawText (ML_Font *font, int x, int y, char *text,...) |
| This function draws some text.
|
ML_TextInfo | ML_GetTextInfo (ML_Font *font, char *text,...) |
| This function get infos from the drawing of a text.
|
Detailed Description
This file contains font headers.
Define Documentation
#define FONT_ALIGN_BOTTOM 0x0040 |
The text will be aligned at the bottom.
#define FONT_ALIGN_MIDDLE 0x0020 |
The text will be aligned at the middle.
#define FONT_ALIGN_TOP 0x0010 |
The text will be aligned at the top.
#define FONT_JUSTIFY_CENTER 0x0002 |
The text will be justified by the center.
#define FONT_JUSTIFY_LEFT 0x0001 |
The text will be justified by the left.
#define FONT_JUSTIFY_RIGHT 0x0004 |
The text will be justified by the right.
#define FONT_STYLE_STRIKE 0x0200 |
The text will be striked.
#define FONT_STYLE_UNDERLINE 0x0100 |
The text will be underlined.
Function Documentation
void ML_DeleteFont |
( |
ML_Font * |
font |
) |
|
This function frees and deletes the font memory. You have to call it.
- Parameters:
-
u16 ML_DrawText |
( |
ML_Font * |
font, |
|
|
int |
x, |
|
|
int |
y, |
|
|
char * |
text, |
|
|
|
... | |
|
) |
| | |
This function draws some text.
- Parameters:
-
| font | Font structure |
| x | X position |
| y | Y position |
| text | Text |
- Returns:
- Number of caracters printed
This function get infos from the drawing of a text.
- Parameters:
-
| font | Font structure |
| text | Text |
- Returns:
- Structure ML_textInfo to know info from the text
bool ML_LoadFontFromBuffer |
( |
ML_Font * |
font, |
|
|
const uint8_t * |
filename, |
|
|
FT_Long |
bufferSize, |
|
|
FT_UInt |
pointSize | |
|
) |
| | |
This function loads a font from a buffer.
- Parameters:
-
| font | Font structure |
| filename | Buffer variable (normally nameOfYourFont_ttf) |
| bufferSize | Size of the buffer (normally nameOfYourFont_ttf_size) |
| pointSize | Size of the police (in pt) |
- Returns:
- 1 if success, 0 if not
bool ML_LoadFontFromFile |
( |
ML_Font * |
font, |
|
|
const char * |
filename, |
|
|
FT_UInt |
pointSize | |
|
) |
| | |
This function loads a font from a file.
- Parameters:
-
| font | Font structure |
| filename | Path to the .ttf ( "/apps/yourapp/data/yourfont.ttf" generally) |
| pointSize | Size of the police (in pt) |
- Returns:
- 1 if success, 0 if not