clanDisplay Font

Classes

class  clan::Font
 Font class. More...
 
class  clan::FontDescription
 Font description class. More...
 
class  clan::FontMetrics
 Font metrics class. More...
 
class  clan::VectorFont
 Vector font drawing class. More...
 

Construction

 clan::Font::Font ()
 Constructs a font. More...
 
 clan::Font::Font (Canvas &canvas, const std::string &typeface_name, int height)
 Constructs standard font. More...
 
 clan::Font::Font (Canvas &canvas, const FontDescription &desc)
 
 clan::Font::Font (Canvas &canvas, const FontDescription &desc, const std::string &ttf_filename)
 
 clan::Font::Font (Canvas &canvas, Sprite &sprite, const std::string &glyph_list, int spacelen, bool monospace, const FontMetrics &metrics)
 Constructs a Font based on a sprite. More...
 

Resources

static Resource< Font > clan::Font::resource (Canvas &canvas, const FontDescription &desc, const ResourceManager &resources)
 Retrieves a Font resource from the resource manager. More...
 

Attributes

bool clan::Font::is_null () const
 Is Null. More...
 

Operations

void clan::Font::draw_text (Canvas &canvas, int x, int y, const std::string &text, const Colorf &color=Colorf::white)
 Print text on gc. More...
 
void clan::Font::draw_text (Canvas &canvas, float x, float y, const std::string &text, const Colorf &color=Colorf::white)
 Print text on gc. More...
 
void clan::Font::draw_text (Canvas &canvas, const Pointf &position, const std::string &text, const Colorf &color=Colorf::white)
 Print text on gc. More...
 
void clan::Font::draw_text_ellipsis (Canvas &canvas, int x, int y, Rect content_box, const std::string &text, const Colorf &color=Colorf::white)
 Print text on gc adding ellipses if it does not fit. More...
 
void clan::Font::draw_text_ellipsis (Canvas &canvas, float x, float y, Rectf content_box, const std::string &text, const Colorf &color=Colorf::white)
 Print text on gc adding ellipses if it does not fit. More...
 
void clan::Font::draw_text_ellipsis (Canvas &canvas, const Pointf &position, Rectf content_box, const std::string &text, const Colorf &color=Colorf::white)
 Print text on gc adding ellipses if it does not fit. More...
 
Size clan::Font::get_text_size (Canvas &canvas, const std::string &text)
 Calculate size of text string. More...
 
Size clan::Font::get_glyph_size (Canvas &canvas, unsigned int glyph)
 Gets the size of a specified glyph. More...
 
FontMetrics clan::Font::get_font_metrics ()
 Retrieves font metrics description for the selected font. More...
 
int clan::Font::get_character_index (Canvas &canvas, const std::string &text, const Point &point)
 Get the character index at a specified point. More...
 

Construction

 clan::FontDescription::FontDescription ()
 Constructs a font description with default values. More...
 
 clan::FontDescription::FontDescription (const std::string &typeface_name)
 Constructs a font description with default values. More...
 
virtual clan::FontDescription::~FontDescription ()
 
static FontDescription clan::FontDescription::create_null_object ()
 Create null object. More...
 

Attributes

enum  clan::FontDescription::Charset {
  clan::FontDescription::charset_default, clan::FontDescription::charset_ansi, clan::FontDescription::charset_baltic, clan::FontDescription::charset_chinesebig5,
  clan::FontDescription::charset_easteurope, clan::FontDescription::charset_gb2312, clan::FontDescription::charset_greek, clan::FontDescription::charset_hangul,
  clan::FontDescription::charset_mac, clan::FontDescription::charset_oem, clan::FontDescription::charset_russian, clan::FontDescription::charset_shiftjis,
  clan::FontDescription::charset_symbol, clan::FontDescription::charset_turkish, clan::FontDescription::charset_vietnamese, clan::FontDescription::charset_johab,
  clan::FontDescription::charset_arabic, clan::FontDescription::charset_hebrew, clan::FontDescription::charset_thai
}
 
bool clan::FontDescription::is_null () const
 Returns true if this object is invalid. More...
 
void clan::FontDescription::throw_if_null () const
 Throw an exception if this object is invalid. More...
 
const std::string & clan::FontDescription::get_typeface_name () const
 Returns the typeface name. More...
 
int clan::FontDescription::get_height () const
 Returns the font height. More...
 
