Utility class used to render text inside OpenGL programs using pre-rasterized TrueType fonts stored as textures. More...
#include <mitsuba/hw/font.h>
Classes | |
struct | Glyph |
Glyph metrics data structure. More... | |
Public Types | |
enum | EFont { EBitstreamVera14, EBitstreamVeraMono14 } |
List of supplied fonts. More... | |
Public Member Functions | |
Font (EFont font) | |
Allocate memory for a certain font. More... | |
void | drawText (Bitmap *dest, Point2i pos, const std::string &text) const |
Draw text to the specified bitmap. More... | |
Vector2i | getSize (const std::string &text) const |
Compute the size covered by the given string when rendered using this font. More... | |
void | init (Renderer *renderer) |
Upload the font to the GPU. More... | |
void | cleanup () |
Free the GPU memory. More... | |
void | convert (Bitmap::EPixelFormat pixelFormat, Bitmap::EComponentFormat componentFormat, Float gamma) |
Convert the underlying bitmap to a different pixel format. More... | |
const std::string & | getName () const |
Return the name of this font. More... | |
int8_t | getKerning (char i, char o) const |
Return an entry from the kerning table. More... | |
GPUTexture * | getTexture () |
Return the associated texture. More... | |
const GPUTexture * | getTexture () const |
Return the associated texture (const version) More... | |
const Glyph & | getGlyph (char c) const |
Return the glyph data structure for a specified character. More... | |
int | getMaxVerticalBearing () const |
Return the max. vertical bearing. More... | |
virtual const Class * | getClass () const |
Retrieve this object's class. More... | |
Public Member Functions inherited from Object | |
Object () | |
Construct a new object. More... | |
int | getRefCount () const |
Return the current reference count. More... | |
void | incRef () const |
Increase the reference count of the object by one. More... | |
void | decRef (bool autoDeallocate=true) const |
Decrease the reference count of the object and possibly deallocate it. More... | |
virtual std::string | toString () const |
Return a human-readable string representation of the object's contents. More... | |
Static Public Attributes | |
static Class * | m_theClass |
Static Public Attributes inherited from Object | |
static Class * | m_theClass |
Pointer to the object's class descriptor. More... | |
Protected Member Functions | |
virtual | ~Font () |
Virtual destructor. More... | |
Protected Member Functions inherited from Object | |
virtual | ~Object () |
Virtual private deconstructor. (Will only be called by ref) More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from Object | |
static void | staticInitialization () |
Initializes the built-in reference count debugger (if enabled) More... | |
static void | staticShutdown () |
Free the memory taken by staticInitialization() More... | |
Utility class used to render text inside OpenGL programs using pre-rasterized TrueType fonts stored as textures.
A FreeType2-based generation tool is located in the directory 'tools/linux/fontgen'. Only Latin-1 is supported at the moment.
enum mitsuba::Font::EFont |
mitsuba::Font::Font | ( | EFont | font | ) |
Allocate memory for a certain font.
|
protectedvirtual |
Virtual destructor.
void mitsuba::Font::cleanup | ( | ) |
Free the GPU memory.
void mitsuba::Font::convert | ( | Bitmap::EPixelFormat | pixelFormat, |
Bitmap::EComponentFormat | componentFormat, | ||
Float | gamma | ||
) |
Convert the underlying bitmap to a different pixel format.
Draw text to the specified bitmap.
|
virtual |
Retrieve this object's class.
Reimplemented from Object.
|
inline |
Return the glyph data structure for a specified character.
|
inline |
Return an entry from the kerning table.
|
inline |
Return the max. vertical bearing.
|
inline |
Return the name of this font.
Vector2i mitsuba::Font::getSize | ( | const std::string & | text | ) | const |
Compute the size covered by the given string when rendered using this font.
|
inline |
Return the associated texture.
|
inline |
Return the associated texture (const version)
void mitsuba::Font::init | ( | Renderer * | renderer | ) |
Upload the font to the GPU.
|
static |