|
Project Information
Featured
Downloads
|
IntroductionFreeTypeGX is a wrapper class for libFreeType which renders a compiled FreeType parsable font into a GX texture for Wii homebrew development. FreeTypeGX is written in C++ and makes use of a selectable pre-buffered or buffer-on-demand methodology to allow fast and efficient printing of text to the EFB. Note: As of version 0.2.1 FreeTypeGX has forked into two disparate projects and now relies upon the Metaphrasis library. This library was developed in-full by Armin Tamzarian with the support of developers in #wiidev on EFnet. Full Doxygen API documentation is included within the download archive for assistance with program integration. Installation (Source Code)
#include "FreeTypeGX.h" Installation (Library)
#include "FreeTypeGX.h" FreeTypeGX PrerequisitesBefore you begin using FreeTypeGX in your project you must ensure that the you have some method by which to allocate the font data buffer for use within the initialization routines. For examples showing the most common methods to generate a font data buffer for use with FreeTypeGX see the included examples. These examples illustrate the following methods: example1 - Compiling a font into the executable example2 - Loading a font from a file located on an SD card or USB drive Note that both of these example result with the creation of the following example variables: uint8_t* rursus_compact_mono_ttf - A buffer containing the font data. FT_Long rursus_compact_mono_ttf_size - A long value containing the size of the font data buffer in bytes. FreeTypeGX Usage
FreeTypeGX *freeTypeGX = new FreeTypeGX(); Alternately you can specify a texture format to which you would like to render the font characters. Note that the default value for this parameter is GX_TF_RGBA8.FreeTypeGX *freeTypeGX = new FreeTypeGX(GX_TF_RGB565);Furthermore, you can also specify a positional format as defined in your graphics subsystem initialization. Note that the default value for this parameter is GX_POS_XYZ.FreeTypeGX *freeTypeGX = new FreeTypeGX(GX_TF_RGB565, GX_POS_XY); Currently supported textures are: Currently supported position formats are:
fontSystem->loadFont(rursus_compact_mono_ttf, rursus_compact_mono_ttf_size, 64); Alternately you can specify a flag which will load and cache all available font glyphs immidiately. Note that on large font sets enabling this feature could take a significant amount of time.fontSystem->loadFont(rursus_compact_mono_ttf, rursus_compact_mono_ttf_size, 64, true);
freeTypeGX->drawText(10, 25, _TEXT("FreeTypeGX Rocks!"));Alternately you can specify a GXColor object you would like to apply to the printed characters: Currently style parameters are: LicenseFreeTypeGX is distributed under the GNU Lesser General Public License. ContactIf you have any suggestions, questions, or comments regarding this library feel free to e-mail me at tamzarian1989 at gmail dawt com. |