#include <font.h>
Public Member Functions | |
virtual int | character_index (const CanvasPtr &canvas, const std::string &text, const Pointf &point)=0 |
Get the character index at a specified point. More... | |
virtual std::vector< Rectf > | character_indices (const CanvasPtr &canvas, const std::string &text)=0 |
Get the rectangles of each glyph in a string of text. More... | |
size_t | clip_from_left (const CanvasPtr &canvas, const std::string &text, float width) |
size_t | clip_from_right (const CanvasPtr &canvas, const std::string &text, float width) |
std::string | clipped_text (const CanvasPtr &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... | |
virtual void | draw_text (const CanvasPtr &canvas, const Pointf &position, const std::string &text, const Colorf &color=Colorf::white)=0 |
Print text. More... | |
void | draw_text (const CanvasPtr &canvas, float xpos, float ypos, const std::string &text, const Colorf &color=Colorf::white) |
virtual const FontMetrics & | font_metrics (const CanvasPtr &canvas)=0 |
Retrieves font metrics description for the selected font. More... | |
virtual FontHandle * | handle (const CanvasPtr &canvas)=0 |
Get the font handle interface. More... | |
virtual GlyphMetrics | measure_text (const CanvasPtr &canvas, const std::string &string)=0 |
Measure text size. More... | |
virtual GlyphMetrics | metrics (const CanvasPtr &canvas, unsigned int glyph)=0 |
Gets the glyph metrics. More... | |
virtual void | set_height (float value)=0 |
Sets the font height. More... | |
virtual void | set_line_height (float height)=0 |
Sets the distance between each line. More... | |
virtual void | set_scalable (float height_threshold=64.0f)=0 |
Sets the threshold to determine if the font can be drawn scaled. More... | |
virtual void | set_style (FontStyle setting=FontStyle::normal)=0 |
Sets the font style setting. More... | |
virtual void | set_weight (FontWeight value=FontWeight::normal)=0 |
Sets the font weight. More... | |
Static Public Member Functions | |
static std::shared_ptr< Font > | create (const FontFamilyPtr &font_family, float height) |
static std::shared_ptr< Font > | create (const FontFamilyPtr &font_family, const FontDescription &desc) |
static std::shared_ptr< Font > | create (const std::string &typeface_name, float height) |
Constructs standard font. More... | |
static std::shared_ptr< Font > | create (const std::string &typeface_name, const FontDescription &desc) |
static std::shared_ptr< Font > | create (const FontDescription &desc, const std::string &ttf_filename) |
|
pure virtual |
Get the character index at a specified point.
canvas | = Canvas |
text | = The string |
point | = The point |
|
pure virtual |
Get the rectangles of each glyph in a string of text.
size_t uicore::Font::clip_from_left | ( | const CanvasPtr & | canvas, |
const std::string & | text, | ||
float | width | ||
) |
size_t uicore::Font::clip_from_right | ( | const CanvasPtr & | canvas, |
const std::string & | text, | ||
float | width | ||
) |
std::string uicore::Font::clipped_text | ( | const CanvasPtr & | 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.
|
static |
|
static |
|
static |
Constructs standard font.
|
static |
|
static |
|
pure virtual |
Print text.
canvas | = Canvas |
position | = Dest position |
text | = The text to draw |
color | = The text color |
|
inline |
References uicore::color, and draw_text().
Referenced by draw_text().
|
pure virtual |
Retrieves font metrics description for the selected font.
|
pure virtual |
Get the font handle interface.
For example, use auto handle = dynamic_cast<FontHandle_Win32>(font.handle()); if (handle) {...} to obtain a specific interface
|
pure virtual |
Measure text size.
string | = The text to use |
|
pure virtual |
Gets the glyph metrics.
glyph | = The glyph to get |
|
pure virtual |
Sets the font height.
|
pure virtual |
Sets the distance between each line.
|
pure virtual |
Sets the threshold to determine if the font can be drawn scaled.
All font sizes are scalable when using sprite fonts
|
pure virtual |
Sets the font style setting.
|
pure virtual |
Sets the font weight.