Home | All Classes | Grouped Classes | Index | Search

# CL_Font::get_width

Returns the drawn width of a character or string.

    	int get_width(
    		unsigned int letter);

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

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

Parameters:

letter
  Character to get the width of.
str
  String to get the width 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 width in pixels.

See also:

CL_Font | CL_Size

Questions or comments, write to the ClanLib mailing list.