30 #include "CEGUI/Base.h"
31 #include "CEGUI/PropertySet.h"
32 #include "CEGUI/EventSet.h"
33 #include "CEGUI/String.h"
34 #include "CEGUI/XMLSerializer.h"
35 #include "CEGUI/FontGlyph.h"
40 # pragma warning(push)
41 # pragma warning(disable : 4251)
100 {
return (d_cp_map.find(cp) != d_cp_map.end()); }
143 const ColourRect& colours,
const float space_extra = 0.0f,
144 const float x_scale = 1.0f,
const float y_scale = 1.0f)
const;
207 {
return d_height * y_scale; }
222 {
return (d_ascender - d_descender) * y_scale; }
237 {
return d_ascender * y_scale; }
326 float x_scale = 1.0f)
const
327 {
return getCharAtPixel(text, 0, pixel, x_scale); }
358 float x_scale = 1.0f)
const;
371 { d_defaultResourceGroup = resourceGroup; }
382 {
return d_defaultResourceGroup; }
414 const Sizef& native_res);
430 virtual void rasterise(utf32 start_codepoint, utf32 end_codepoint)
const;
500 typedef std::map<utf32, FontGlyph, std::less<utf32>
510 #if defined(_MSC_VER)
511 # pragma warning(pop)
Definition: MemoryAllocatedObject.h:110
Class that holds details of colours for the four corners of a rectangle.
Definition: ColourRect.h:45
Interface providing event signaling and handling.
Definition: EventSet.h:167
EventArgs based class that is used for notifications regarding Font objects.
Definition: InputEvent.h:381
internal class representing a single font glyph.
Definition: FontGlyph.h:44
Class that encapsulates a typeface.
Definition: Font.h:62
static const String EventNamespace
Event namespace for font events.
Definition: Font.h:68
float drawText(GeometryBuffer &buffer, const String &text, const Vector2f &position, const Rectf *clip_rect, const ColourRect &colours, const float space_extra=0.0f, const float x_scale=1.0f, const float y_scale=1.0f) const
Draw text into a specified area of the display.
float getTextAdvance(const String &text, float x_scale=1.0f) const
Return pixel advance of the specified text when rendered with this Font.
virtual const FontGlyph * findFontGlyph(const utf32 codepoint) const
finds FontGlyph in map and returns it, or 0 if none.
const String & getFileName() const
Return the filename of the used font.
virtual void onRenderSizeChanged(FontEventArgs &args)
event trigger function for when the font rendering size changes.
float d_vertScaling
current vertical scaling factor.
Definition: Font.h:479
static const argb_t DefaultColour
Colour value used whenever a colour is not specified.
Definition: Font.h:65
AutoScaledMode d_autoScaled
which mode should we use for auto-scaling
Definition: Font.h:473
AutoScaledMode getAutoScaled() const
Checks whether this font is being auto-scaled and how.
std::map< utf32, FontGlyph, std::less< utf32 > CEGUI_MAP_ALLOC(utf32, FontGlyph)> CodepointMap
Definition of CodepointMap type.
Definition: Font.h:501
void setMaxCodepoint(utf32 codepoint)
Set the maximal glyph index. This reserves the respective number of bits in the d_glyphPageLoaded arr...
String d_type
Type name string for this font (not used internally)
Definition: Font.h:457
float d_horzScaling
current horizontal scaling factor.
Definition: Font.h:477
CodepointMap d_cp_map
Contains mappings from code points to Image objects.
Definition: Font.h:503
void setAutoScaled(const AutoScaledMode auto_scaled)
Enable or disable auto-scaling for this Font.
float getTextExtent(const String &text, float x_scale=1.0f) const
Return the pixel width of the specified text if rendered with this Font.
virtual void notifyDisplaySizeChanged(const Sizef &size)
Notify the Font that the display size may have changed.
virtual ~Font()
Destructor.
static const String EventRenderSizeChanged
Definition: Font.h:74
Sizef d_nativeResolution
native resolution for this Font.
Definition: Font.h:475
const String & getName() const
Return the string holding the font name.
const Sizef & getNativeResolution() const
Return the native display size for this Font. This is only relevant if the Font is being auto-scaled.
void writeXMLToStream(XMLSerializer &xml_stream) const
Writes an xml representation of this Font to out_stream.
float getFontHeight(float y_scale=1.0f) const
return the exact pixel height of the font.
Definition: Font.h:221
virtual void writeXMLToStream_impl(XMLSerializer &xml_stream) const =0
implementaion version of writeXMLToStream.
const FontGlyph * getGlyphData(utf32 codepoint) const
Return a pointer to the glyphDat struct for the given codepoint, or 0 if the codepoint does not have ...
String d_resourceGroup
Name of the font file's resource group.
Definition: Font.h:461
static String d_defaultResourceGroup
Holds default resource group for font loading.
Definition: Font.h:463
float getLineSpacing(float y_scale=1.0f) const
Return the pixel line spacing value for.
Definition: Font.h:206
void setNativeResolution(const Sizef &size)
Set the native resolution for this Font.
static const String & getDefaultResourceGroup()
Returns the default resource group currently set for Fonts.
Definition: Font.h:381
Font(const String &name, const String &type_name, const String &filename, const String &resource_group, const AutoScaledMode auto_scaled, const Sizef &native_res)
Constructor.
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...
float d_descender
maximal font descender (negative pixels below the baseline)
Definition: Font.h:468
String d_name
Name of this font.
Definition: Font.h:455
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 pixe...
Definition: Font.h:325
float d_height
(ascender - descender) + linegap
Definition: Font.h:470
const String & getTypeName() const
Return the type of the font.
uint * d_glyphPageLoaded
This bitmap holds information about loaded 'pages' of glyphs. A glyph page is a set of 256 codepoints...
Definition: Font.h:497
virtual void updateFont()=0
Update the font as needed, according to the current parameters.
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 re...
float getBaseline(float y_scale=1.0f) const
Return the number of pixels from the top of the highest glyph to the baseline.
Definition: Font.h:236
String d_filename
Name of the file used to create this font (font file or imagset)
Definition: Font.h:459
static void setDefaultResourceGroup(const String &resourceGroup)
Sets the default resource group to be used when loading font data.
Definition: Font.h:370
float d_ascender
maximal font ascender (pixels above the baseline)
Definition: Font.h:466
utf32 d_maxCodepoint
Maximal codepoint for font glyphs.
Definition: Font.h:482
void addFontProperties()
Register all properties of this class.
bool isCodepointAvailable(utf32 cp) const
Return whether this Font can draw the specified code-point.
Definition: Font.h:99
Abstract class defining the interface for objects that buffer geometry for later rendering.
Definition: GeometryBuffer.h:44
Interface providing introspection capabilities.
Definition: PropertySet.h:108
String class used within the GUI system.
Definition: String.h:64
Class used to create XML Document.
Definition: XMLSerializer.h:87
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
AutoScaledMode
Definition: Image.h:40
uint32 argb_t
32 bit ARGB representation of a colour.
Definition: Colour.h:38