CL_Font::get_height - ClanLib Game SDK

Home | All Classes | Grouped Classes | Index | Search

# CL_Font::get_height

Returns the drawn height of the entire font or a string.

    	int get_height();

    	int get_height(
    		const std::string& str, CL_Size max_size = CL_Size(0, 0));

    	int get_height(
    		std::string::const_iterator start, std::string::const_iterator end, CL_Size max_size = CL_Size(0, 0));

Parameters:

str
  String to get the height of.
start
  A starting iterator, inclusive.
end
  An ending iterator, exclusive.
max_size
  Same effect as the size of the dest rectangle passed to draw(), for word wrapping and height truncating.

Return value:

The height in pixels.

Detailed description:

The height of the entire font is the height of the tallest glyph in the font; this is what is returned if you specify no arguments. The point of having the height functions accept a string is to compensate for strings spanning multiple lines. Generally, get_height(" ") will return zero, since usually the space glyph isn't given in the font, and so it has a height and width of zero.

See also:

CL_Size | CL_Font

Questions or comments, write to the ClanLib mailing list.