int clan::FontDescription::get_average_width () const
 Returns the font average width. More...
 
float clan::FontDescription::get_escapement () const
 Returns the font escapement. More...
 
float clan::FontDescription::get_orientation () const
 Returns the font orientation. More...
 
int clan::FontDescription::get_weight () const
 Returns the font weight. More...
 
bool clan::FontDescription::get_italic () const
 Returns the font italic setting. More...
 
bool clan::FontDescription::get_underline () const
 Returns the font underline setting. More...
 
bool clan::FontDescription::get_strikeout () const
 Returns the font strikeout setting. More...
 
bool clan::FontDescription::get_fixed_pitch () const
 Returns the font fixed pitch setting. More...
 
bool clan::FontDescription::get_anti_alias () const
 Get the font anti-alias setting (defaults to true) More...
 
bool clan::FontDescription::get_subpixel () const
 Get the font subpixel rendering setting (defaults to true) More...
 
Charset clan::FontDescription::get_charset () const
 Get the font charset More...
 
bool clan::FontDescription::operator== (const FontDescription &other) const
 Returns true if the font is identical. More...
 
std::string clan::FontDescription::get_unique_id () const
 Returns an unique string identifying this font description. More...
 

Operations

FontDescription & clan::FontDescription::operator= (const FontDescription &copy)
 Copy assignment operator. More...
 
FontDescription clan::FontDescription::clone () const
 
void clan::FontDescription::set_typeface_name (const std::string &name)
 Sets the typeface name. More...
 
void clan::FontDescription::set_height (int value)
 Sets the font height. More...
 
void clan::FontDescription::set_average_width (int value)
 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 (int value)
 Sets the font weight. More...
 
void clan::FontDescription::set_italic (bool setting=true)
 Sets the font italic setting. More...
 
void clan::FontDescription::set_underline (bool setting=true)
 Sets the font underline setting. More...
 
void clan::FontDescription::set_strikeout (bool setting=true)
 Sets the font strikeout setting. More...
 
void clan::FontDescription::set_fixed_pitch (bool setting=true)
 Sets the font fixed pitch setting. 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::FontMetrics::FontMetrics (float height=0.0f, float ascent=0.0f, float descent=0.0f, float internal_leading=0.0f, float external_leading=0.0f, float average_character_width=0.0f, float max_character_width=0.0f, float weight=0.0f, float overhang=0.0f, float digitized_aspect_x=0.0f, float digitized_aspect_y=0.0f, bool italic=false, bool underlined=false, bool struck_out=false, bool fixed_pitch=false)
 
 clan::FontMetrics::~FontMetrics ()
 

Attributes

float clan::FontMetrics::get_height () const
 Returns the height of the font. 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 the application adds between rows. More...
 
float clan::FontMetrics::get_average_character_width () const
 Returns the average width of characters in the font. More...
 
float clan::FontMetrics::get_max_character_width () const
 Returns the width of the widest character in the font. More...
 
float clan::FontMetrics::get_weight () const
 Returns the weight of the font. More...
 
float clan::FontMetrics::get_overhang () const
 Returns the extra width per string that may be added to some synthesized fonts. More...
 
float clan::FontMetrics::get_digitized_aspect_x () const
 Returns the horizontal aspect of the device for which the font was designed. More...
 
float clan::FontMetrics::get_digitized_aspect_y () const
 Returns the vertical aspect of the device for which the font was designed. More...
 
std::string::value_type clan::FontMetrics::get_first_char () const
 Returns the value of the first character defined in the font. More...
 
std::string::value_type clan::FontMetrics::get_last_char () const
 Returns the value of the last character defined in the font. More...
 
std::string::value_type clan::FontMetrics::get_default_char () const
 Returns the value of the character to be substituted for characters not in the font. More...
 
std::string::value_type clan::FontMetrics::get_word_break_char () const
 Returns the value of the character that will be used to define word breaks for text justification. More...
 
bool clan::FontMetrics::is_italic () const
 Returns true if the font is italic. More...
 
bool clan::FontMetrics::is_underlined () const
 Returns true if the font is underlined. More...
 
bool clan::FontMetrics::is_struck_out () const
 Returns true if the font is struck out. More...
 
bool clan::FontMetrics::is_fixed_pitch () const
 Returns true if the font is a mono space font. More...
 

Operations

