# WoopsiUI::FreeTypeFont Class Reference

`#include <freetypefont.h>`

Inheritance diagram for WoopsiUI::FreeTypeFont:

List of all members.

## Public Member Functions
| FreeTypeFont (const FreeTypeCache *fontCache, const FaceID *faceID, const u8 width, const u8 height, const u16 colour)
| ~FreeTypeFont ()
void | getSbit (const u32 codepoint) const
u16 | getCharWidth (const u32 codepoint) const
u16 | getStringWidth (const WoopsiString &text) const
u16 | getStringWidth (const WoopsiString &text, s32 startIndex, s32 length) const
virtual const bool | isCharBlank (const u32 codepoint) const
s16 | drawChar (MutableBitmapBase *bitmap, u32 letter, s16 x, s16 y, u16 clipX1, u16 clipY1, u16 clipX2, u16 clipY2)

## Detailed Description

A font class using freetype, in association with a fontcache.

## Constructor & Destructor Documentation

WoopsiUI::FreeTypeFont::FreeTypeFont | ( | const FreeTypeCache * | fontCache,
|  | const FaceID * | faceID,
|  | const u8 | width,
|  | const u8 | height,
|  | const u16 | colour |
| ) |  |  |

Constructor.

Parameters:

  | fontCache | Cache for the font to use.
  | faceID | Index of a managed font.
  | width | The width of a single glyph.
  | height | The height of a single glyph.
  | colour | The colour of the font.

WoopsiUI::FreeTypeFont::~FreeTypeFont | ( |  | ) | `[inline]`

Destructor.

## Member Function Documentation

s16 WoopsiUI::FreeTypeFont::drawChar | ( | MutableBitmapBase * | bitmap,
|  | u32 | letter,
|  | s16 | x,
|  | s16 | y,
|  | u16 | clipX1,
|  | u16 | clipY1,
|  | u16 | clipX2,
|  | u16 | clipY2 |
| ) |  |  | `[virtual]`

Draw an individual character of the font to the specified bitmap.

Parameters:

  | bitmap | The bitmap to draw to.
  | letter | The character to output.
  | x | The x co-ordinate of the text.
  | y | The y co-ordinate of the text.
  | clipX1 | The left edge of the clipping rectangle.
  | clipY1 | The top edge of the clipping rectangle.
  | clipX2 | The right edge of the clipping rectangle.
  | clipY2 | The bottom edge of the clipping rectangle.

Returns:
  The x co-ordinate for the next character to be drawn.

Implements WoopsiUI::FontBase.

u16 WoopsiUI::FreeTypeFont::getCharWidth | ( | const u32 | codepoint | ) | const`[inline, virtual]`

Get the width of an individual character.

Parameters:

  | codepoint | The character to get the width of.

Returns:
  The width of the character in pixels.

Implements WoopsiUI::FontBase.

void WoopsiUI::FreeTypeFont::getSbit | ( | const u32 | codepoint | ) | const

Loads a small bitmap (with metrics) of a glyph.

Parameters:

  | codepoint | the Unicode codepoint of a glyph.

u16 WoopsiUI::FreeTypeFont::getStringWidth | ( | const WoopsiString & | text,
|  | s32 | startIndex,
|  | s32 | length |
| ) |  |  | const`[inline, virtual]`

Get the width of a portion of a string in pixels when drawn with this font. Useful if you want to determine the length of a section of a string.

Parameters:

  | text | The string to check.
  | startIndex | The start point of the substring within the string.
  | length | The length of the substring in chars.

Returns:
  The width of the substring in pixels.

Implements WoopsiUI::FontBase.

u16 WoopsiUI::FreeTypeFont::getStringWidth | ( | const WoopsiString & | text | ) | const`[inline, virtual]`

Get the width of a string in pixels when drawn with this font.

Parameters:

  | text | The string to check.

Returns:
  The width of the string in pixels.

Implements WoopsiUI::FontBase.

virtual const bool WoopsiUI::FreeTypeFont::isCharBlank | ( | const u32 | codepoint | ) | const`[inline, virtual]`

Checks if supplied character is blank in the current font.

Parameters:

  | codepoint | The character to check.

Returns:
  True if the glyph contains any pixels to be drawn. False if the glyph is blank.

Implements WoopsiUI::FontBase.

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

- freetypefont.h