FTGL: FTSimpleLayout Class Reference

FTGL 2.4.0

Public Member Functions
FTSimpleLayout Class Reference

FTSimpleLayout is a specialisation of FTLayout for simple text boxes. More...

`#include <FTSimpleLayout.h>`

Inheritance diagram for FTSimpleLayout:
[legend]
Collaboration diagram for FTSimpleLayout:
[legend]

## Public Member Functions
| FTSimpleLayout ()
| Initializes line spacing to 1.0, alignment to ALIGN_LEFT and wrap to 100.0. More...
| ~FTSimpleLayout ()
| Destructor. More...
virtual FTBBox | BBox (const char *string, const int len=-1, FTPoint position=FTPoint())
| Get the bounding box for a formatted string. More...
virtual FTBBox | BBox (const wchar_t *string, const int len=-1, FTPoint position=FTPoint())
| Get the bounding box for a formatted string. More...
virtual void | Render (const char *string, const int len=-1, FTPoint position=FTPoint(), int renderMode=FTGL::RENDER_ALL)
| Render a string of characters. More...
virtual void | Render (const wchar_t *string, const int len=-1, FTPoint position=FTPoint(), int renderMode=FTGL::RENDER_ALL)
| Render a string of characters. More...
void | SetFont (FTFont *fontInit)
| Set the font to use for rendering the text. More...
FTFont * | GetFont ()
void | SetLineLength (const float LineLength)
| The maximum line length for formatting text. More...
float | GetLineLength () const
void | SetAlignment (const FTGL::TextAlignment Alignment)
| The text alignment mode used to distribute space within a line or rendered text. More...
FTGL::TextAlignment | GetAlignment () const
void | SetLineSpacing (const float LineSpacing)
| Sets the line height. More...
float | GetLineSpacing () const
Public Member Functions inherited from FTLayout
virtual | ~FTLayout ()
| Destructor. More...
virtual FT_Error | Error () const
| Queries the Layout for errors. More...

## Additional Inherited Members
Protected Member Functions inherited from FTLayout
| FTLayout ()

## Detailed Description

FTSimpleLayout is a specialisation of FTLayout for simple text boxes.

This class has basic support for text wrapping, left, right and centered alignment, and text justification.

See also
  FTLayout

Definition at line 49 of file FTSimpleLayout.h.

## Constructor & Destructor Documentation

## ◆ FTSimpleLayout()

FTSimpleLayout::FTSimpleLayout | ( |  | ) |

Initializes line spacing to 1.0, alignment to ALIGN_LEFT and wrap to 100.0.

## ◆ ~FTSimpleLayout()

FTSimpleLayout::~FTSimpleLayout | ( |  | ) |

Destructor.

## Member Function Documentation

## ◆ BBox() [1/2]

virtual FTBBox FTSimpleLayout::BBox | ( | const char * | string,
|  | const int | len = `-1`,
|  | FTPoint | position = `FTPoint()`
| ) |  |
| virtual

Get the bounding box for a formatted string.

Parameters

  string | A char string.
  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).

Returns
  The corresponding bounding box.

Implements FTLayout.

## ◆ BBox() [2/2]

virtual FTBBox FTSimpleLayout::BBox | ( | const wchar_t * | string,
|  | const int | len = `-1`,
|  | FTPoint | position = `FTPoint()`
| ) |  |
| virtual

Get the bounding box for a formatted string.

Parameters

  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).
  position | The pen position of the first character (optional).

Returns
  The corresponding bounding box.

Implements FTLayout.

## ◆ GetAlignment()

FTGL::TextAlignment FTSimpleLayout::GetAlignment | ( |  | ) | const

Returns
  The text alignment mode.

## ◆ GetFont()

FTFont* FTSimpleLayout::GetFont | ( |  | ) |

Returns
  The current font.

## ◆ GetLineLength()

float FTSimpleLayout::GetLineLength | ( |  | ) | const

Returns
  The current line length.

## ◆ GetLineSpacing()

float FTSimpleLayout::GetLineSpacing | ( |  | ) | const

Returns
  The line spacing.

## ◆ Render() [1/2]

virtual void FTSimpleLayout::Render | ( | const char * | string,
|  | const int | len = `-1`,
|  | FTPoint | position = `FTPoint()`,
|  | int | renderMode = `FTGL::RENDER_ALL`
| ) |  |
| virtual

Render a string of characters.

Parameters

  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).
  renderMode | Render mode to display (optional)

Implements FTLayout.

## ◆ Render() [2/2]

virtual void FTSimpleLayout::Render | ( | const wchar_t * | string,
|  | const int | len = `-1`,
|  | FTPoint | position = `FTPoint()`,
|  | int | renderMode = `FTGL::RENDER_ALL`
| ) |  |
| virtual

Render a string of characters.

Parameters

  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).
  renderMode | Render mode to display (optional)

Implements FTLayout.

## ◆ SetAlignment()

void FTSimpleLayout::SetAlignment | ( | const FTGL::TextAlignment | Alignment | ) |

The text alignment mode used to distribute space within a line or rendered text.

Parameters

  Alignment | The new alignment mode.

## ◆ SetFont()

void FTSimpleLayout::SetFont | ( | FTFont * | fontInit | ) |

Set the font to use for rendering the text.

Parameters

  fontInit | A pointer to the new font. The font is referenced by this but will not be disposed of when this is deleted.

## ◆ SetLineLength()

void FTSimpleLayout::SetLineLength | ( | const float | LineLength | ) |

The maximum line length for formatting text.

Parameters

  LineLength | The new line length.

## ◆ SetLineSpacing()

void FTSimpleLayout::SetLineSpacing | ( | const float | LineSpacing | ) |

Sets the line height.

Parameters

  LineSpacing | The height of each line of text expressed as a percentage of the current fonts line height.

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

- FTSimpleLayout.h