void clan::FontMetrics::set_height (float value)
 Set the height of the font. More...
 
void clan::FontMetrics::set_ascent (float value)
 Set the font ascender. More...
 
void clan::FontMetrics::set_descent (float value)
 Set the font descender. More...
 
void clan::FontMetrics::set_internal_leading (float value)
 Set the amount of leading (space) inside the bounds set by the set_height() function. More...
 
void clan::FontMetrics::set_external_leading (float value)
 Set the amount of extra leading (space) that the application adds between rows. More...
 
void clan::FontMetrics::set_average_character_width (float value)
 Set the average width of characters in the font. More...
 
void clan::FontMetrics::set_max_character_width (float value)
 Set the width of the widest character in the font. More...
 
void clan::FontMetrics::set_weight (float value)
 Set the weight of the font. More...
 
void clan::FontMetrics::set_overhang (float value)
 Set the extra width per string that may be added to some synthesized fonts. More...
 
void clan::FontMetrics::set_digitized_aspect_x (float value)
 Set the horizontal aspect of the device for which the font was designed. More...
 
void clan::FontMetrics::set_digitized_aspect_y (float value)
 Set the vertical aspect of the device for which the font was designed. More...
 
void clan::FontMetrics::set_italic (bool value)
 Set if the font is italic. More...
 
void clan::FontMetrics::set_underlined (bool value)
 Set if the font is underlined. More...
 
void clan::FontMetrics::set_struck_out (bool value)
 Set if the font is struck out. More...
 
void clan::FontMetrics::set_fixed_pitch (bool value)
 Set if the font is a mono space font. More...
 

Construction

 clan::VectorFont::VectorFont ()
 Constructs vector font. More...
 
 clan::VectorFont::VectorFont (Canvas &canvas, const std::string &typeface_name, int height, const std::string &filename)
 Constructs a Font Vector. More...
 
 clan::VectorFont::VectorFont (Canvas &canvas, const FontDescription &desc, const std::string &filename)
 Constructs a Font Vector. More...
 
 clan::VectorFont::VectorFont (const Font &font)
 Constructs a Font Vector from a Font, ensuring the correct type. More...
 
 clan::VectorFont::~VectorFont ()
 

Attributes

bool clan::VectorFont::is_null () const
 Is Null. More...
 
Rectf clan::VectorFont::get_bounding_box (const std::string &reference_string) const
 Get the largest bounding box for each glyph for this font in a given reference string. More...
 
const std::vector< Vec2f > & clan::VectorFont::get_glyph_filled (unsigned int glyph)
 
const std::vector< std::vector
< Vec2f > > & 
clan::VectorFont::get_glyph_outline (unsigned int glyph)
 
Size clan::VectorFont::get_text_size (Canvas &canvas, const std::string &text)
 Calculate size of text string. More...
 
Size clan::VectorFont::get_glyph_size (Canvas &canvas, unsigned int glyph)
 Gets the size of a specified glyph. More...
 
FontMetrics clan::VectorFont::get_font_metrics ()
 Retrieves font metrics description for the selected font. More...
 

Operations

void clan::VectorFont::draw_text (Canvas &canvas, int x, int y, const std::string &text, const Colorf &color=Colorf::white)
 Print text on gc. More...
 
void clan::VectorFont::draw_text (Canvas &canvas, float x, float y, const std::string &text, const Colorf &color=Colorf::white)
 Print text on gc. More...
 
void clan::VectorFont::draw_text (Canvas &canvas, const Pointf &position, const std::string &text, const Colorf &color=Colorf::white)
 Print text on gc. More...
 
void clan::VectorFont::draw_text_ellipsis (Canvas &canvas, int x, int y, Rect content_box, const std::string &text, const Colorf &color=Colorf::white)
 Print text on gc adding ellipses if it does not fit. More...
 
void clan::VectorFont::draw_text_ellipsis (Canvas &canvas, float x, float y, Rectf content_box, const std::string &text, const Colorf &color=Colorf::white)
 Print text on gc adding ellipses if it does not fit. More...
 
void clan::VectorFont::draw_text_ellipsis (Canvas &canvas, const Pointf &position, Rectf content_box, const std::string &text, const Colorf &color=Colorf::white)
 Print text on gc adding ellipses if it does not fit. More...
 
void clan::VectorFont::set_filled (bool enable=true)
 Set to draw filled (default) More...
 
