Crazy Eddies GUI System: CEGUI::FreeTypeFont Class Reference

Crazy Eddies GUI System 0.7.6

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
CEGUI::FreeTypeFont Class Reference

Implementation of the Font class interface using the FreeType library. More...

Inheritance diagram for CEGUI::FreeTypeFont:
[legend]
Collaboration diagram for CEGUI::FreeTypeFont:
[legend]

List of all members.

## Public Member Functions
| FreeTypeFont (const String &font_name, const float point_size, const bool anti_aliased, const String &font_filename, const String &resource_group="", const bool auto_scaled=false, const float native_horz_res=640.0f, const float native_vert_res=480.0f, const float specific_line_spacing=0.0f)
| Constructor for FreeTypeFont based fonts.
| ~FreeTypeFont ()
| Destructor.
float | getPointSize () const
| return the point size of the freetype font.
bool | isAntiAliased () const
| return whether the freetype font is rendered anti-aliased.
void | setPointSize (const float point_size)
| return the point size of the freetype font.
void | setAntiAliased (const bool anti_alaised)
| return whether the freetype font is rendered anti-aliased.
## Protected Types
typedef std::vector< Imageset * > | ImagesetVector
| Type definition for ImagesetVector.
## Protected Member Functions
void | drawGlyphToBuffer (argb_t *buffer, uint buf_width) const
| Copy the current glyph data into buffer, which has a width of buf_width pixels (not bytes).
uint | getTextureSize (CodepointMap::const_iterator s, CodepointMap::const_iterator e) const
| Return the required texture size required to store imagery for the glyphs from s to e.
void | addFreeTypeFontProperties ()
| Register all properties of this class.
void | free ()
| Free all allocated font data.
void | rasterise (utf32 start_codepoint, utf32 end_codepoint) const
| This function prepares a certain range of glyphs to be ready for displaying. This means that after returning from this function glyphs from d_cp_map[start_codepoint] to d_cp_map[end_codepoint] should have their d_image member set. If there is an error during rasterisation of some glyph, it's okay to leave the d_image field set to NULL, in which case such glyphs will be skipped from display.
void | updateFont ()
| Update the font as needed, according to the current parameters.
void | writeXMLToStream_impl (XMLSerializer &xml_stream) const
| implementaion version of writeXMLToStream.
## Protected Attributes
float | d_specificLineSpacing
| If non-zero, the overridden line spacing that we're to report.
float | d_ptSize
| Point size of font.
bool | d_antiAliased
| True if the font should be rendered as anti-alaised by freeType.
FT_Face | d_fontFace
| FreeType-specific font handle.
RawDataContainer | d_fontData
| Font file data.
ImagesetVector | d_glyphImages
| Imagesets that holds the glyphs for this font.

## Detailed Description

Implementation of the Font class interface using the FreeType library.

This implementation tries to provide maximal support for any kind of fonts supported by FreeType. It has been tested on outline font formats like TTF and PS as well as on bitmap font formats like PCF and FON.

Glyphs are rendered dynamically on demand, so a large font with lots of glyphs won't slow application startup time.

## Constructor & Destructor Documentation

CEGUI::FreeTypeFont::FreeTypeFont | ( | const String & | font_name,
|  | const float | point_size,
|  | const bool | anti_aliased,
|  | const String & | font_filename,
|  | const String & | resource_group = `""`,
|  | const bool | auto_scaled = `false`,
|  | const float | native_horz_res = `640.0f`,
|  | const float | native_vert_res = `480.0f`,
|  | const float | specific_line_spacing = `0.0f`
| ) |  |

Constructor for FreeTypeFont based fonts.

Parameters:

  font_name | The name that the font will use within the CEGUI system.
  point_size | Specifies the point size that the font is to be rendered at.
  anti_aliased | Specifies whether the font should be rendered using anti aliasing.
  font_filename | The filename of an font file that will be used as the source for glyph images for this font.
  resource_group | The resource group identifier to use when loading the font file specified by font_filename.
  auto_scaled | Specifies whether the font imagery should be automatically scaled to maintain the same physical size (which is calculated by using the native resolution setting).
  native_horz_res | The horizontal native resolution value. This is only significant when auto scaling is enabled.
  native_vert_res | The vertical native resolution value. This is only significant when auto scaling is enabled.
  specific_line_spacing | If specified (non-zero), this will be the line spacing that we will report for this font, regardless of what is mentioned in the font file itself.

## Member Function Documentation

void CEGUI::FreeTypeFont::drawGlyphToBuffer | ( | argb_t * | buffer,
|  | uint | buf_width
| ) |  | const`[protected]`

Copy the current glyph data into buffer, which has a width of buf_width pixels (not bytes).

Parameters:

  buffer | Memory buffer large enough to receive the imagery for the currently loaded glyph.
  buf_width | Width of buffer in pixels (where each pixel is a argb_t).

Returns:
  Nothing.

uint CEGUI::FreeTypeFont::getTextureSize | ( | CodepointMap::const_iterator | s,
|  | CodepointMap::const_iterator | e
| ) |  | const`[protected]`

Return the required texture size required to store imagery for the glyphs from s to e.

Parameters:

  s | The first glyph in set
  e | The last glyph in set

void CEGUI::FreeTypeFont::rasterise | ( | utf32 | start_codepoint,
|  | utf32 | end_codepoint
| ) |  | const`[protected, virtual]`

This function prepares a certain range of glyphs to be ready for displaying. This means that after returning from this function glyphs from d_cp_map[start_codepoint] to d_cp_map[end_codepoint] should have their d_image member set. If there is an error during rasterisation of some glyph, it's okay to leave the d_image field set to NULL, in which case such glyphs will be skipped from display.

Parameters:

  start_codepoint | The lowest codepoint that should be rasterised
  end_codepoint | The highest codepoint that should be rasterised

Reimplemented from CEGUI::Font.