#include <FreeTypeGX.h>
Public Member Functions | |
| FreeTypeGX (FT_UInt pointSize, u8 textureFormat=GX_TF_RGBA8) | |
| ~FreeTypeGX () | |
| u16 | drawText (u16 x, u16 y, wchar_t *text, GXColor color) |
| u16 | drawText (u16 x, u16 y, wchar_t *text) |
| u16 | drawText (u16 x, u16 y, wchar_t const *text, GXColor color) |
| u16 | drawText (u16 x, u16 y, wchar_t const *text) |
Static Public Member Functions | |
| static u8 | convertRGBAToIA4 (u32 rgba) |
| static u16 | convertRGBAToIA8 (u32 rgba) |
| static u16 | convertRGBAToRGB565 (u32 rgba) |
| static u16 | convertRGBAToRGB5A3 (u32 rgba) |
Private Member Functions | |
| void | cacheFontData () |
| void | loadFontData (FT_Bitmap *bmp, fontCharData *charData) |
| void | convertBufferToI4 (u32 *glyphData, fontCharData *charData) |
| void | convertBufferToI8 (u32 *glyphData, fontCharData *charData) |
| void | convertBufferToIA4 (u32 *glyphData, fontCharData *charData) |
| void | convertBufferToIA8 (u32 *glyphData, fontCharData *charData) |
| void | convertBufferToRGBA8 (u32 *glyphData, fontCharData *charData) |
| void | convertBufferToRGB565 (u32 *glyphData, fontCharData *charData) |
| void | convertBufferToRGB5A3 (u32 *glyphData, fontCharData *charData) |
| void | copyTextureToFramebuffer (GXTexObj *texObj, u16 texWidth, u16 texHeight, u16 screenX, u16 screenY, GXColor color) |
Static Private Member Functions | |
| static u16 | adjustTextureWidth (u16 textureWidth, u8 textureFormat) |
| static u16 | adjustTextureHeight (u16 textureHeight, u8 textureFormat) |
Private Attributes | |
| FT_Library | ftLibrary |
| FT_Face | ftFace |
| FT_GlyphSlot | ftSlot |
| u8 | textureFormat |
| std::map< wchar_t, fontCharData > | fontData |
| FreeTypeGX::FreeTypeGX | ( | FT_UInt | pointSize, | |
| u8 | textureFormat = GX_TF_RGBA8 | |||
| ) |
Default constructor for the FreeTypeGX class.
| pointSize | The desired point size this wrapper's configured font face. | |
| 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. |
| FreeTypeGX::~FreeTypeGX | ( | ) |
Default destructor for the FreeTypeGX class.
| u16 FreeTypeGX::adjustTextureWidth | ( | u16 | textureWidth, | |
| u8 | textureFormat | |||
| ) | [static, private] |
Adjusts the texture data buffer to necessary width for a given texture format.
This routine determines adjusts the given texture width into the required width to hold the necessary texture data for proper alignment.
| textureWidth | The initial guess for the texture width. | |
| textureFormat | The texture format to which the data is to be converted. |
| u16 FreeTypeGX::adjustTextureHeight | ( | u16 | textureHeight, | |
| u8 | textureFormat | |||
| ) | [static, private] |
Adjusts the texture data buffer to necessary height for a given texture format.
This routine determines adjusts the given texture height into the required height to hold the necessary texture data for proper alignment.
| textureHeight | The initial guess for the texture height. | |
| textureFormat | The texture format to which the data is to be converted. |
| void FreeTypeGX::cacheFontData | ( | ) | [private] |
Locates each character in this wrapper's configured font face and proccess them.
This routine locates each character in the configured font face and renders the glyph's bitmap. Each bitmap and relevant information is loaded into its own quickly addressible structure within an instance-specific map.
| void FreeTypeGX::loadFontData | ( | FT_Bitmap * | bmp, | |
| fontCharData * | charData | |||
| ) | [private] |
Loads the rendered bitmap into the relevant structure's data buffer.
This routine does a simple byte-wise copy of the glyph's rendered 8-bit grayscale bitmap into the structure's buffer. Each byte is converted from the bitmap's intensity value into the a u32 RGBA value.
| bmp | A pointer to the most recently rendered glyph's bitmap. | |
| charData | A pointer to an allocated fontCharData structure whose data represent that of the last rendered glyph. |
| void FreeTypeGX::convertBufferToI4 | ( | u32 * | glyphData, | |
| fontCharData * | charData | |||
| ) | [private] |
Convert the specified glyph data buffer into the I4 texture format
This routine converts the temporary RGBA data buffer into the I4 texture format within the character storage structure.
| glyphData | Buffer containing the temporarily rendered RGBA data for the current glyph. | |
| charData | A pointer to an allocated fontCharData structure whose data represent that of the desired character |
| void FreeTypeGX::convertBufferToI8 | ( | u32 * | glyphData, | |
| fontCharData * | charData | |||
| ) | [private] |
Convert the specified glyph data buffer into the I8 texture format
This routine converts the temporary RGBA data buffer into the I8 texture format within the character storage structure.
| glyphData | Buffer containing the temporarily rendered RGBA data for the current glyph. | |
| charData | A pointer to an allocated fontCharData structure whose data represent that of the desired character |
| void FreeTypeGX::convertBufferToIA4 | ( | u32 * | glyphData, | |
| fontCharData * | charData | |||
| ) | [private] |
Convert the specified glyph data buffer into the IA4 texture format
This routine converts the temporary RGBA data buffer into the IA4 texture format within the character storage structure.
| glyphData | Buffer containing the temporarily rendered RGBA data for the current glyph. | |
| charData | A pointer to an allocated fontCharData structure whose data represent that of the desired character |
| void FreeTypeGX::convertBufferToIA8 | ( | u32 * | glyphData, | |
| fontCharData * | charData | |||
| ) | [private] |
Convert the specified glyph data buffer into the IA8 texture format
This routine converts the temporary RGBA data buffer into the IA8 texture format within the character storage structure.
| glyphData | Buffer containing the temporarily rendered RGBA data for the current glyph. | |
| charData | A pointer to an allocated fontCharData structure whose data represent that of the desired character |
| void FreeTypeGX::convertBufferToRGBA8 | ( | u32 * | glyphData, | |
| fontCharData * | charData | |||
| ) | [private] |
Convert the specified glyph data buffer into the RGBA8 texture format
This routine converts the temporary RGBA data buffer into the RGBA8 texture format within the character storage structure. Attribution for this routine is given fully to DragonMinded of Dragon Media Player.
| glyphData | Buffer containing the temporarily rendered RGBA data for the current glyph. | |
| charData | A pointer to an allocated fontCharData structure whose data represent that of the desired character |
| void FreeTypeGX::convertBufferToRGB565 | ( | u32 * | glyphData, | |
| fontCharData * | charData | |||
| ) | [private] |
Convert the specified glyph data buffer into the RGB565 texture format
This routine converts the temporary RGBA data buffer into the RGB565 texture format within the character storage structure.
| glyphData | Buffer containing the temporarily rendered RGBA data for the current glyph. | |
| charData | A pointer to an allocated fontCharData structure whose data represent that of the desired character |
| void FreeTypeGX::convertBufferToRGB5A3 | ( | u32 * | glyphData, | |
| fontCharData * | charData | |||
| ) | [private] |
Convert the specified glyph data buffer into the RGB5A3 texture format
This routine converts the temporary RGBA data buffer into the RGB5A3 texture format within the character storage structure.
| glyphData | Buffer containing the temporarily rendered RGBA data for the current glyph. | |
| charData | A pointer to an allocated fontCharData structure whose data represent that of the desired character |
| void FreeTypeGX::copyTextureToFramebuffer | ( | GXTexObj * | texObj, | |
| u16 | texWidth, | |||
| u16 | texHeight, | |||
| u16 | screenX, | |||
| u16 | screenY, | |||
| GXColor | color | |||
| ) | [private] |
Copies the supplied texture quad to the EFB.
This routine uses the in-built GX quad builder functions to define the texture bounds and location on the EFB target.
| texObj | A pointer to the glyph's initialized texture object. | |
| texWidth | The pixel width of the texture object. | |
| texHeight | The pixel height of the texture object. | |
| screenX | The screen X coordinate at which to output the rendered texture. | |
| screenY | The screen Y coordinate at which to output the rendered texture | |
| color | Color to apply to the texture. |
| u8 FreeTypeGX::convertRGBAToIA4 | ( | u32 | rgba | ) | [static] |
Downsample the specified RGBA value data buffer to an IA4 value.
This routine downsamples the given RGBA data value into the IA4 texture data format.
| rgba | A 32-bit RGBA value to convert to the IA4 format. |
| u16 FreeTypeGX::convertRGBAToIA8 | ( | u32 | rgba | ) | [static] |
Downsample the specified RGBA value data buffer to an IA8 value.
This routine downsamples the given RGBA data value into the IA8 texture data format.
| rgba | A 32-bit RGBA value to convert to the IA8 format. |
| u16 FreeTypeGX::convertRGBAToRGB565 | ( | u32 | rgba | ) | [static] |
Downsample the specified RGBA value data buffer to an RGB565 value.
This routine downsamples the given RGBA data value into the RGB565 texture data format. Attribution for this routine is given fully to NoNameNo of GRRLIB Wii library.
| rgba | A 32-bit RGBA value to convert to the RGB565 format. |
| u16 FreeTypeGX::convertRGBAToRGB5A3 | ( | u32 | rgba | ) | [static] |
Downsample the specified RGBA value data buffer to an RGB5A3 value.
This routine downsamples the given RGBA data value into the RGB5A3 texture data format. Attribution for this routine is given fully to WiiGator via the TehSkeen forum.
| rgba | A 32-bit RGBA value to convert to the RGB5A3 format. |
| u16 FreeTypeGX::drawText | ( | u16 | x, | |
| u16 | y, | |||
| wchar_t * | text, | |||
| GXColor | color | |||
| ) |
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. | |
| text | NULL terminated string to output. | |
| color | Optional color to apply to the text characters. If not specified default value is (GXColor){0xff, 0xff, 0xff, 0xff} |
| u16 FreeTypeGX::drawText | ( | u16 | x, | |
| u16 | y, | |||
| wchar_t * | text | |||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| u16 FreeTypeGX::drawText | ( | u16 | x, | |
| u16 | y, | |||
| wchar_t const * | text, | |||
| GXColor | color | |||
| ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| u16 FreeTypeGX::drawText | ( | u16 | x, | |
| u16 | y, | |||
| 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.
FT_Library FreeTypeGX::ftLibrary [private] |
FreeType FT_Library instance.
FT_Face FreeTypeGX::ftFace [private] |
FreeType reusable FT_Face typographic object.
FT_GlyphSlot FreeTypeGX::ftSlot [private] |
FreeType reusable FT_GlyphSlot glyph container object.
u8 FreeTypeGX::textureFormat [private] |
Defined texture format of the target EFB.
std::map<wchar_t, fontCharData> FreeTypeGX::fontData [private] |
Map which holds the glyph data structures for the corresponding characters.
1.5.6