void clan::VectorFont::set_texture (const Texture2D &src_texture, const Rectf &bounding_rect, const Rectf &texture_rect=Rectf(0.0f, 0.0f, 1.0f, 1.0f))
 Set the texture. More...
 
void clan::VectorFont::set_texture (const Texture2D &src_texture, const Rectf &bounding_rect, const Rect &texture_rect)
 
void clan::VectorFont::reset_texture ()
 Reset the texture. More...
 

Implementation

std::shared_ptr< VectorFont_Impl > clan::VectorFont::impl
 

Detailed Description

Enumeration Type Documentation

Enumerator
charset_default 
charset_ansi 
charset_baltic 
charset_chinesebig5 
charset_easteurope 
charset_gb2312 
charset_greek 
charset_hangul 
charset_mac 
charset_oem 
charset_russian 
charset_shiftjis 
charset_symbol 
charset_turkish 
charset_vietnamese 
charset_johab 
charset_arabic 
charset_hebrew 
charset_thai 

Function Documentation

clan::Font::Font ( )

Constructs a font.

clan::Font::Font ( Canvas canvas,
const std::string &  typeface_name,
int  height 
)

Constructs standard font.

Parameters
canvas= Canvas
clan::Font::Font ( Canvas canvas,
const FontDescription desc 
)
clan::Font::Font ( Canvas canvas,
const FontDescription desc,
const std::string &  ttf_filename 
)
clan::Font::Font ( Canvas canvas,
Sprite sprite,
const std::string &  glyph_list,
int  spacelen,
bool  monospace,
const FontMetrics metrics 
)

Constructs a Font based on a sprite.

Parameters
sprite= Sprite with glyphs
glyph_list= Letter to glyph mapping
spacelen= Width of space character
monospace= Force monospaced font (using widest sprite character)
metrics= Font metrics for the sprite font
clan::FontDescription::FontDescription ( )

Constructs a font description with default values.

clan::FontDescription::FontDescription ( const std::string &  typeface_name)

Constructs a font description with default values.

clan::FontMetrics::FontMetrics ( float  height = 0.0f,
float  ascent = 0.0f,
float  descent = 0.0f,
float  internal_leading = 0.0f,
float  external_leading = 0.0f,
float  average_character_width = 0.0f,
float  max_character_width = 0.0f,
float  weight = 0.0f,
float  overhang = 0.0f,
float  digitized_aspect_x = 0.0f,
float  digitized_aspect_y = 0.0f,
bool  italic = false,
bool  underlined = false,
bool  struck_out = false,
bool  fixed_pitch = false 
)
clan::VectorFont::VectorFont ( )

Constructs vector font.

clan::VectorFont::VectorFont ( Canvas canvas,
const std::string &  typeface_name,
int  height,
const std::string &  filename 
)

Constructs a Font Vector.

Parameters
canvas= Canvas
typeface_name= String Ref
height= value
clan::VectorFont::VectorFont ( Canvas canvas,
const FontDescription desc,
const std::string &  filename 
)

Constructs a Font Vector.

Parameters
canvas= Canvas
desc= Font Description
clan::VectorFont::VectorFont ( const Font font)
explicit

Constructs a Font Vector from a Font, ensuring the correct type.

virtual clan::FontDescription::~FontDescription ( )
virtual
clan::FontMetrics::~FontMetrics ( )
clan::VectorFont::~VectorFont ( )
FontDescription clan::FontDescription::clone ( ) const
static FontDescription clan::FontDescription::create_null_object ( )
static

Create null object.

Returns
Font Description
void clan::Font::draw_text ( Canvas canvas,
int  x,
int  y,
const std::string &  text,
const Colorf color = Colorf::white 
)

Print text on gc.

Multiline text (seperated by /n) is supported

Parameters
canvas= Canvas
x= X position
y= Y position
text= The text to draw
color= The text color
void clan::VectorFont::draw_text ( Canvas canvas,
int  x,
int  y,
const std::string &  text,
const Colorf color = Colorf::white 
)

Print text on gc.

Multiline text (seperated by /n) is supported

Parameters
canvas= Canvas
x= X position
y= Y position
text= The text to draw
color= The text color
void clan::Font::draw_text ( Canvas canvas,
float  x,
float  y,
const std::string &  text,
const Colorf color = Colorf::white 
)

Print text on gc.

