List of all members
clan::Font Class Reference
clanDisplay Font

Font class. More...

`#include <font.h>`

## Public Member Functions
Construction
| Font ()
| Constructs a null font. More...
| Font (FontFamily &font_family, float height)
| Font (FontFamily &font_family, const FontDescription &desc)
| Font (const std::string &typeface_name, float height)
| Constructs standard font. More...
| Font (const std::string &typeface_name, const FontDescription &desc)
| Font (const FontDescription &desc, const std::string &ttf_filename)
| Font (const FontDescription &desc, const std::string &ttf_filename, FileSystem fs)
| Font (Canvas &canvas, const std::string &typeface_name, Sprite &sprite, const std::string &glyph_list, float spacelen, bool monospace, const FontMetrics &metrics)
| Constructs a Font based on a sprite. More...
Attributes
bool | is_null () const
| Returns true if this object is invalid. More...
void | throw_if_null () const
| Throw an exception if this object is invalid. More...
Operations
void | set_height (float value)
| Sets the font height. More...
void | set_weight (FontWeight value=FontWeight::normal)
| Sets the font weight. More...
void | set_line_height (float height)
| Sets the distance between each line. More...
void | set_style (FontStyle setting=FontStyle::normal)
| Sets the font style setting. More...
void | set_scalable (float height_threshold=64.0f)
| Sets the threshold to determine if the font can be drawn scaled. More...
void | draw_text (Canvas &canvas, const Pointf &position, const std::string &text, const Colorf &color=Colorf::white)
| Print text. More...
void | draw_text (Canvas &canvas, float xpos, float ypos, const std::string &text, const Colorf &color=Colorf::white)
GlyphMetrics | get_metrics (Canvas &canvas, unsigned int glyph)
| Gets the glyph metrics. More...
GlyphMetrics | measure_text (Canvas &canvas, const std::string &string)
| Measure text size. More...
FontMetrics | get_font_metrics (Canvas &canvas)
| Retrieves font metrics description for the selected font. More...
std::string | get_clipped_text (Canvas &canvas, const Sizef &box_size, const std::string &text, const std::string &ellipsis_text="...")
| Retrieves clipped version of the text that will fit into a box. More...
int | get_character_index (Canvas &canvas, const std::string &text, const Pointf &point)
| Get the character index at a specified point. More...
std::vector< Rectf > | get_character_indices (Canvas &canvas, const std::string &text)
| Get the rectangles of each glyph in a string of text. More...
size_t | clip_from_left (Canvas &canvas, const std::string &text, float width)
size_t | clip_from_right (Canvas &canvas, const std::string &text, float width)

## Static Public Member Functions
Resources
static Resource< Font > | resource (Canvas &canvas, const std::string &family_name, const FontDescription &desc, const ResourceManager &resources)
| Retrieves a Font resource from the resource manager. More...
static Font | load (Canvas &canvas, const std::string &family_name, const FontDescription &reference_desc, FontFamily &font_family, const XMLResourceDocument &doc, std::function< Resource< Sprite >(Canvas &, const std::string &)> cb_get_sprite=std::function< Resource< Sprite >(Canvas &, const std::string &)>())
| Loads a Font from a XML resource definition. More...

## Implementation
class | Path

## Detailed Description

Font class.

A Font is a collection of images that can be used to represent text on a screen.

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

- font.h