Crazy Eddies GUI System  0.7.7
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CEGUI::PixmapFont Class Reference

Implementation of the Font class interface using static Imageset's. More...

+ Inheritance diagram for CEGUI::PixmapFont:
+ Collaboration diagram for CEGUI::PixmapFont:

Public Member Functions

 PixmapFont (const String &font_name, const String &imageset_filename, const String &resource_group="", const bool auto_scaled=false, const float native_horz_res=640.0f, const float native_vert_res=480.0f)
 Constructor for Pixmap type fonts. More...
 ~PixmapFont ()
void defineMapping (const utf32 codepoint, const String &image_name, const float horz_advance)
const StringgetImageset () const
 Return the name of the imageset the font is using for it's glyphs.
void setImageset (const String &imageset)
 Set Imageset the font is using for it's glyphs. More...
- Public Member Functions inherited from CEGUI::Font
virtual ~Font ()
const StringgetName () const
 Return the string holding the font name.
const StringgetTypeName () const
 Return the type of the font.
bool isCodepointAvailable (utf32 cp) const
 Return whether this Font can draw the specified code-point. More...
void drawText (GeometryBuffer &buffer, const String &text, const Vector2 &position, const Rect *clip_rect, const ColourRect &colours, const float space_extra=0.0f, const float x_scale=1.0f, const float y_scale=1.0f)
 Draw text into a specified area of the display. More...
void setNativeResolution (const Size &size)
 Set the native resolution for this Font. More...
Size getNativeResolution () const
 Return the native display size for this Font. This is only relevant if the Font is being auto-scaled. More...
void setAutoScaled (const bool auto_scaled)
 Enable or disable auto-scaling for this Font. More...
bool isAutoScaled () const
 Return whether this Font is auto-scaled. More...
virtual void notifyDisplaySizeChanged (const Size &size)
 Notify the Font that the display size may have changed. More...
float getLineSpacing (float y_scale=1.0f) const
 Return the pixel line spacing value for. More...
float getFontHeight (float y_scale=1.0f) const
 return the exact pixel height of the font. More...
float getBaseline (float y_scale=1.0f) const
 Return the number of pixels from the top of the highest glyph to the baseline. More...
float getTextExtent (const String &text, float x_scale=1.0f) const
 Return the pixel width of the specified text if rendered with this Font. More...
size_t getCharAtPixel (const String &text, float pixel, float x_scale=1.0f) const
 Return the index of the closest text character in String text that corresponds to pixel location pixel if the text were rendered. More...
size_t getCharAtPixel (const String &text, size_t start_char, float pixel, float x_scale=1.0f) const
 Return the index of the closest text character in String text, starting at character index start_char, that corresponds to pixel location pixel if the text were to be rendered. More...
void writeXMLToStream (XMLSerializer &xml_stream) const
 Writes an xml representation of this Font to out_stream. More...
const FontGlyphgetGlyphData (utf32 codepoint) const
 Return a pointer to the glyphDat struct for the given codepoint, or 0 if the codepoint does not have a glyph defined. More...
- Public Member Functions inherited from CEGUI::PropertySet
 PropertySet (void)
 Constructs a new PropertySet object.
virtual ~PropertySet (void)
 Destructor for PropertySet objects.
void addProperty (Property *property)
 Adds a new Property to the PropertySet. More...
void removeProperty (const String &name)
 Removes a Property from the PropertySet. More...
void clearProperties (void)
 Removes all Property objects from the PropertySet. More...
bool isPropertyPresent (const String &name) const
 Checks to see if a Property with the given name is in the PropertySet. More...
const StringgetPropertyHelp (const String &name) const
 Return the help text for the specified Property. More...
String getProperty (const String &name) const
 Gets the current value of the specified Property. More...
void setProperty (const String &name, const String &value)
 Sets the current value of a Property. More...
bool isPropertyDefault (const String &name) const
 Returns whether a Property is at it's default value. More...
String getPropertyDefault (const String &name) const
 Returns the default value of a Property as a String. More...
Iterator getIterator (void) const
 Return a PropertySet::Iterator object to iterate over the available Properties.

Protected Member Functions

void reinit ()
 Initialize the imageset.
void addPixmapFontProperties ()
 Register all properties of this class.
void updateFont ()
 Update the font as needed, according to the current parameters.
