Crazy Eddie's GUI System
0.8.4
|
Implementation of the Font class interface using the FreeType library. More...
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 AutoScaledMode auto_scaled=ASM_Disabled, const Sizef &native_res=Sizef(640.0f, 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< Texture *CEGUI_VECTOR_ALLOC(Texture *) | TextureVector ) |
Type definition for TextureVector. | |
typedef std::vector < BasicImage *CEGUI_VECTOR_ALLOC(BasicImage *) | ImageVector ) |
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 | initialiseFontGlyph (CodepointMap::iterator cp) const |
initialise FontGlyph for given codepoint. | |
void | initialiseGlyphMap () |
const FontGlyph * | findFontGlyph (const utf32 codepoint) const |
finds FontGlyph in map and returns it, or 0 if none. | |
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. | |
TextureVector | d_glyphTextures |
Textures that hold the glyph imagery for this font. | |
ImageVector | d_glyphImages |
collection of images defined for this font. |
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.
CEGUI::FreeTypeFont::FreeTypeFont | ( | const String & | font_name, |
const float | point_size, | ||
const bool | anti_aliased, | ||
const String & | font_filename, | ||
const String & | resource_group = "" , |
||
const AutoScaledMode | auto_scaled = ASM_Disabled , |
||
const Sizef & | native_res = Sizef(640.0f, 480.0f) , |
||
const float | specific_line_spacing = 0.0f |
||
) |
Constructor for FreeTypeFont based fonts.
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. |
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).
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). |
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.
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.
start_codepoint | The lowest codepoint that should be rasterised |
end_codepoint | The highest codepoint that should be rasterised |
Reimplemented from CEGUI::Font.