Classes | |
class | clan::Font |
Font class. More... | |
class | clan::FontDescription |
Font description class. More... | |
class | clan::FontFamily |
FontFamily class. More... | |
class | clan::FontMetrics |
Font metrics class. More... | |
class | clan::GlyphMetrics |
Glyph metrics class. More... | |
Enumerations | |
enum | clan::FontStyle { clan::FontStyle::normal, clan::FontStyle::italic, clan::FontStyle::oblique } |
enum | clan::FontWeight : int { clan::FontWeight::thin = 100, clan::FontWeight::extra_light = 200, clan::FontWeight::light = 300, clan::FontWeight::normal = 400, clan::FontWeight::medium = 500, clan::FontWeight::semi_bold = 600, clan::FontWeight::bold = 700, clan::FontWeight::extra_bold = 800, clan::FontWeight::heavy = 900 } |
Functions | |
clan::GlyphMetrics::GlyphMetrics () | |
clan::GlyphMetrics::GlyphMetrics (const Pointf &bbox_offset, const Sizef &bbox_size, const Sizef &advance) | |
Variables | |
Sizef | clan::GlyphMetrics::advance |
Distance the write cursor is moved. More... | |
Pointf | clan::GlyphMetrics::bbox_offset |
Bounding box offset relative to the write cursor position. More... | |
Sizef | clan::GlyphMetrics::bbox_size |
Bounding box size The bounding box is the smallest rectangle that completely encloses the glyph. More... | |
Construction | |
clan::Font::Font () | |
Constructs a null font. More... | |
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. More... | |
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) | |
Constructs a Font based on a sprite. More... | |
Resources | |
static Resource< Font > | clan::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 | clan::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... | |
Attributes | |
bool | clan::Font::is_null () const |
Returns true if this object is invalid. More... | |
void | clan::Font::throw_if_null () const |
Throw an exception if this object is invalid. More... | |
Operations | |
void | clan::Font::set_height (float value) |
Sets the font height. More... | |
void | clan::Font::set_weight (FontWeight value=FontWeight::normal) |
Sets the font weight. More... | |
void | clan::Font::set_line_height (float height) |
Sets the distance between each line. More... | |
void | clan::Font::set_style (FontStyle setting=FontStyle::normal) |
Sets the font style setting. More... | |
void | clan::Font::set_scalable (float height_threshold=64.0f) |
Sets the threshold to determine if the font can be drawn scaled. More... | |
void | clan::Font::draw_text (Canvas &canvas, const Pointf &position, const std::string &text, const Colorf &color=Colorf::white) |
Print text. More... | |
void | clan::Font::draw_text (Canvas &canvas, float xpos, float ypos, const std::string &text, const Colorf &color=Colorf::white) |
GlyphMetrics | clan::Font::get_metrics (Canvas &canvas, unsigned int glyph) |
Gets the glyph metrics. More... | |
GlyphMetrics | clan::Font::measure_text (Canvas &canvas, const std::string &string) |
Measure text size. More... | |
FontMetrics | clan::Font::get_font_metrics (Canvas &canvas) |
Retrieves font metrics description for the selected font. More... | |
std::string | clan::Font::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 | clan::Font::get_character_index (Canvas &canvas, const std::string &text, const Pointf &point) |
Get the character index at a specified point. More... | |
std::vector< Rectf > | clan::Font::get_character_indices (Canvas &canvas, const std::string &text) |
Get the rectangles of each glyph in a string of text. More... | |
size_t | clan::Font::clip_from_left (Canvas &canvas, const std::string &text, float width) |
size_t | clan::Font::clip_from_right (Canvas &canvas, const std::string &text, float width) |
Implementation | |
class | clan::Font::Path |
Construction | |
clan::FontDescription::FontDescription () | |
Constructs a font description with default values. More... | |
virtual | clan::FontDescription::~FontDescription () |
static FontDescription | clan::FontDescription::create_null_object () |
Create null object. More... | |
Operations | |
FontDescription & | clan::FontDescription::operator= (const FontDescription ©) |
Copy assignment operator (does not copy the description, use clone() if you want that) More... | |
FontDescription | clan::FontDescription::clone () const |
void | clan::FontDescription::set_height (float value=20.0f) |
Sets the font height. More... | |
void | clan::FontDescription::set_average_width (float value=0.0f) |
Sets the font average width. More... | |
void | clan::FontDescription::set_escapement (float value) |
Sets the font escapement. More... | |
void | clan::FontDescription::set_orientation (float value) |
Sets the font orientation. More... | |
void | clan::FontDescription::set_weight (FontWeight value=FontWeight::normal) |
Sets the font weight. More... | |
void | clan::FontDescription::set_line_height (float height) |
Sets the distance between each line. More... | |
void | clan::FontDescription::set_style (FontStyle setting=FontStyle::normal) |
Sets the font style. More... | |
void | clan::FontDescription::set_anti_alias (bool setting=true) |
Sets the font anti-alias setting (defaults to true) More... | |
void | clan::FontDescription::set_subpixel (bool setting=true) |
Sets the font subpixel rendering setting (defaults to true) More... | |
void | clan::FontDescription::set_charset (Charset new_charset) |
Sets the font charset (defaults to charset_default) More... | |
Construction | |
clan::FontFamily::FontFamily () | |
Constructs a null font family. More... | |
clan::FontFamily::FontFamily (const std::string &family_name) | |
Constructs a font family with the given family name. More... | |
Attributes | |
bool | clan::FontFamily::is_null () const |
Returns true if this object is invalid. More... | |
void | clan::FontFamily::throw_if_null () const |
Throw an exception if this object is invalid. More... | |
const std::string & | clan::FontFamily::get_family_name () const |
Font family name used for this font family. More... | |
Operations | |
void | clan::FontFamily::add (const std::string &typeface_name, float height) |
Add standard font. More... | |
void | clan::FontFamily::add (const std::string &typeface_name, const FontDescription &desc) |
void | clan::FontFamily::add (const FontDescription &desc, const std::string &ttf_filename) |
void | clan::FontFamily::add (const FontDescription &desc, const std::string &ttf_filename, FileSystem fs) |
void | clan::FontFamily::add (Canvas &canvas, Sprite &sprite, const std::string &glyph_list, float spacelen, bool monospace, const FontMetrics &metrics) |
Add a Font based on a sprite. More... | |
Implementation | |
class | clan::FontFamily::Font_Impl |
Construction | |
clan::FontMetrics::FontMetrics () | |
clan::FontMetrics::FontMetrics (float height, float ascent, float descent, float internal_leading, float external_leading, float line_height, float pixel_ratio) | |
clan::FontMetrics::~FontMetrics () | |
Attributes | |
float | clan::FontMetrics::get_height () const |
Returns the height of the font. More... | |
float | clan::FontMetrics::get_line_height () const |
Return the distance between lines. More... | |
float | clan::FontMetrics::get_baseline_offset () const |
Returns the baseline offset from the top of a line. More... | |
float | clan::FontMetrics::get_ascent () const |
Returns the font ascender. More... | |
float | clan::FontMetrics::get_descent () const |
Returns the font descender. More... | |
float | clan::FontMetrics::get_internal_leading () const |
Returns the amount of leading (space) inside the bounds set by the get_height() function. More... | |
float | clan::FontMetrics::get_external_leading () const |
Returns the amount of extra leading (space) that to add between rows. More... | |
|
strong |
|
strong |
clan::Font::Font | ( | ) |
Constructs a null font.
clan::Font::Font | ( | Canvas & | canvas, |
const std::string & | typeface_name, | ||
Sprite & | sprite, | ||
const std::string & | glyph_list, | ||
float | spacelen, | ||
bool | monospace, | ||
const FontMetrics & | metrics | ||
) |
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 | ( | const std::string & | typeface_name, |
const FontDescription & | desc | ||
) |
clan::Font::Font | ( | const std::string & | typeface_name, |
float | height | ||
) |
Constructs standard font.
clan::Font::Font | ( | FontFamily & | font_family, |
const FontDescription & | desc | ||
) |
clan::Font::Font | ( | FontFamily & | font_family, |
float | height | ||
) |
clan::FontDescription::FontDescription | ( | ) |
Constructs a font description with default values.
clan::FontFamily::FontFamily | ( | ) |
Constructs a null font family.
clan::FontFamily::FontFamily | ( | const std::string & | family_name | ) |
Constructs a font family with the given family name.
clan::FontMetrics::FontMetrics | ( | ) |
clan::FontMetrics::FontMetrics | ( | float | height, |
float | ascent, | ||
float | descent, | ||
float | internal_leading, | ||
float | external_leading, | ||
float | line_height, | ||
float | pixel_ratio | ||
) |
|
inline |
|
inline |
|
virtual |
clan::FontMetrics::~FontMetrics | ( | ) |
void clan::FontFamily::add | ( | Canvas & | canvas, |
Sprite & | sprite, | ||
const std::string & | glyph_list, | ||
float | spacelen, | ||
bool | monospace, | ||
const FontMetrics & | metrics | ||
) |
void clan::FontFamily::add | ( | const FontDescription & | desc, |
const std::string & | ttf_filename | ||
) |
void clan::FontFamily::add | ( | const FontDescription & | desc, |
const std::string & | ttf_filename, | ||
FileSystem | fs | ||
) |
void clan::FontFamily::add | ( | const std::string & | typeface_name, |
const FontDescription & | desc | ||
) |
void clan::FontFamily::add | ( | const std::string & | typeface_name, |
float | height | ||
) |
Add standard font.
size_t clan::Font::clip_from_left | ( | Canvas & | canvas, |
const std::string & | text, | ||
float | width | ||
) |
size_t clan::Font::clip_from_right | ( | Canvas & | canvas, |
const std::string & | text, | ||
float | width | ||
) |
FontDescription clan::FontDescription::clone | ( | ) | const |
|
static |
Create null object.
void clan::Font::draw_text | ( | Canvas & | canvas, |
const Pointf & | position, | ||
const std::string & | text, | ||
const Colorf & | color = Colorf::white |
||
) |
Print text.
canvas | = Canvas |
position | = Dest position |
text | = The text to draw |
color | = The text color |
|
inline |
References clan::color, and clan::Font::draw_text().
Referenced by clan::Font::draw_text().
bool clan::FontDescription::get_anti_alias | ( | ) | const |
Get the font anti-alias setting (defaults to true)
float clan::FontMetrics::get_ascent | ( | ) | const |
Returns the font ascender.
float clan::FontDescription::get_average_width | ( | ) | const |
Returns the font average width.
0.0f = Use default
float clan::FontMetrics::get_baseline_offset | ( | ) | const |
Returns the baseline offset from the top of a line.
int clan::Font::get_character_index | ( | Canvas & | canvas, |
const std::string & | text, | ||
const Pointf & | point | ||
) |
Get the character index at a specified point.
canvas | = Canvas |
text | = The string |
point | = The point |
Get the rectangles of each glyph in a string of text.
Charset clan::FontDescription::get_charset | ( | ) | const |
\biref Get the font charset
std::string clan::Font::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.
float clan::FontMetrics::get_descent | ( | ) | const |
Returns the font descender.
float clan::FontDescription::get_escapement | ( | ) | const |
Returns the font escapement.
float clan::FontMetrics::get_external_leading | ( | ) | const |
Returns the amount of extra leading (space) that to add between rows.
const std::string& clan::FontFamily::get_family_name | ( | ) | const |
Font family name used for this font family.
FontMetrics clan::Font::get_font_metrics | ( | Canvas & | canvas | ) |
Retrieves font metrics description for the selected font.
float clan::FontMetrics::get_height | ( | ) | const |
Returns the height of the font.
float clan::FontDescription::get_height | ( | ) | const |
Returns the font height.
float clan::FontMetrics::get_internal_leading | ( | ) | const |
Returns the amount of leading (space) inside the bounds set by the get_height() function.
float clan::FontMetrics::get_line_height | ( | ) | const |
Return the distance between lines.
float clan::FontDescription::get_line_height | ( | ) | const |
Returns the distance between each line.
GlyphMetrics clan::Font::get_metrics | ( | Canvas & | canvas, |
unsigned int | glyph | ||
) |
Gets the glyph metrics.
glyph | = The glyph to get |
float clan::FontDescription::get_orientation | ( | ) | const |
Returns the font orientation.
FontStyle clan::FontDescription::get_style | ( | ) | const |
Returns the font style.
bool clan::FontDescription::get_subpixel | ( | ) | const |
Get the font subpixel rendering setting (defaults to true)
std::string clan::FontDescription::get_unique_id | ( | ) | const |
Returns an unique string identifying this font description.
This is useful for placing font descriptions in a map. Line_height is excluded.
FontWeight clan::FontDescription::get_weight | ( | ) | const |
Returns the font weight.
|
inline |
Returns true if this object is invalid.
|
inline |
Returns true if this object is invalid.
|
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 | ||
) |
Measure text size.
string | = The text to use |
FontDescription& clan::FontDescription::operator= | ( | const FontDescription & | copy | ) |
Copy assignment operator (does not copy the description, use clone() if you want that)
bool clan::FontDescription::operator== | ( | const FontDescription & | other | ) | const |
Returns true if the font is identical Line_height is excluded.
|
static |
void clan::FontDescription::set_anti_alias | ( | bool | setting = true | ) |
Sets the font anti-alias setting (defaults to true)
void clan::FontDescription::set_average_width | ( | float | value = 0.0f | ) |
Sets the font average width.
0.0f = Use default
void clan::FontDescription::set_charset | ( | Charset | new_charset | ) |
Sets the font charset (defaults to charset_default)
new_charset | = The charset. charset_default = Use operating systems default |
void clan::FontDescription::set_escapement | ( | float | value | ) |
Sets the font escapement.
void clan::Font::set_height | ( | float | value | ) |
Sets the font height.
void clan::FontDescription::set_height | ( | float | value = 20.0f | ) |
Sets the font height.
void clan::Font::set_line_height | ( | float | height | ) |
Sets the distance between each line.
void clan::FontDescription::set_line_height | ( | float | height | ) |
Sets the distance between each line.
void clan::FontDescription::set_orientation | ( | float | value | ) |
Sets the font orientation.
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::FontDescription::set_style | ( | FontStyle | setting = FontStyle::normal | ) |
Sets the font style.
void clan::FontDescription::set_subpixel | ( | bool | setting = true | ) |
Sets the font subpixel rendering setting (defaults to true)
void clan::Font::set_weight | ( | FontWeight | value = FontWeight::normal | ) |
Sets the font weight.
void clan::FontDescription::set_weight | ( | FontWeight | value = FontWeight::normal | ) |
Sets the font weight.
void clan::FontFamily::throw_if_null | ( | ) | const |
Throw an exception if this object is invalid.
void clan::Font::throw_if_null | ( | ) | const |
Throw an exception if this object is invalid.
void clan::FontDescription::throw_if_null | ( | ) | const |
Throw an exception if this object is invalid.
Sizef clan::GlyphMetrics::advance |
Distance the write cursor is moved.
Pointf clan::GlyphMetrics::bbox_offset |
Bounding box offset relative to the write cursor position.
Sizef clan::GlyphMetrics::bbox_size |
Bounding box size The bounding box is the smallest rectangle that completely encloses the glyph.
|
friend |
|
friend |