void writeXMLToStream_impl (XMLSerializer &xml_stream) const
 implementaion version of writeXMLToStream.
- Protected Member Functions inherited from CEGUI::Font
 Font (const String &name, const String &type_name, const String &filename, const String &resource_group, const bool auto_scaled, const float native_horz_res, const float native_vert_res)
virtual 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. More...
void addFontProperties ()
 Register all properties of this class.
void setMaxCodepoint (utf32 codepoint)
 Set the maximal glyph index. This reserves the respective number of bits in the d_glyphPageLoaded array.

Protected Attributes

 The imageset with the glyphs.
float d_origHorzScaling
 Current X scaling for glyph images.
bool d_imagesetOwner
 true if we own the imageset
- Protected Attributes inherited from CEGUI::Font
String d_name
 Name of this font.
String d_type
 Type name string for this font (not used internally)
String d_filename
 Name of the file used to create this font (font file or imagset)
String d_resourceGroup
 Name of the font file's resource group.
float d_ascender
 maximal font ascender (pixels above the baseline)
float d_descender
 maximal font descender (negative pixels below the baseline)
float d_height
 (ascender - descender) + linegap
bool d_autoScale
 true when auto-scaling is enabled.
float d_nativeHorzRes
 native horizontal resolution for this Imageset.
float d_nativeVertRes
 native vertical resolution for this Imageset.
float d_horzScaling
 current horizontal scaling factor.
float d_vertScaling
 current vertical scaling factor.
utf32 d_maxCodepoint
 Maximal codepoint for font glyphs.
uint * d_glyphPageLoaded
 This bitmap holds information about loaded 'pages' of glyphs. A glyph page is a set of 256 codepoints, starting at 256-multiples. For example, the 1st glyph page is 0-255, fourth is 1024-1279 etc. When a specific glyph is required for painting, the corresponding bit is checked to see if the respective page has been rasterised. If not, the rasterise() method is invoked, which prepares the glyphs from the respective glyph page for being painted. More...
CodepointMap d_cp_map
 Contains mappings from code points to Image objects.

Additional Inherited Members

- Public Types inherited from CEGUI::PropertySet
typedef ConstBaseIterator
< PropertyRegistry > 
- Static Public Member Functions inherited from CEGUI::Font
static void setDefaultResourceGroup (const String &resourceGroup)
 Sets the default resource group to be used when loading font data. More...
static const StringgetDefaultResourceGroup ()
 Returns the default resource group currently set for Fonts. More...
- Static Public Attributes inherited from CEGUI::Font
static const argb_t DefaultColour
 Colour value used whenever a colour is not specified.
- Protected Types inherited from CEGUI::Font
typedef std::map< utf32,
 Definition of CodepointMap type.
- Static Protected Attributes inherited from CEGUI::Font
static String d_defaultResourceGroup
 Holds default resource group for font loading.

Detailed Description

Implementation of the Font class interface using static Imageset's.

To create such a font you must create a Imageset with all the glyphs, and then define individual glyphs via defineMapping.

Constructor & Destructor Documentation

CEGUI::PixmapFont::PixmapFont ( const String font_name,
const String imageset_filename,
const String resource_group = "",
const bool  auto_scaled = false,
const float  native_horz_res = 640.0f,
const float  native_vert_res = 480.0f 

Constructor for Pixmap type fonts.

font_nameThe name that the font will use within the CEGUI system.
imageset_filenameThe filename of an imageset to load that will be used as the source for glyph images for this font. If resource_group is the special value of "*", this parameter may instead refer to the name of an already loaded Imagset.
resource_groupThe resource group identifier to use when loading the imageset file specified by imageset_filename. If this group is set to the special value of "*", then imageset_filename instead will refer to the name of an existing Imageset.
auto_scaledSpecifies 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_resThe horizontal native resolution value. This is only significant when auto scaling is enabled.
native_vert_resThe vertical native resolution value. This is only significant when auto scaling is enabled.

Member Function Documentation

void CEGUI::PixmapFont::setImageset ( const String imageset)

Set Imageset the font is using for it's glyphs.

This will potentially cause an existing imageset to be unloaded (if it
was created specifically by, and for, this Font).  The new Imageset
must already exist within the system.
imagesetName ofan existing image set to be used as the glyph source for this Font.
UnknownObjectExceptionthrown if imageset is not known in the system.