FTGL 2.4.0
|
FTFont is the public interface for the FTGL library. More...
#include <FTFont.h>
Public Member Functions | |
virtual | ~FTFont () |
virtual bool | Attach (const char *fontFilePath) |
Attach auxilliary file to font e.g font metrics. | |
virtual bool | Attach (const unsigned char *pBufferBytes, size_t bufferSizeInBytes) |
Attach auxilliary data to font e.g font metrics, from memory. | |
virtual void | GlyphLoadFlags (FT_Int flags) |
Set the glyph loading flags. | |
virtual bool | CharMap (FT_Encoding encoding) |
Set the character map for the face. | |
virtual unsigned int | CharMapCount () const |
Get the number of character maps in this face. | |
virtual 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. | |
virtual unsigned int | FaceSize () const |
Get the current face size in points (1/72 inch). | |
virtual void | Depth (float depth) |
Set the extrusion distance for the font. | |
virtual void | Outset (float outset) |
Set the outset distance for the font. | |
virtual void | Outset (float front, float back) |
Set the front and back outset distances for the font. | |
virtual void | UseDisplayList (bool useList) |
Enable or disable the use of Display Lists inside FTGL. | |
virtual float | Ascender () const |
Get the global ascender height for the face. | |
virtual float | Descender () const |
Gets the global descender height for the face. | |
virtual float | LineHeight () const |
Gets the line spacing for the font. | |
virtual FTBBox | BBox (const char *string, const int len=-1, FTPoint position=FTPoint(), FTPoint spacing=FTPoint()) |
Get the bounding box for a string. | |
void | BBox (const char *string, float &llx, float &lly, float &llz, float &urx, float &ury, float &urz) |
Get the bounding box for a string (deprecated). | |
virtual FTBBox | BBox (const wchar_t *string, const int len=-1, FTPoint position=FTPoint(), FTPoint spacing=FTPoint()) |
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 (deprecated). | |
virtual float | Advance (const char *string, const int len=-1, FTPoint spacing=FTPoint()) |
Get the advance for a string. | |
virtual float | Advance (const wchar_t *string, const int len=-1, FTPoint spacing=FTPoint()) |
Get the advance for a string. | |
virtual FTPoint | Render (const char *string, const int len=-1, FTPoint position=FTPoint(), FTPoint spacing=FTPoint(), int renderMode=FTGL::RENDER_ALL) |
Render a string of characters. | |
virtual FTPoint | Render (const wchar_t *string, const int len=-1, FTPoint position=FTPoint(), FTPoint spacing=FTPoint(), int renderMode=FTGL::RENDER_ALL) |
Render a string of characters. | |
virtual FT_Error | Error () const |
Queries the Font for errors. | |
Protected Member Functions | |
FTFont (char const *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 FTGlyph * | MakeGlyph (FT_GlyphSlot slot)=0 |
Construct a glyph of the correct type. | |
Friends | |
class | FTBitmapFont |
class | FTBufferFont |
class | FTExtrudeFont |
class | FTOutlineFont |
class | FTPixmapFont |
class | FTPolygonFont |
class | FTTextureFont |
class | FTTriangleExtractorFont |
class | FTFontImpl |
FTFont is the public interface for the FTGL library.
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.
|
protected |
Open and read a font file.
Sets Error flag.
fontFilePath | font file path. |
|
protected |
|
virtual |
|
virtual |
Get the advance for a string.
string | 'C' style string to be checked. |
len | The length of the string. If < 0 then all characters will be checked until a null character is encountered (optional). |
spacing | A displacement vector to add after each character has been checked (optional). |
|
virtual |
Get the advance for a string.
string | A wchar_t string |
len | The length of the string. If < 0 then all characters will be checked until a null character is encountered (optional). |
spacing | A displacement vector to add after each character has been checked (optional). |
|
virtual |
Get the global ascender height for the face.
|
virtual |
Attach auxilliary file to font e.g font metrics.
Note: not all font formats implement this function.
fontFilePath | auxilliary font file path. |
true
if file has been attached successfully.
|
virtual |
Attach auxilliary data to font e.g font metrics, from memory.
Note: not all font formats implement this function.
pBufferBytes | the in-memory buffer. |
bufferSizeInBytes | the length of the buffer in bytes. |
true
if file has been attached successfully.
|
virtual |
Get the bounding box for a string.
string | A char buffer. |
len | The length of the string. If < 0 then all characters will be checked until a null character is encountered (optional). |
position | The pen position of the first character (optional). |
spacing | A displacement vector to add after each character has been checked (optional). |
|
inline |
Get the bounding box for a string (deprecated).
string | A char buffer. |
llx | Lower left near x coordinate. |
lly | Lower left near y coordinate. |
llz | Lower left near z coordinate. |
urx | Upper right far x coordinate. |
ury | Upper right far y coordinate. |
urz | Upper right far z coordinate. |
Definition at line 252 of file FTFont.h.
References FTBBox::Lower(), FTBBox::Upper(), FTPoint::Xf(), FTPoint::Yf(), and FTPoint::Zf().
|
virtual |
Get the bounding box for a string.
string | A wchar_t buffer. |
len | The length of the string. If < 0 then all characters will be checked until a null character is encountered (optional). |
position | The pen position of the first character (optional). |
spacing | A displacement vector to add after each character has been checked (optional). |
|
inline |
Get the bounding box for a string (deprecated).
string | A wchar_t buffer. |
llx | Lower left near x coordinate. |
lly | Lower left near y coordinate. |
llz | Lower left near z coordinate. |
urx | Upper right far x coordinate. |
ury | Upper right far y coordinate. |
urz | Upper right far z coordinate. |
Definition at line 287 of file FTFont.h.
References FTBBox::Lower(), FTBBox::Upper(), FTPoint::Xf(), FTPoint::Yf(), and FTPoint::Zf().
|
virtual |
Set the character map for the face.
encoding | Freetype enumerate for char map code. |
true
if charmap was valid and set correctly.
|
virtual |
Get the number of character maps in this face.
|
virtual |
Get a list of character maps in this face.
|
virtual |
Set the extrusion distance for the font.
Only implemented by FTExtrudeFont
depth | The extrusion distance. |
|
virtual |
Gets the global descender height for the face.
|
virtual |
Queries the Font for errors.
|
virtual |
Get the current face size in points (1/72 inch).
|
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
|
virtual |
Set the glyph loading flags.
By default, fonts use the most sensible flags when loading a font's glyph using FT_Load_Glyph(). This function allows to override the default flags.
flags | The glyph loading flags. |
|
virtual |
Gets the line spacing for the font.
|
protectedpure virtual |
Construct a glyph of the correct type.
Clients must override the function and return their specialised FTGlyph.
slot | A FreeType glyph slot. |
null
on failure. Implemented in FTBufferFont, FTBitmapFont, FTExtrudeFont, FTOutlineFont, FTPixmapFont, FTPolygonFont, FTTextureFont, and FTTriangleExtractorFont.
|
virtual |
Set the front and back outset distances for the font.
Only implemented by FTExtrudeFont
front | The front outset distance. |
back | The back outset distance. |
|
virtual |
Set the outset distance for the font.
Only implemented by FTOutlineFont, FTPolygonFont and FTExtrudeFont
outset | The outset distance. |
|
virtual |
Render a string of characters.
string | 'C' style string to be output. |
len | The length of the string. If < 0 then all characters will be displayed until a null character is encountered (optional). |
position | The pen position of the first character (optional). |
spacing | A displacement vector to add after each character has been displayed (optional). |
renderMode | Render mode to use for display (optional). Gives the application the ability to control whether to render the font's front and back faces via FTGL::RENDER_FRONT and FTGL::RENDER_BACK respectively, or font sides via FTGL::RENDER_SIDE for extruded glyph fonts. |
|
virtual |
Render a string of characters.
string | wchar_t string to be output. |
len | The length of the string. If < 0 then all characters will be displayed until a null character is encountered (optional). |
position | The pen position of the first character (optional). |
spacing | A displacement vector to add after each character has been displayed (optional). |
renderMode | Render mode to use for display (optional). Gives the application the ability to control whether to render the font's front and back faces via FTGL::RENDER_FRONT and FTGL::RENDER_BACK respectively, or font sides via FTGL::RENDER_SIDE for extruded glyph fonts. |
|
virtual |
Enable or disable the use of Display Lists inside FTGL.
useList | true turns ON display lists. false turns OFF display lists. |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |