#include <FTFont.h>
Inheritance diagram for FTFont:
Specific font classes are derived from this class. It uses the helper classes FTFace and FTSize to access the Freetype library. This class is abstract and deriving classes must implement the protected MakeGlyph
function to create glyphs of the appropriate type.
It is good practice after using these functions to test the error code returned. FT_Error Error()
. Check the freetype file fterrdef.h for error definitions.
Definition at line 32 of file FTFont.h.
Public Member Functions | |
FTFont (const char *fontFilePath) | |
Open and read a font file. | |
FTFont (const unsigned char *pBufferBytes, size_t bufferSizeInBytes) | |
Open and read a font from a buffer in memory. | |
virtual | ~FTFont () |
Destructor. | |
bool | Attach (const char *fontFilePath) |
Attach auxilliary file to font e.g font metrics. | |
bool | Attach (const unsigned char *pBufferBytes, size_t bufferSizeInBytes) |
Attach auxilliary data to font e.g font metrics, from memory. | |
bool | CharMap (FT_Encoding encoding) |
Set the character map for the face. | |
unsigned int | CharMapCount () |
Get the number of character maps in this face. | |
FT_Encoding * | CharMapList () |
Get a list of character maps in this face. | |
virtual bool | FaceSize (const unsigned int size, const unsigned int res=72) |
Set the char size for the current face. | |
unsigned int | FaceSize () const |
Get the current face size in points. | |
virtual void | Depth (float depth) |
Set the extrusion distance for the font. | |
void | UseDisplayList (bool useList) |
Enable or disable the use of Display Lists inside FTGL. | |
float | Ascender () const |
Get the global ascender height for the face. | |
float | Descender () const |
Gets the global descender height for the face. | |
float | LineHeight () const |
Gets the line spacing for the font. | |
void | BBox (const char *string, float &llx, float &lly, float &llz, float &urx, float &ury, float &urz) |
Get the bounding box for a string. | |
void | BBox (const wchar_t *string, float &llx, float &lly, float &llz, float &urx, float &ury, float &urz) |
Get the bounding box for a string. | |
float | Advance (const wchar_t *string) |
Get the advance width for a string. | |
float | Advance (const char *string) |
Get the advance width for a string. | |
virtual void | Render (const char *string) |
Render a string of characters. | |
virtual void | Render (const wchar_t *string) |
Render a string of characters. | |
FT_Error | Error () const |
Queries the Font for errors. | |
Protected Member Functions | |
virtual FTGlyph * | MakeGlyph (unsigned int g)=0 |
Construct a glyph of the correct type. | |
Protected Attributes | |
FTFace | face |
Current face object. | |
FTSize | charSize |
Current size object. | |
bool | useDisplayLists |
Flag to enable or disable the use of Display Lists inside FTGL true turns ON display lists. | |
FT_Error | err |
Current error code. |
|
Open and read a font file. Sets Error flag.
Definition at line 7 of file FTFont.cpp. References FTFace::Error(), and face. |
|
Open and read a font from a buffer in memory. Sets Error flag. The buffer is owned by the client and is NOT copied by FTGL. The pointer must be valid while using FTGL.
Definition at line 20 of file FTFont.cpp. References FTFace::Error(), and face. |
|
Destructor.
Definition at line 32 of file FTFont.cpp. |
|
Get the advance width for a string.
Definition at line 227 of file FTFont.cpp. References FTGlyphContainer::Advance(). |
|
Get the advance width for a string.
Definition at line 209 of file FTFont.cpp. References FTGlyphContainer::Advance(). |
|
Get the global ascender height for the face.
Definition at line 119 of file FTFont.cpp. References FTSize::Ascender(). |
|
Attach auxilliary data to font e.g font metrics, from memory. Note: not all font formats implement this function.
Definition at line 53 of file FTFont.cpp. References FTFace::Attach(), FTFace::Error(), and face. |
|
Attach auxilliary file to font e.g font metrics. Note: not all font formats implement this function.
Definition at line 38 of file FTFont.cpp. References FTFace::Attach(), FTFace::Error(), and face. |
|
Get the bounding box for a string.
Definition at line 172 of file FTFont.cpp. References FTGlyphContainer::Advance(), FTGlyphContainer::BBox(), FTBBox::lowerX, FTBBox::lowerY, FTBBox::lowerZ, FTBBox::Move(), FTBBox::upperX, FTBBox::upperY, and FTBBox::upperZ. |
|
Get the bounding box for a string.
Definition at line 135 of file FTFont.cpp. References FTGlyphContainer::Advance(), FTGlyphContainer::BBox(), FTBBox::lowerX, FTBBox::lowerY, FTBBox::lowerZ, FTBBox::Move(), FTBBox::upperX, FTBBox::upperY, and FTBBox::upperZ. |
|
Set the character map for the face.
Definition at line 94 of file FTFont.cpp. References FTGlyphContainer::CharMap(), and FTGlyphContainer::Error(). |
|
Get the number of character maps in this face.
Definition at line 102 of file FTFont.cpp. References FTFace::CharMapCount(), and face. |
|
Get a list of character maps in this face.
Definition at line 108 of file FTFont.cpp. References FTFace::CharMapList(), and face. |
|
Set the extrusion distance for the font. Only implemented by FTGLExtrdFont
Reimplemented in FTGLExtrdFont. |
|
Gets the global descender height for the face.
Definition at line 125 of file FTFont.cpp. References FTSize::Descender(). |
|
Queries the Font for errors.
|
|
Get the current face size in points.
Definition at line 88 of file FTFont.cpp. References FTSize::CharSize(). Referenced by FTGLTextureFont::FaceSize(). |
|
Set the char size for the current face.
Reimplemented in FTGLTextureFont. Definition at line 68 of file FTFont.cpp. References FTFace::Error(), face, and FTFace::Size(). |
|
Gets the line spacing for the font.
Definition at line 130 of file FTFont.cpp. References FTSize::Height(). |
|
Construct a glyph of the correct type. Clients must overide the function and return their specialised FTGlyph.
|
|
Render a string of characters.
Reimplemented in FTGLBitmapFont, FTGLOutlineFont, FTGLPixmapFont, and FTGLTextureFont. Definition at line 261 of file FTFont.cpp. References FTGlyphContainer::Render(), FTPoint::X(), and FTPoint::Y(). |
|
Render a string of characters.
Reimplemented in FTGLBitmapFont, FTGLOutlineFont, FTGLPixmapFont, and FTGLTextureFont. Definition at line 245 of file FTFont.cpp. References FTGlyphContainer::Render(), FTPoint::X(), and FTPoint::Y(). Referenced by FTGLTextureFont::Render(), FTGLPixmapFont::Render(), FTGLOutlineFont::Render(), and FTGLBitmapFont::Render(). |
|
Enable or disable the use of Display Lists inside FTGL.
Definition at line 114 of file FTFont.cpp. References useDisplayLists. |
|
Current size object.
|
|
Current error code. Zero means no error. |
|
Current face object.
Definition at line 234 of file FTFont.h. Referenced by Attach(), CharMapCount(), CharMapList(), FaceSize(), and FTFont(). |
|
Flag to enable or disable the use of Display Lists inside FTGL
Definition at line 246 of file FTFont.h. Referenced by UseDisplayList(). |