#include <FTGLTextureFont.h>
Inheritance diagram for FTGLTextureFont:
Public Member Functions | |
FTGLTextureFont (const char *fontFilePath) | |
FTGLTextureFont (const unsigned char *pBufferBytes, size_t bufferSizeInBytes) | |
virtual | ~FTGLTextureFont () |
virtual bool | FaceSize (const unsigned int size, const unsigned int res=72) |
virtual void | PreRender () |
virtual void | PostRender () |
FTGLTextureFont (const char *fontFilePath) | |
FTGLTextureFont (const unsigned char *pBufferBytes, size_t bufferSizeInBytes) | |
virtual | ~FTGLTextureFont () |
virtual bool | FaceSize (const unsigned int size, const unsigned int res=72) |
virtual void | PreRender () |
virtual void | PostRender () |
Private Member Functions | |
virtual FTGlyph * | MakeGlyph (unsigned int glyphIndex) |
void | CalculateTextureSize () |
GLuint | CreateTexture () |
virtual FTGlyph * | MakeGlyph (unsigned int glyphIndex) |
void | CalculateTextureSize () |
GLuint | CreateTexture () |
Private Attributes | |
GLsizei | maximumGLTextureSize |
GLsizei | textureWidth |
GLsizei | textureHeight |
FTVector< GLuint > | textureIDList |
int | glyphHeight |
int | glyphWidth |
unsigned int | padding |
unsigned int | numGlyphs |
unsigned int | remGlyphs |
int | xOffset |
int | yOffset |
FTVector< GLuint > | textureIDList |
Definition at line 17 of file FTGLTextureFont.h.
FTGLTextureFont::FTGLTextureFont | ( | const char * | fontFilePath | ) |
Open and read a font file. Sets Error flag.
fontFilePath | font file path. |
Definition at line 22 of file FTGLTextureFont.cxx.
References FTFont::face, FTFace::GlyphCount(), numGlyphs, and remGlyphs.
FTGLTextureFont::FTGLTextureFont | ( | const unsigned char * | pBufferBytes, | |
size_t | bufferSizeInBytes | |||
) |
Open and read a font from a buffer in memory. Sets Error flag.
pBufferBytes | the in-memory buffer | |
bufferSizeInBytes | the length of the buffer in bytes |
Definition at line 37 of file FTGLTextureFont.cxx.
References FTFont::face, FTFace::GlyphCount(), numGlyphs, and remGlyphs.
FTGLTextureFont::~FTGLTextureFont | ( | ) | [virtual] |
Destructor
Definition at line 52 of file FTGLTextureFont.cxx.
References glDeleteTextures(), and textureIDList.
FTGLTextureFont::FTGLTextureFont | ( | const char * | fontFilePath | ) |
Open and read a font file. Sets Error flag.
fontFilePath | font file path. |
FTGLTextureFont::FTGLTextureFont | ( | const unsigned char * | pBufferBytes, | |
size_t | bufferSizeInBytes | |||
) |
Open and read a font from a buffer in memory. Sets Error flag.
pBufferBytes | the in-memory buffer | |
bufferSizeInBytes | the length of the buffer in bytes |
virtual FTGLTextureFont::~FTGLTextureFont | ( | ) | [virtual] |
Destructor
bool FTGLTextureFont::FaceSize | ( | const unsigned int | size, | |
const unsigned int | res = 72 | |||
) | [virtual] |
Set the char size for the current face.
size | the face size in points (1/72 inch) | |
res | the resolution of the target device. |
true
if size was set correctly Reimplemented from FTFont.
Definition at line 141 of file FTGLTextureFont.cxx.
References FTFont::face, FTFont::FaceSize(), glDeleteTextures(), FTFace::GlyphCount(), numGlyphs, remGlyphs, and textureIDList.
void FTGLTextureFont::PreRender | ( | ) | [virtual] |
Prepare for rendering
Reimplemented from FTFont.
Definition at line 154 of file FTGLTextureFont.cxx.
References GL_ALPHA_TEST, GL_BLEND, GL_COLOR_BUFFER_BIT, GL_ENABLE_BIT, GL_GEQUAL, GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA, glAlphaFunc(), glBlendFunc(), glEnable(), glPushAttrib(), FTFont::PreRender(), and FTTextureGlyph::ResetActiveTexture().
void FTGLTextureFont::PostRender | ( | ) | [virtual] |
Cleanup after rendering
Reimplemented from FTFont.
Definition at line 168 of file FTGLTextureFont.cxx.
References glPopAttrib(), and FTFont::PostRender().
FTGlyph * FTGLTextureFont::MakeGlyph | ( | unsigned int | glyphIndex | ) | [inline, private, virtual] |
Construct a FTTextureGlyph.
glyphIndex | The glyph index NOT the char code. |
null
on failure. Implements FTFont.
Definition at line 58 of file FTGLTextureFont.cxx.
References FTGlyph::BBox(), FTFont::charSize, CreateTexture(), FTFont::err, FTFace::Error(), FTFont::face, FT_LOAD_NO_HINTING, FTFace::Glyph(), glyphHeight, glyphWidth, FTSize::Height(), FTBBox::lowerX, NULL, padding, remGlyphs, textureHeight, textureIDList, textureWidth, FTBBox::upperX, FTSize::Width(), xOffset, and yOffset.
void FTGLTextureFont::CalculateTextureSize | ( | ) | [inline, private] |
Get the size of a block of memory required to layout the glyphs
Calculates a width and height based on the glyph sizes and the number of glyphs. It over estimates.
Definition at line 98 of file FTGLTextureFont.cxx.
References GL_MAX_TEXTURE_SIZE, glGetIntegerv(), glyphHeight, glyphWidth, h, maximumGLTextureSize, NextPowerOf2(), numGlyphs, padding, remGlyphs, textureHeight, and textureWidth.
Referenced by CreateTexture().
GLuint FTGLTextureFont::CreateTexture | ( | ) | [inline, private] |
Creates a 'blank' OpenGL texture object.
The format is GL_ALPHA and the params are GL_TEXTURE_WRAP_S = GL_CLAMP GL_TEXTURE_WRAP_T = GL_CLAMP GL_TEXTURE_MAG_FILTER = GL_LINEAR GL_TEXTURE_MIN_FILTER = GL_LINEAR Note that mipmapping is NOT used
Definition at line 116 of file FTGLTextureFont.cxx.
References CalculateTextureSize(), GL_ALPHA, GL_CLAMP, GL_LINEAR, GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_TEXTURE_MIN_FILTER, GL_TEXTURE_WRAP_S, GL_TEXTURE_WRAP_T, GL_UNSIGNED_BYTE, glBindTexture(), glGenTextures(), glTexImage2D(), glTexParameteri(), textureHeight, and textureWidth.
Referenced by MakeGlyph().
virtual bool FTGLTextureFont::FaceSize | ( | const unsigned int | size, | |
const unsigned int | res = 72 | |||
) | [virtual] |
Set the char size for the current face.
size | the face size in points (1/72 inch) | |
res | the resolution of the target device. |
true
if size was set correctly Reimplemented from FTFont.
virtual void FTGLTextureFont::PreRender | ( | ) | [virtual] |
Prepare for rendering
Reimplemented from FTFont.
virtual void FTGLTextureFont::PostRender | ( | ) | [virtual] |
Cleanup after rendering
Reimplemented from FTFont.
virtual FTGlyph* FTGLTextureFont::MakeGlyph | ( | unsigned int | glyphIndex | ) | [inline, private, virtual] |
Construct a FTTextureGlyph.
glyphIndex | The glyph index NOT the char code. |
null
on failure. Implements FTFont.
void FTGLTextureFont::CalculateTextureSize | ( | ) | [inline, private] |
Get the size of a block of memory required to layout the glyphs
Calculates a width and height based on the glyph sizes and the number of glyphs. It over estimates.
GLuint FTGLTextureFont::CreateTexture | ( | ) | [inline, private] |
Creates a 'blank' OpenGL texture object.
The format is GL_ALPHA and the params are GL_TEXTURE_WRAP_S = GL_CLAMP GL_TEXTURE_WRAP_T = GL_CLAMP GL_TEXTURE_MAG_FILTER = GL_LINEAR GL_TEXTURE_MIN_FILTER = GL_LINEAR Note that mipmapping is NOT used
GLsizei FTGLTextureFont::maximumGLTextureSize [private] |
The maximum texture dimension on this OpenGL implemetation
Definition at line 91 of file FTGLTextureFont.h.
Referenced by CalculateTextureSize().
GLsizei FTGLTextureFont::textureWidth [private] |
The minimum texture width required to hold the glyphs
Definition at line 96 of file FTGLTextureFont.h.
Referenced by CalculateTextureSize(), CreateTexture(), and MakeGlyph().
GLsizei FTGLTextureFont::textureHeight [private] |
The minimum texture height required to hold the glyphs
Definition at line 101 of file FTGLTextureFont.h.
Referenced by CalculateTextureSize(), CreateTexture(), and MakeGlyph().
FTVector<GLuint> FTGLTextureFont::textureIDList [private] |
An array of texture ids
Definition at line 106 of file FTGLTextureFont.h.
Referenced by FaceSize(), MakeGlyph(), and ~FTGLTextureFont().
int FTGLTextureFont::glyphHeight [private] |
The max height for glyphs in the current font
Definition at line 111 of file FTGLTextureFont.h.
Referenced by CalculateTextureSize(), and MakeGlyph().
int FTGLTextureFont::glyphWidth [private] |
The max width for glyphs in the current font
Definition at line 116 of file FTGLTextureFont.h.
Referenced by CalculateTextureSize(), and MakeGlyph().
unsigned int FTGLTextureFont::padding [private] |
A value to be added to the height and width to ensure that glyphs don't overlap in the texture
Definition at line 122 of file FTGLTextureFont.h.
Referenced by CalculateTextureSize(), and MakeGlyph().
unsigned int FTGLTextureFont::numGlyphs [private] |
Definition at line 127 of file FTGLTextureFont.h.
Referenced by CalculateTextureSize(), FaceSize(), and FTGLTextureFont().
unsigned int FTGLTextureFont::remGlyphs [private] |
Definition at line 131 of file FTGLTextureFont.h.
Referenced by CalculateTextureSize(), FaceSize(), FTGLTextureFont(), and MakeGlyph().
int FTGLTextureFont::xOffset [private] |
int FTGLTextureFont::yOffset [private] |
FTVector<GLuint> FTGLTextureFont::textureIDList [private] |
An array of texture ids
Definition at line 106 of file FTGLTextureFont.h.