Multiline text (seperated by /n) is supported

Parameters
canvas= Canvas
x= X position
y= Y position
text= The text to draw
color= The text color
void clan::VectorFont::draw_text ( Canvas canvas,
float  x,
float  y,
const std::string &  text,
const Colorf color = Colorf::white 
)

Print text on gc.

Multiline text (seperated by /n) is supported

Parameters
canvas= Canvas
x= X position
y= Y position
text= The text to draw
color= The text color
void clan::Font::draw_text ( Canvas canvas,
const Pointf position,
const std::string &  text,
const Colorf color = Colorf::white 
)

Print text on gc.

Multiline text (seperated by /n) is supported

Parameters
canvas= Canvas
position= Dest position
text= The text to draw
color= The text color
void clan::VectorFont::draw_text ( Canvas canvas,
const Pointf position,
const std::string &  text,
const Colorf color = Colorf::white 
)

Print text on gc.

Multiline text (seperated by /n) is supported

Parameters
canvas= Canvas
position= Dest position
text= The text to draw
color= The text color
void clan::Font::draw_text_ellipsis ( Canvas canvas,
int  x,
int  y,
Rect  content_box,
const std::string &  text,
const Colorf color = Colorf::white 
)

Print text on gc adding ellipses if it does not fit.

Multiline text (seperated by /n) is supported

Parameters
canvas= Canvas
x= X position
y= Y position
content_box= Rectangle the text is allowed within
text= The text to draw
color= The text color
void clan::VectorFont::draw_text_ellipsis ( Canvas canvas,
int  x,
int  y,
Rect  content_box,
const std::string &  text,
const Colorf color = Colorf::white 
)

Print text on gc adding ellipses if it does not fit.

Multiline text (seperated by /n) is supported

Parameters
canvas= Canvas
x= X position
y= Y position
content_box= Rectangle the text is allowed within
text= The text to draw
color= The text color
void clan::Font::draw_text_ellipsis ( Canvas canvas,
float  x,
float  y,
Rectf  content_box,
const std::string &  text,
const Colorf color = Colorf::white 
)

Print text on gc adding ellipses if it does not fit.

Multiline text (seperated by /n) is supported

Parameters
canvas= Canvas
x= X position
y= Y position
content_box= Rectangle the text is allowed within
text= The text to draw
color= The text color
void clan::VectorFont::draw_text_ellipsis ( Canvas canvas,
float  x,
float  y,
Rectf  content_box,
const std::string &  text,
const Colorf color = Colorf::white 
)

Print text on gc adding ellipses if it does not fit.

Multiline text (seperated by /n) is supported

Parameters
canvas= Canvas
x= X position
y= Y position
content_box= Rectangle the text is allowed within
text= The text to draw
color= The text color
void clan::Font::draw_text_ellipsis ( Canvas canvas,
const Pointf position,
Rectf  content_box,
const std::string &  text,
const Colorf color = Colorf::white 
)

Print text on gc adding ellipses if it does not fit.

Multiline text (seperated by /n) is supported

Parameters
canvas= Canvas
position= Dest position
content_box= Rectangle the text is allowed within
text= The text to draw
color= The text color
void clan::VectorFont::draw_text_ellipsis ( Canvas canvas,
const Pointf position,
Rectf  content_box,
const std::string &  text,
const Colorf color = Colorf::white 
)

Print text on gc adding ellipses if it does not fit.

Multiline text (seperated by /n) is supported

Parameters
canvas= Canvas
position= Dest position
content_box= Rectangle the text is allowed within
text= The text to draw
color= The text color
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::FontMetrics::get_average_character_width ( ) const

Returns the average width of characters in the font.

The average width is generally defined as the width of the letter x. The value does not include the overhang required for bold or italic characters.

int clan::FontDescription::get_average_width ( ) const

Returns the font average width.

Rectf clan::VectorFont::get_bounding_box ( const std::string &  reference_string) const

Get the largest bounding box for each glyph for this font in a given reference string.

int clan::Font::get_character_index ( Canvas canvas,
const std::string &  text,
const Point point 
)

Get the character index at a specified point.

Multiline text (seperated by /n) is supported

Parameters
canvas= Canvas
text= The string
point= The point
Returns
The character index. -1 = Not at specified point
Charset clan::FontDescription::get_charset ( ) const

Get the font charset

