33 #include "../Render/graphic_context.h"
34 #include "../Image/pixel_buffer.h"
35 #include "../2D/sprite.h"
36 #include "font_description.h"
37 #include "glyph_metrics.h"
191 std::shared_ptr<Font_Impl> impl;
size_t clip_from_right(Canvas &canvas, const std::string &text, float width)
void set_line_height(float height)
Sets the distance between each line.
Floating point color description class (for float).
Definition: color.h:660
void set_scalable(float height_threshold=64.0f)
Sets the threshold to determine if the font can be drawn scaled.
Font description class.
Definition: font_description.h:66
Resource proxy of a specific type.
Definition: resource.h:58
static Colorf white
Definition: color.h:1251
2D Graphics Canvas
Definition: canvas.h:72
void set_style(FontStyle setting=FontStyle::normal)
Sets the font style setting.
size_t clip_from_left(Canvas &canvas, const std::string &text, float width)
FontWeight
Definition: font_description.h:43
Sprite class.
Definition: sprite.h:55
void throw_if_null() const
Throw an exception if this object is invalid.
void set_height(float value)
Sets the font height.
Glyph metrics class.
Definition: glyph_metrics.h:41
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.
FontStyle
Definition: font_description.h:56
Virtual File System (VFS).
Definition: file_system.h:47
Resource manager.
Definition: resource_manager.h:44
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.
std::vector< Rectf > get_character_indices(Canvas &canvas, const std::string &text)
Get the rectangles of each glyph in a string of text.
void draw_text(Canvas &canvas, float xpos, float ypos, const std::string &text, const Colorf &color=Colorf::white)
Definition: font.h:145
void draw_text(Canvas &canvas, const Pointf &position, const std::string &text, const Colorf &color=Colorf::white)
Print text.
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.
GlyphMetrics get_metrics(Canvas &canvas, unsigned int glyph)
Gets the glyph metrics.
Font class.
Definition: font.h:53
int get_character_index(Canvas &canvas, const std::string &text, const Pointf &point)
Get the character index at a specified point.
XML Resource Document.
Definition: xml_resource_document.h:48
bool is_null() const
Returns true if this object is invalid.
Definition: font.h:111
2D (x,y) point structure - Float
Definition: point.h:72
FontFamily class.
Definition: font_family.h:52
void set_weight(FontWeight value=FontWeight::normal)
Sets the font weight.
GlyphMetrics measure_text(Canvas &canvas, const std::string &string)
Measure text size.
Font()
Constructs a null font.
FontMetrics get_font_metrics(Canvas &canvas)
Retrieves font metrics description for the selected font.
2D (width,height) size structure - Float
Definition: size.h:169
Font metrics class.
Definition: font_metrics.h:46