FTGL 2.4.0

Data Structures | Typedefs | Functions
FTFont.h File Reference
`#include <FTGL/ftgl.h>`
Include dependency graph for FTFont.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures
class | FTFont
| FTFont is the public interface for the FTGL library. More...

## Typedefs
typedef struct _FTGLfont | FTGLfont

## Functions
FTGLfont * | ftglCreateCustomFont (char const *fontFilePath, void *data, FTGLglyph *(*makeglyphCallback)(FT_GlyphSlot, void *))
| Create a custom FTGL font object.
FTGLfont * | ftglCreateCustomFontFromMem (const unsigned char *bytes, size_t len, void *data, FTGLglyph *(*makeglyphCallback)(FT_GlyphSlot, void *))
| Create a custom FTGL font object from a buffer in memory.
void | ftglDestroyFont (FTGLfont *font)
| Destroy an FTGL font object.
int | ftglAttachFile (FTGLfont *font, const char *path)
| Attach auxilliary file to font e.g.
int | ftglAttachData (FTGLfont *font, const unsigned char *data, size_t size)
| Attach auxilliary data to font, e.g.
void | ftglSetFontGlyphLoadFlags (FTGLfont *font, FT_Int flags)
| Set the glyph loading flags.
int | ftglSetFontCharMap (FTGLfont *font, FT_Encoding encoding)
| Set the character map for the face.
unsigned int | ftglGetFontCharMapCount (FTGLfont *font)
| Get the number of character maps in this face.
FT_Encoding * | ftglGetFontCharMapList (FTGLfont *font)
| Get a list of character maps in this face.
int | ftglSetFontFaceSize (FTGLfont *font, unsigned int size, unsigned int res)
| Set the char size for the current face.
unsigned int | ftglGetFontFaceSize (FTGLfont *font)
| Get the current face size in points (1/72 inch).
void | ftglSetFontDepth (FTGLfont *font, float depth)
| Set the extrusion distance for the font.
void | ftglSetFontOutset (FTGLfont *font, float front, float back)
| Set the outset distance for the font.
void | ftglSetFontDisplayList (FTGLfont *font, int useList)
| Enable or disable the use of Display Lists inside FTGL.
float | ftglGetFontAscender (FTGLfont *font)
| Get the global ascender height for the face.
float | ftglGetFontDescender (FTGLfont *font)
| Gets the global descender height for the face.
float | ftglGetFontLineHeight (FTGLfont *font)
| Gets the line spacing for the font.
void | ftglGetFontBBox (FTGLfont *font, const char *string, int len, float bounds[6])
| Get the bounding box for a string.
float | ftglGetFontAdvance (FTGLfont *font, const char *string)
| Get the advance width for a string.
void | ftglRenderFont (FTGLfont *font, const char *string, int mode)
| Render a string of characters.
FT_Error | ftglGetFontError (FTGLfont *font)
| Query a font for errors.

## Typedef Documentation

## ◆ FTGLfont

typedef struct _FTGLfont FTGLfont

Definition at line 414 of file FTFont.h.

## Function Documentation

## ◆ ftglAttachData()

int ftglAttachData | ( | FTGLfont * | font,
|  | const unsigned char * | data,
|  | size_t | size )

Attach auxilliary data to font, e.g.

font metrics, from memory.

Note: not all font formats implement this function.

Parameters

  font | An FTGLfont* object.
  data | The in-memory buffer.
  size | The length of the buffer in bytes.

Returns
  1 if file has been attached successfully.

References FTGL_EXPORT, and ftglAttachData().

Referenced by ftglAttachData().

## ◆ ftglAttachFile()

int ftglAttachFile | ( | FTGLfont * | font,
|  | const char * | path )

Attach auxilliary file to font e.g.

font metrics.

Note: not all font formats implement this function.

Parameters

  font | An FTGLfont* object.
  path | Auxilliary font file path.

Returns
  1 if file has been attached successfully.

References FTGL_EXPORT, and ftglAttachFile().

Referenced by ftglAttachFile().

