Home | All Classes | Grouped Classes | Index | Search

# CL_Font::CL_Font

Constructs a font.

    	CL_Font();

    	CL_Font(
    		const CL_Font& copy);

    	CL_Font(
    		const std::string& resource_id, CL_ResourceManager* manager);

    	CL_Font(
    		const CL_Sprite& glyphs, const std::string& letters, int spacelen = -1, bool monospace = false);

    	CL_Font(
    		const std::string& font_name, const std::string& letters, int height, int width = 0, bool bold = false, bool italic = false, bool underline = false, bool strikeout = false);

    	CL_Font(
    		const std::string& font_name, int height, int width = 0, bool bold = false, bool italic = false, bool underline = false, bool strikeout = false);

Parameters:

resource_id
  Font resource name.
manager
  Resource manager used to load font.
glyphs
  CL_Sprite containing the letters of a bitmap font.
letters
  String mapping each frame of the bitmap font sprite to letters.
spacelen
  Width in pixels of the space glyph. If -1, uses the average of all glyph widths.
monospace
  If true, treats all glyphs as being the same width.
font_name
  System font name (eg. "Arial").
letter_chars
  The characters to include in the font (if a sprite font, must be in frame order).
height
  Height of font in pixels.
width
  Width of font in pixels. If 0, uses best fitting width for the specified height.
bold
  If true, will use bold font.
italic
  If true, will use italic font.
underline
  If true, will use underlined font.
strikeout
  If true, will use striked out font.

Detailed description:

If spacelen is unspecified, CL_Font attempts to resolve it itself. First, it looks to see if you have specified a space character in letter_chars: if you have, it uses that glyph's width as the space width (as well as using it to actually draw the space). If it does not find a space glyph, then it will look at every glyph's width and make the space width the average of that.

See also:

CL_Font | CL_Resource | CL_ResourceManager | CL_Sprite

Questions or comments, write to the ClanLib mailing list.