std::string::value_type clan::FontMetrics::get_default_char ( ) const

Returns the value of the character to be substituted for characters not in the font.

float clan::FontMetrics::get_descent ( ) const

Returns the font descender.

float clan::FontMetrics::get_digitized_aspect_x ( ) const

Returns the horizontal aspect of the device for which the font was designed.

float clan::FontMetrics::get_digitized_aspect_y ( ) const

Returns the vertical aspect of the device for which the font was designed.

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 the application adds between rows.

std::string::value_type clan::FontMetrics::get_first_char ( ) const

Returns the value of the first character defined in the font.

bool clan::FontDescription::get_fixed_pitch ( ) const

Returns the font fixed pitch setting.

FontMetrics clan::VectorFont::get_font_metrics ( )

Retrieves font metrics description for the selected font.

FontMetrics clan::Font::get_font_metrics ( )

Retrieves font metrics description for the selected font.

const std::vector<Vec2f>& clan::VectorFont::get_glyph_filled ( unsigned int  glyph)
const std::vector< std::vector<Vec2f> >& clan::VectorFont::get_glyph_outline ( unsigned int  glyph)
Size clan::VectorFont::get_glyph_size ( Canvas canvas,
unsigned int  glyph 
)

Gets the size of a specified glyph.

The size is the increment value to the next glyph

Parameters
glyph= The glyph to get
Returns
The size
Size clan::Font::get_glyph_size ( Canvas canvas,
unsigned int  glyph 
)

Gets the size of a specified glyph.

The size is the increment value to the next glyph

Parameters
glyph= The glyph to get
Returns
The size
float clan::FontMetrics::get_height ( ) const

Returns the height of the font.

int 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.

bool clan::FontDescription::get_italic ( ) const

Returns the font italic setting.

std::string::value_type clan::FontMetrics::get_last_char ( ) const

Returns the value of the last character defined in the font.

float clan::FontMetrics::get_max_character_width ( ) const

Returns the width of the widest character in the font.

float clan::FontDescription::get_orientation ( ) const

Returns the font orientation.

float clan::FontMetrics::get_overhang ( ) const

Returns the extra width per string that may be added to some synthesized fonts.

bool clan::FontDescription::get_strikeout ( ) const

Returns the font strikeout setting.

bool clan::FontDescription::get_subpixel ( ) const

Get the font subpixel rendering setting (defaults to true)

Size clan::VectorFont::get_text_size ( Canvas canvas,
const std::string &  text 
)

Calculate size of text string.

Multiline text (seperated by /n) is supported

Note: The height also includes whitespace (to give the maximum font height), so "." and "X" returns the same height.
The width is the pixel width

The size is the increment value to the next glyph

Size clan::Font::get_text_size ( Canvas canvas,
const std::string &  text 
)

Calculate size of text string.

Multiline text (seperated by /n) is supported

Note: The height also includes whitespace (to give the maximum font height), so "." and "X" returns the same height.
The width is the pixel width

The size is the increment value to the next glyph

const std::string& clan::FontDescription::get_typeface_name ( ) const

Returns the typeface name.

bool clan::FontDescription::get_underline ( ) const

Returns the font underline setting.

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.

float clan::FontMetrics::get_weight ( ) const

Returns the weight of the font.

int clan::FontDescription::get_weight ( ) const

Returns the font weight.

std::string::value_type clan::FontMetrics::get_word_break_char ( ) const

Returns the value of the character that will be used to define word breaks for text justification.

bool clan::FontMetrics::is_fixed_pitch ( ) const

Returns true if the font is a mono space font.

bool clan::FontMetrics::is_italic ( ) const

Returns true if the font is italic.

bool clan::VectorFont::is_null ( ) const

Is Null.

Returns
true = null
bool clan::FontDescription::is_null ( ) const
inline

Returns true if this object is invalid.

bool clan::Font::is_null ( ) const

Is Null.

Returns
true = null
bool clan::FontMetrics::is_struck_out ( ) const

Returns true if the font is struck out.

bool clan::FontMetrics::is_underlined ( ) const

Returns true if the font is underlined.

FontDescription& clan::FontDescription::operator= ( const FontDescription copy)

Copy assignment operator.

bool clan::FontDescription::operator== ( const FontDescription other) const

Returns true if the font is identical.

void clan::VectorFont::reset_texture ( )

Reset the texture.