## ◆ ftglCreateCustomFont()

FTGLfont * ftglCreateCustomFont | ( | char const * | fontFilePath,
|  | void * | data,
|  | FTGLglyph * | makeglyphCallback (*)(FT_GlyphSlot, void *) )

Create a custom FTGL font object.

Parameters

  fontFilePath | The font file name.
  data | A pointer to private data that will be passed to callbacks.
  makeglyphCallback | A glyph-making callback function.

Returns
  An FTGLfont* object.

References FTGL_EXPORT, and ftglCreateCustomFont().

Referenced by ftglCreateCustomFont().

## ◆ ftglCreateCustomFontFromMem()

FTGLfont * ftglCreateCustomFontFromMem | ( | const unsigned char * | bytes,
|  | size_t | len,
|  | void * | data,
|  | FTGLglyph * | makeglyphCallback (*)(FT_GlyphSlot, void *) )

Create a custom FTGL font object from a buffer in memory.

Parameters

  bytes | the in-memory buffer
  len | the length of the buffer in bytes
  data | A pointer to private data that will be passed to callbacks.
  makeglyphCallback | A glyph-making callback function.

Returns
  An FTGLfont* object.

References FTGL_EXPORT, and ftglCreateCustomFontFromMem().

Referenced by ftglCreateCustomFontFromMem().

## ◆ ftglDestroyFont()

void ftglDestroyFont | ( | FTGLfont * | font | ) |

Destroy an FTGL font object.

Parameters

  font | An FTGLfont* object.

References FTGL_EXPORT, and ftglDestroyFont().

Referenced by ftglDestroyFont().

## ◆ ftglGetFontAdvance()

float ftglGetFontAdvance | ( | FTGLfont * | font,
|  | const char * | string )

Get the advance width for a string.

Parameters

  font | An FTGLfont* object.
  string | A char string.

Returns
  Advance width

References FTGL_EXPORT, and ftglGetFontAdvance().

Referenced by ftglGetFontAdvance().

## ◆ ftglGetFontAscender()

float ftglGetFontAscender | ( | FTGLfont * | font | ) |

Get the global ascender height for the face.

Parameters

  font | An FTGLfont* object.

Returns
  Ascender height

References FTGL_EXPORT, and ftglGetFontAscender().

Referenced by ftglGetFontAscender().

## ◆ ftglGetFontBBox()

void ftglGetFontBBox | ( | FTGLfont * | font,
|  | const char * | string,
|  | int | len,
|  | float | bounds[6] )

Get the bounding box for a string.

Parameters

  font | An FTGLfont* object.
  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).
  bounds | An array of 6 float values where the bounding box's lower left near and upper right far 3D coordinates will be stored.

References FTGL_EXPORT, and ftglGetFontBBox().

Referenced by ftglGetFontBBox().

## ◆ ftglGetFontCharMapCount()

unsigned int ftglGetFontCharMapCount | ( | FTGLfont * | font | ) |

Get the number of character maps in this face.

Parameters

  font | An FTGLfont* object.

Returns
  character map count.

References FTGL_EXPORT, and ftglGetFontCharMapCount().

Referenced by ftglGetFontCharMapCount().

## ◆ ftglGetFontCharMapList()

FT_Encoding * ftglGetFontCharMapList | ( | FTGLfont * | font | ) |

Get a list of character maps in this face.

Parameters

  font | An FTGLfont* object.

Returns
  pointer to the first encoding.

References FTGL_EXPORT, and ftglGetFontCharMapList().

Referenced by ftglGetFontCharMapList().

## ◆ ftglGetFontDescender()

float ftglGetFontDescender | ( | FTGLfont * | font | ) |

Gets the global descender height for the face.

Parameters

  font | An FTGLfont* object.

Returns
  Descender height

References FTGL_EXPORT, and ftglGetFontDescender().

Referenced by ftglGetFontDescender().

## ◆ ftglGetFontError()

FT_Error ftglGetFontError | ( | FTGLfont * | font | ) |

Query a font for errors.

