#include <font.h>
| Public Member Functions | |
| Font () | |
| Constructs a null font. | |
| 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. | |
| Font (const FontDescription &desc, const std::string &ttf_filename) | |
| Font (const FontDescription &desc, const std::string &ttf_filename, FileSystem fs) | |
| Font (const std::string &typeface_name, const FontDescription &desc) | |
| Font (const std::string &typeface_name, float height) | |
| Constructs standard font. | |
| Font (FontFamily &font_family, const FontDescription &desc) | |
| Font (FontFamily &font_family, float height) | |
| size_t | clip_from_left (Canvas &canvas, const std::string &text, float width) const | 
| size_t | clip_from_right (Canvas &canvas, const std::string &text, float width) const | 
| void | draw_text (Canvas &canvas, const Pointf &position, const std::string &text, const Colorf &color=StandardColorf::white()) | 
| Print text. | |
| void | draw_text (Canvas &canvas, float xpos, float ypos, const std::string &text, const Colorf &color=StandardColorf::white()) | 
| int | get_character_index (Canvas &canvas, const std::string &text, const Pointf &point) const | 
| Get the character index at a specified point. | |
| std::vector< Rectf > | get_character_indices (Canvas &canvas, const std::string &text) const | 
| Get the rectangles of each glyph in a string of text. | |
| std::string | get_clipped_text (Canvas &canvas, const Sizef &box_size, const std::string &text, const std::string &ellipsis_text="...") const | 
| Retrieves clipped version of the text that will fit into a box. | |
| FontDescription | get_description () const | 
| FontMetrics | get_font_metrics (Canvas &canvas) const | 
| Retrieves font metrics description for the selected font. | |
| FontHandle * | get_handle (Canvas &canvas) | 
| Get the font handle interface. | |
| GlyphMetrics | get_metrics (Canvas &canvas, unsigned int glyph) const | 
| Gets the glyph metrics. | |
| bool | is_null () const | 
| Returns true if this object is invalid. | |
| GlyphMetrics | measure_text (Canvas &canvas, const std::string &string) const | 
| Measure text size. | |
| operator bool () const | |
| void | set_height (float value) | 
| Sets the font height. | |
| void | set_line_height (float height) | 
| Sets the distance between each line. | |
| void | set_scalable (float height_threshold=64.0f) | 
| Sets the threshold to determine if the font can be drawn scaled. | |
| void | set_style (FontStyle setting=FontStyle::normal) | 
| Sets the font style setting. | |
| void | set_weight (FontWeight value=FontWeight::normal) | 
| Sets the font weight. | |
| void | throw_if_null () const | 
| Throw an exception if this object is invalid. | |
| Static Public Member Functions | |
| 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. | |
| 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. | |
| Friends | |
| class | Path | 
| clan::Font::Font | ( | ) | 
Constructs a null font.
| clan::Font::Font | ( | FontFamily & | font_family, | 
| float | height ) | 
| clan::Font::Font | ( | FontFamily & | font_family, | 
| const FontDescription & | desc ) | 
| clan::Font::Font | ( | const std::string & | typeface_name, | 
| float | height ) | 
Constructs standard font.
| clan::Font::Font | ( | const std::string & | typeface_name, | 
| const FontDescription & | desc ) | 
| clan::Font::Font | ( | const FontDescription & | desc, | 
| const std::string & | ttf_filename ) | 
| clan::Font::Font | ( | const FontDescription & | desc, | 
| const std::string & | ttf_filename, | ||
| FileSystem | fs ) | 
| clan::Font::Font | ( | Canvas & | canvas, | 
| const std::string & | typeface_name, | ||
| Sprite & | sprite, | ||
| const std::string & | glyph_list, | ||
| float | spacelen, | ||
| bool | monospace, | ||
| const FontMetrics & | metrics ) | 
| size_t clan::Font::clip_from_left | ( | Canvas & | canvas, | 
| const std::string & | text, | ||
| float | width ) const | 
| size_t clan::Font::clip_from_right | ( | Canvas & | canvas, | 
| const std::string & | text, | ||
| float | width ) const | 
| void clan::Font::draw_text | ( | Canvas & | canvas, | 
| const Pointf & | position, | ||
| const std::string & | text, | ||
| const Colorf & | color = StandardColorf::white() ) | 
Print text.
| canvas | = Canvas | 
| position | = Dest position | 
| text | = The text to draw | 
| color | = The text color | 
| 
 | inline | 
References clan::color, and draw_text().
Referenced by draw_text().
| int clan::Font::get_character_index | ( | Canvas & | canvas, | 
| const std::string & | text, | ||
| const Pointf & | point ) const | 
Get the character index at a specified point.
| canvas | = Canvas | 
| text | = The string | 
| point | = The point | 
| std::vector< Rectf > clan::Font::get_character_indices | ( | Canvas & | canvas, | 
| const std::string & | text ) const | 
Get the rectangles of each glyph in a string of text.
| std::string clan::Font::get_clipped_text | ( | Canvas & | canvas, | 
| const Sizef & | box_size, | ||
| const std::string & | text, | ||
| const std::string & | ellipsis_text = "..." ) const | 
Retrieves clipped version of the text that will fit into a box.
| FontDescription clan::Font::get_description | ( | ) | const | 
| FontMetrics clan::Font::get_font_metrics | ( | Canvas & | canvas | ) | const | 
Retrieves font metrics description for the selected font.
| FontHandle * clan::Font::get_handle | ( | Canvas & | canvas | ) | 
Get the font handle interface.
For example, use auto handle = dynamic_cast<FontHandle_Win32>(font.get_handle()); if (handle) {...} to obtain a specific interface
| GlyphMetrics clan::Font::get_metrics | ( | Canvas & | canvas, | 
| unsigned int | glyph ) const | 
Gets the glyph metrics.
| glyph | = The glyph to get | 
| 
 | inline | 
Returns true if this object is invalid.
| 
 | static | 
Loads a Font from a XML resource definition.
| GlyphMetrics clan::Font::measure_text | ( | Canvas & | canvas, | 
| const std::string & | string ) const | 
Measure text size.
| string | = The text to use | 
| 
 | inlineexplicit | 
| 
 | static | 
| void clan::Font::set_height | ( | float | value | ) | 
Sets the font height.
| void clan::Font::set_line_height | ( | float | height | ) | 
Sets the distance between each line.
| void clan::Font::set_scalable | ( | float | height_threshold = 64.0f | ) | 
Sets the threshold to determine if the font can be drawn scaled.
All font sizes are scalable when using sprite fonts
| void clan::Font::set_style | ( | FontStyle | setting = FontStyle::normal | ) | 
Sets the font style setting.
| void clan::Font::set_weight | ( | FontWeight | value = FontWeight::normal | ) | 
Sets the font weight.
| void clan::Font::throw_if_null | ( | ) | const | 
Throw an exception if this object is invalid.
| 
 | friend |