static Resource<Font> clan::Font::resource ( Canvas canvas,
const FontDescription desc,
const ResourceManager resources 
)
static

Retrieves a Font resource from the resource manager.

Parameters
canvas= Canvas
resources= Resource manager
id= id
void clan::FontDescription::set_anti_alias ( bool  setting = true)

Sets the font anti-alias setting (defaults to true)

void clan::FontMetrics::set_ascent ( float  value)

Set the font ascender.

Parameters
value= The ascent
void clan::FontMetrics::set_average_character_width ( float  value)

Set the average width of characters in the font.

Parameters
value= The average_character_width
void clan::FontDescription::set_average_width ( int  value)

Sets the font average width.

void clan::FontDescription::set_charset ( Charset  new_charset)

Sets the font charset (defaults to charset_default)

Parameters
new_charset= The charset. charset_default = Use operating systems default
void clan::FontMetrics::set_descent ( float  value)

Set the font descender.

Parameters
value= The descent
void clan::FontMetrics::set_digitized_aspect_x ( float  value)

Set the horizontal aspect of the device for which the font was designed.

Parameters
value= The digitized_aspect_x
void clan::FontMetrics::set_digitized_aspect_y ( float  value)

Set the vertical aspect of the device for which the font was designed.

Parameters
value= The digitized_aspect_y
void clan::FontDescription::set_escapement ( float  value)

Sets the font escapement.

void clan::FontMetrics::set_external_leading ( float  value)

Set the amount of extra leading (space) that the application adds between rows.

Parameters
value= The external_leading
void clan::VectorFont::set_filled ( bool  enable = true)

Set to draw filled (default)

void clan::FontDescription::set_fixed_pitch ( bool  setting = true)

Sets the font fixed pitch setting.

void clan::FontMetrics::set_fixed_pitch ( bool  value)

Set if the font is a mono space font.

Parameters
value= true if fixed_pitch
void clan::FontMetrics::set_height ( float  value)

Set the height of the font.

Parameters
value= The height
void clan::FontDescription::set_height ( int  value)

Sets the font height.

void clan::FontMetrics::set_internal_leading ( float  value)

Set the amount of leading (space) inside the bounds set by the set_height() function.

Parameters
value= The internal_leading
void clan::FontDescription::set_italic ( bool  setting = true)

Sets the font italic setting.

void clan::FontMetrics::set_italic ( bool  value)

Set if the font is italic.

Parameters
value= true if italic
void clan::FontMetrics::set_max_character_width ( float  value)

Set the width of the widest character in the font.

Parameters
value= The max_character_width
void clan::FontDescription::set_orientation ( float  value)

Sets the font orientation.

void clan::FontMetrics::set_overhang ( float  value)

Set the extra width per string that may be added to some synthesized fonts.

Parameters
value= The overhang
void clan::FontDescription::set_strikeout ( bool  setting = true)

Sets the font strikeout setting.

void clan::FontMetrics::set_struck_out ( bool  value)

Set if the font is struck out.

Parameters
value= true if struck_out
void clan::FontDescription::set_subpixel ( bool  setting = true)

Sets the font subpixel rendering setting (defaults to true)

void clan::VectorFont::set_texture ( const Texture2D src_texture,
const Rectf bounding_rect,
const Rectf texture_rect = Rectf(0.0f, 0.0f, 1.0f, 1.0f) 
)

Set the texture.

Parameters
src_texture= The texture to use.
bounding_rect= The bounding rect of the glyph. Use get_bounding_box() to calculate this
texture_rect= The texture rect
void clan::VectorFont::set_texture ( const Texture2D src_texture,
const Rectf bounding_rect,
const Rect texture_rect 
)
void clan::FontDescription::set_typeface_name ( const std::string &  name)

Sets the typeface name.

void clan::FontDescription::set_underline ( bool  setting = true)

Sets the font underline setting.

void clan::FontMetrics::set_underlined ( bool  value)

Set if the font is underlined.

Parameters
value= true if underlined
void clan::FontDescription::set_weight ( int  value)

Sets the font weight.

void clan::FontMetrics::set_weight ( float  value)

Set the weight of the font.

Parameters
value= The weight
void clan::FontDescription::throw_if_null ( ) const

Throw an exception if this object is invalid.

Variable Documentation

std::shared_ptr<VectorFont_Impl> clan::VectorFont::impl