Parameters

  font | An FTGLfont* object.

Returns
  The current error code.

References FTGL_END_C_DECLS, FTGL_EXPORT, and ftglGetFontError().

Referenced by ftglGetFontError().

## ◆ ftglGetFontFaceSize()

unsigned int ftglGetFontFaceSize | ( | FTGLfont * | font | ) |

Get the current face size in points (1/72 inch).

Parameters

  font | An FTGLfont* object.

Returns
  face size

References FTGL_EXPORT, and ftglGetFontFaceSize().

Referenced by ftglGetFontFaceSize().

## ◆ ftglGetFontLineHeight()

float ftglGetFontLineHeight | ( | FTGLfont * | font | ) |

Gets the line spacing for the font.

Parameters

  font | An FTGLfont* object.

Returns
  Line height

References FTGL_EXPORT, and ftglGetFontLineHeight().

Referenced by ftglGetFontLineHeight().

## ◆ ftglRenderFont()

void ftglRenderFont | ( | FTGLfont * | font,
|  | const char * | string,
|  | int | mode )

Render a string of characters.

Parameters

  font | An FTGLfont* object.
  string | Char string to be output.
  mode | Render mode to display.

References FTGL_EXPORT, and ftglRenderFont().

Referenced by ftglRenderFont().

## ◆ ftglSetFontCharMap()

int ftglSetFontCharMap | ( | FTGLfont * | font,
|  | FT_Encoding | encoding )

Set the character map for the face.

Parameters

  font | An FTGLfont* object.
  encoding | Freetype enumerate for char map code.

Returns
  1 if charmap was valid and set correctly.

References FTGL_EXPORT, and ftglSetFontCharMap().

Referenced by ftglSetFontCharMap().

## ◆ ftglSetFontDepth()

void ftglSetFontDepth | ( | FTGLfont * | font,
|  | float | depth )

Set the extrusion distance for the font.

Only implemented by FTExtrudeFont.

Parameters

  font | An FTGLfont* object.
  depth | The extrusion distance.

References FTGL_EXPORT, and ftglSetFontDepth().

Referenced by ftglSetFontDepth().

## ◆ ftglSetFontDisplayList()

void ftglSetFontDisplayList | ( | FTGLfont * | font,
|  | int | useList )

Enable or disable the use of Display Lists inside FTGL.

Parameters

  font | An FTGLfont* object.
  useList | 1 turns ON display lists. 0 turns OFF display lists.

References FTGL_EXPORT, and ftglSetFontDisplayList().

Referenced by ftglSetFontDisplayList().

## ◆ ftglSetFontFaceSize()

int ftglSetFontFaceSize | ( | FTGLfont * | font,
|  | unsigned int | size,
|  | unsigned int | res )

Set the char size for the current face.

Parameters

  font | An FTGLfont* object.
  size | The face size in points (1/72 inch).
  res | The resolution of the target device, or 0 to use the default value of 72.

Returns
  1 if size was set correctly.

References FTGL_EXPORT, and ftglSetFontFaceSize().

Referenced by ftglSetFontFaceSize().

## ◆ ftglSetFontGlyphLoadFlags()

void ftglSetFontGlyphLoadFlags | ( | FTGLfont * | font,
|  | FT_Int | flags )

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.

Parameters

  font | An FTGLfont* object.
  flags | The glyph loading flags.

References FTGL_EXPORT, and ftglSetFontGlyphLoadFlags().

Referenced by ftglSetFontGlyphLoadFlags().

## ◆ ftglSetFontOutset()

void ftglSetFontOutset | ( | FTGLfont * | font,
|  | float | front,
|  | float | back )

Set the outset distance for the font.

Only FTOutlineFont, FTPolygonFont and FTExtrudeFont implement front outset. Only FTExtrudeFont implements back outset.

Parameters

  font | An FTGLfont* object.
  front | The front outset distance.
  back | The back outset distance.

References FTGL_EXPORT, and ftglSetFontOutset().

Referenced by ftglSetFontOutset().