Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::Font Class Reference

Utility class used to render text inside OpenGL programs using pre-rasterized TrueType fonts stored as textures. More...

#include <mitsuba/hw/font.h>

+ Inheritance diagram for mitsuba::Font:

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...
 
GPUTexturegetTexture ()
 Return the associated texture. More...
 
const GPUTexturegetTexture () const
 Return the associated texture (const version) More...
 
const GlyphgetGlyph (char c) const
 Return the glyph data structure for a specified character. More...
 
int getMaxVerticalBearing () const
 Return the max. vertical bearing. More...
 
virtual const ClassgetClass () 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 Classm_theClass
 
- Static Public Attributes inherited from Object
static Classm_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...
 

Detailed Description

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.

Member Enumeration Documentation

List of supplied fonts.

Enumerator
EBitstreamVera14 
EBitstreamVeraMono14 

Constructor & Destructor Documentation

mitsuba::Font::Font ( EFont  font)

Allocate memory for a certain font.

virtual mitsuba::Font::~Font ( )
protectedvirtual

Virtual destructor.

Member Function Documentation

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.

void mitsuba::Font::drawText ( Bitmap dest,
Point2i  pos,
const std::string &  text 
) const

Draw text to the specified bitmap.

virtual const Class* mitsuba::Font::getClass ( ) const
virtual

Retrieve this object's class.

Reimplemented from Object.

const Glyph& mitsuba::Font::getGlyph ( char  c) const
inline

Return the glyph data structure for a specified character.

int8_t mitsuba::Font::getKerning ( char  i,
char  o 
) const
inline

Return an entry from the kerning table.

int mitsuba::Font::getMaxVerticalBearing ( ) const
inline

Return the max. vertical bearing.

const std::string& mitsuba::Font::getName ( ) const
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.

GPUTexture* mitsuba::Font::getTexture ( )
inline

Return the associated texture.

const GPUTexture* mitsuba::Font::getTexture ( ) const
inline

Return the associated texture (const version)

void mitsuba::Font::init ( Renderer renderer)

Upload the font to the GPU.

Member Data Documentation

Class* mitsuba::Font::m_theClass
static

The documentation for this class was generated from the following file: