Wrapper class for the libFreeType library with GX rendering. More...
#include <FreeTypeGX.h>
Public Member Functions | |
FreeTypeGX (FT_UInt pixelSize, uint8_t textureFormat=GX_TF_RGBA8, uint8_t vertexIndex=GX_VTXFMT1) | |
~FreeTypeGX () | |
void | setVertexFormat (uint8_t vertexIndex) |
void | setCompatibilityMode (uint32_t compatibilityMode) |
void | setZ (int _z) |
uint16_t | drawText (int16_t x, int16_t y, wchar_t *text, GXColor color=ftgxWhite, uint16_t textStyling=FTGX_NULL) |
uint16_t | drawText (int16_t x, int16_t y, wchar_t const *text, GXColor color=ftgxWhite, uint16_t textStyling=FTGX_NULL) |
uint16_t | getWidth (wchar_t *text) |
uint16_t | getWidth (wchar_t const *text) |
uint16_t | getHeight (wchar_t *text) |
uint16_t | getHeight (wchar_t const *text) |
void | getOffset (wchar_t *text, ftgxDataOffset *offset) |
void | getOffset (wchar_t const *text, ftgxDataOffset *offset) |
Wrapper class for the libFreeType library with GX rendering.
FreeTypeGX acts as a wrapper class for the libFreeType library. It supports precaching of transformed glyph data into a specified texture format. Rendering of the data to the EFB is accomplished through the application of high performance GX texture functions resulting in high throughput of string rendering.
Definition at line 252 of file FreeTypeGX.h.
FreeTypeGX::FreeTypeGX | ( | FT_UInt | pixelSize, | |
uint8_t | textureFormat = GX_TF_RGBA8 , |
|||
uint8_t | vertexIndex = GX_VTXFMT1 | |||
) |
Default constructor for the FreeTypeGX class.
textureFormat | Optional format (GX_TF_*) of the texture as defined by the libogc gx.h header file. If not specified default value is GX_TF_RGBA8. | |
vertexIndex | Optional vertex format index (GX_VTXFMT*) of the glyph textures as defined by the libogc gx.h header file. If not specified default value is GX_VTXFMT1. |
Definition at line 84 of file FreeTypeGX.cpp.
FreeTypeGX::~FreeTypeGX | ( | ) |
Default destructor for the FreeTypeGX class.
Definition at line 97 of file FreeTypeGX.cpp.
uint16_t FreeTypeGX::drawText | ( | int16_t | x, | |
int16_t | y, | |||
wchar_t * | text, | |||
GXColor | color = ftgxWhite , |
|||
uint16_t | textStyle = FTGX_NULL | |||
) |
Processes the supplied text string and prints the results at the specified coordinates.
This routine processes each character of the supplied text string, loads the relevant preprocessed bitmap buffer, a texture from said buffer, and loads the resultant texture into the EFB.
x | Screen X coordinate at which to output the text. | |
y | Screen Y coordinate at which to output the text. Note that this value corresponds to the text string origin and not the top or bottom of the glyphs. | |
text | NULL terminated string to output. | |
color | Optional color to apply to the text characters. If not specified default value is ftgxWhite: (GXColor){0xff, 0xff, 0xff, 0xff} | |
textStyle | Flags which specify any styling which should be applied to the rendered string. |
Definition at line 456 of file FreeTypeGX.cpp.
uint16_t FreeTypeGX::drawText | ( | int16_t | x, | |
int16_t | y, | |||
wchar_t const * | text, | |||
GXColor | color = ftgxWhite , |
|||
uint16_t | textStyle = FTGX_NULL | |||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 515 of file FreeTypeGX.cpp.
uint16_t FreeTypeGX::getHeight | ( | wchar_t * | text | ) |
Processes the supplied string and return the height of the string in pixels.
This routine processes each character of the supplied text string and calculates the height of the entire string. Note that if precaching of the entire font set is not enabled any uncached glyph will be cached after the call to this function.
text | NULL terminated string to calculate. |
Definition at line 590 of file FreeTypeGX.cpp.
uint16_t FreeTypeGX::getHeight | ( | wchar_t const * | text | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 601 of file FreeTypeGX.cpp.
void FreeTypeGX::getOffset | ( | wchar_t const * | text, | |
ftgxDataOffset * | offset | |||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 650 of file FreeTypeGX.cpp.
void FreeTypeGX::getOffset | ( | wchar_t * | text, | |
ftgxDataOffset * | offset | |||
) |
Get the maximum offset above and minimum offset below the font origin line.
This function calculates the maximum pixel height above the font origin line and the minimum pixel height below the font origin line and returns the values in an addressible structure.
text | NULL terminated string to calculate. | |
offset | returns the max and min values above and below the font origin line |
Definition at line 616 of file FreeTypeGX.cpp.
uint16_t FreeTypeGX::getWidth | ( | wchar_t const * | text | ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 576 of file FreeTypeGX.cpp.
uint16_t FreeTypeGX::getWidth | ( | wchar_t * | text | ) |
Processes the supplied string and return the width of the string in pixels.
This routine processes each character of the supplied text string and calculates the width of the entire string. Note that if precaching of the entire font set is not enabled any uncached glyph will be cached after the call to this function.
text | NULL terminated string to calculate. |
Definition at line 540 of file FreeTypeGX.cpp.
void FreeTypeGX::setCompatibilityMode | ( | uint32_t | compatibilityMode | ) |
Sets the TEV and VTX rendering compatibility requirements for the class.
This sets up the default TEV opertion and VTX descriptions rendering values for the class. This ensures that FreeTypeGX can remain compatible with external liraries or project code. Certain external libraries or code by design or lack of foresight assume that the TEV opertion and VTX descriptions values will remain constant or are always returned to a certain value. This will enable compatibility with those libraries and any other code which cannot or will not be changed.
compatibilityMode | Compatibility descritor (FTGX_COMPATIBILITY_*) as defined in FreeTypeGX.h |
Definition at line 139 of file FreeTypeGX.cpp.
void FreeTypeGX::setVertexFormat | ( | uint8_t | vertexIndex | ) |
Setup the vertex attribute formats for the glyph textures.
This function sets up the vertex format for the glyph texture on the specified vertex format index. Note that this function should not need to be called except if the vertex formats are cleared or the specified vertex format index is modified.
vertexIndex | Vertex format index (GX_VTXFMT*) of the glyph textures as defined by the libogc gx.h header file. |
Definition at line 111 of file FreeTypeGX.cpp.