#include <OgreFont.h>
Inheritance diagram for Ogre::Font:
Public Types | |
typedef Ogre::uint32 | CodePoint |
typedef Ogre::FloatRect | UVRect |
typedef std::pair< CodePoint, CodePoint > | CodePointRange |
A range of code points, inclusive on both ends. | |
typedef std::vector< CodePointRange > | CodePointRangeList |
enum | LoadingState { LOADSTATE_UNLOADED, LOADSTATE_LOADING, LOADSTATE_LOADED, LOADSTATE_UNLOADING } |
Enum identifying the loading state of the resource. More... | |
Public Member Functions | |
Font (ResourceManager *creator, const String &name, ResourceHandle handle, const String &group, bool isManual=false, ManualResourceLoader *loader=0) | |
Constructor. | |
virtual | ~Font () |
void | setType (FontType ftype) |
Sets the type of font. | |
FontType | getType (void) const |
Gets the type of font. | |
void | setSource (const String &source) |
Sets the source of the font. | |
const String & | getSource (void) const |
Gets the source this font (either an image or a truetype font). | |
void | setTrueTypeSize (Real ttfSize) |
Sets the size of a truetype font (only required for FT_TRUETYPE). | |
void | setTrueTypeResolution (uint ttfResolution) |
Gets the resolution (dpi) of the font used to generate the texture (only required for FT_TRUETYPE). | |
Real | getTrueTypeSize (void) const |
Gets the point size of the font used to generate the texture. | |
uint | getTrueTypeResolution (void) const |
Gets the resolution (dpi) of the font used to generate the texture. | |
const UVRect & | getGlyphTexCoords (CodePoint id) const |
Returns the teture coordinates of the associated glyph. | |
void | setGlyphTexCoords (CodePoint id, Real u1, Real v1, Real u2, Real v2, Real textureAspect) |
Sets the texture coordinates of a glyph. | |
Real | getGlyphAspectRatio (CodePoint id) const |
Gets the aspect ratio (width / height) of this character. | |
void | setGlyphAspectRatio (CodePoint id, Real ratio) |
Sets the aspect ratio (width / height) of this character. | |
const GlyphInfo & | getGlyphInfo (CodePoint id) const |
Gets the information available for a glyph corresponding to a given code point, or throws an exception if it doesn't exist;. | |
void | addCodePointRange (const CodePointRange &range) |
Adds a range of code points to the list of code point ranges to generate glyphs for, if this is a truetype based font. | |
void | clearCodePointRanges () |
Clear the list of code point ranges. | |
const CodePointRangeList & | getCodePointRangeList () const |
Get a const reference to the list of code point ranges to be used to generate glyphs from a truetype font. | |
const MaterialPtr & | getMaterial () const |
Gets the material generated for this font, as a weak reference. | |
const MaterialPtr & | getMaterial () |
Gets the material generated for this font, as a weak reference. | |
void | setAntialiasColour (bool enabled) |
Sets whether or not the colour of this font is antialiased as it is generated from a true type font. | |
bool | getAntialiasColour (void) const |
Gets whether or not the colour of this font is antialiased as it is generated from a true type font. | |
void | loadResource (Resource *resource) |
Implementation of ManualResourceLoader::loadResource, called when the Texture that this font creates needs to (re)load. | |
virtual void | load (bool backgroundThread=false) |
Loads the resource, if it is not already. | |
virtual void | reload (void) |
Reloads the resource, if it is already loaded. | |
bool | isReloadable (void) const |
Returns true if the Resource is reloadable, false otherwise. | |
bool | isManuallyLoaded (void) const |
Is this resource manually loaded? | |
virtual void | unload (void) |
Unloads the resource; this is not permanent, the resource can be reloaded later if required. | |
size_t | getSize (void) const |
Retrieves info about the size of the resource. | |
virtual void | touch (void) |
'Touches' the resource to indicate it has been used. | |
const String & | getName (void) const |
Gets resource name. | |
ResourceHandle | getHandle (void) const |
bool | isLoaded (void) const |
Returns true if the Resource has been loaded, false otherwise. | |
LoadingState | isLoading () const |
Returns whether the resource is currently in the process of background loading. | |
LoadingState | getLoadingState () const |
Returns the current loading state. | |
bool | isBackgroundLoaded (void) const |
Returns whether this Resource has been earmarked for background loading. | |
void | setBackgroundLoaded (bool bl) |
Tells the resource whether it is background loaded or not. | |
void | escalateLoading () |
Escalates the loading of a background loaded resource. | |
void | addListener (Listener *lis) |
Register a listener on this resource. | |
void | removeListener (Listener *lis) |
Remove a listener on this resource. | |
const String & | getGroup (void) |
Gets the group which this resource is a member of. | |
void | changeGroupOwnership (const String &newGroup) |
Change the resource group ownership of a Resource. | |
ResourceManager * | getCreator (void) |
Gets the manager which created this resource. | |
const String & | getOrigin (void) const |
Get the origin of this resource, e.g. | |
void | _notifyOrigin (const String &origin) |
Notify this resource of it's origin. | |
ParamDictionary * | getParamDictionary (void) |
Retrieves the parameter dictionary for this class. | |
const ParamDictionary * | getParamDictionary (void) const |
const ParameterList & | getParameters (void) const |
Retrieves a list of parameters valid for this object. | |
virtual bool | setParameter (const String &name, const String &value) |
Generic parameter setting method. | |
virtual void | setParameterList (const NameValuePairList ¶mList) |
Generic multiple parameter setting method. | |
virtual String | getParameter (const String &name) const |
Generic parameter retrieval method. | |
virtual void | copyParametersTo (StringInterface *dest) const |
Method for copying this object's parameters to another object. | |
Static Public Member Functions | |
static void | cleanupDictionary () |
Cleans up the static 'msDictionary' required to reset Ogre, otherwise the containers are left with invalid pointers, which will lead to a crash as soon as one of the ResourceManager implementers (e.g. | |
Protected Types | |
typedef std::map< CodePoint, GlyphInfo > | CodePointMap |
Map from unicode code point to texture coordinates. | |
typedef std::list< Listener * > | ListenerList |
Protected Member Functions | |
void | createTextureFromFont (void) |
Internal method for loading from ttf. | |
virtual void | loadImpl () |
| |
virtual void | unloadImpl () |
| |
size_t | calculateSize (void) const |
| |
virtual void | preLoadImpl (void) |
Internal hook to perform actions before the load process, but after the resource has been marked as 'loading'. | |
virtual void | postLoadImpl (void) |
Internal hook to perform actions after the load process, but before the resource has been marked as fully loaded. | |
virtual void | preUnloadImpl (void) |
Internal hook to perform actions before the unload process. | |
virtual void | postUnloadImpl (void) |
Internal hook to perform actions after the unload process, but before the resource has been marked as fully unloaded. | |
virtual void | queueFireBackgroundLoadingComplete (void) |
Queue the firing of background loading complete event. | |
bool | createParamDictionary (const String &className) |
Internal method for creating a parameter dictionary for the class, if it does not already exist. | |
Protected Attributes | |
FontType | mType |
The type of font. | |
String | mSource |
Source of the font (either an image name or a truetype font). | |
Real | mTtfSize |
Size of the truetype font, in points. | |
uint | mTtfResolution |
Resolution (dpi) of truetype font. | |
CodePointMap | mCodePointMap |
MaterialPtr | mpMaterial |
The material which is generated for this font. | |
TexturePtr | mTexture |
Texture pointer. | |
bool | mAntialiasColour |
for TRUE_TYPE font only | |
CodePointRangeList | mCodePointRangeList |
Range of code points to generate glyphs for (truetype only). | |
ResourceManager * | mCreator |
Creator. | |
String | mName |
Unique name of the resource. | |
String | mGroup |
The name of the resource group. | |
ResourceHandle | mHandle |
Numeric handle for more efficient look up than name. | |
volatile LoadingState | mLoadingState |
Is the resource currently loaded? | |
volatile bool | mIsBackgroundLoaded |
Is this resource going to be background loaded? Only applicable for multithreaded. | |
size_t | mSize |
Mutex to cover the status of loading The size of the resource in bytes. | |
bool | mIsManual |
Is this file manually loaded? | |
String | mOrigin |
Origin of this resource (e.g. script name) - optional. | |
ManualResourceLoader * | mLoader |
Optional manual loader; if provided, data is loaded from here instead of a file. | |
ListenerList | mListenerList |
String | mParamDictName |
Class name for this instance to be used as a lookup (must be initialised by subclasses). | |
Static Protected Attributes | |
static CmdType | msTypeCmd |
static CmdSource | msSourceCmd |
static CmdSize | msSizeCmd |
static CmdResolution | msResolutionCmd |
static CmdCodePoints | msCodePointsCmd |
static ParamDictionaryMap | msDictionary |
Dictionary of parameters. | |
Classes | |
class | CmdCodePoints |
Command object for Font - see ParamCommand. More... | |
class | CmdResolution |
Command object for Font - see ParamCommand. More... | |
class | CmdSize |
Command object for Font - see ParamCommand. More... | |
class | CmdSource |
Command object for Font - see ParamCommand. More... | |
class | CmdType |
Command object for Font - see ParamCommand. More... | |
struct | GlyphInfo |
Information about the position and size of a glyph in a texture. More... |
Definition at line 60 of file OgreFont.h.
|
Definition at line 119 of file OgreFont.h. |
|
Map from unicode code point to texture coordinates.
Definition at line 139 of file OgreFont.h. |
|
A range of code points, inclusive on both ends.
Definition at line 135 of file OgreFont.h. |
|
Definition at line 136 of file OgreFont.h. |
|
Definition at line 131 of file OgreResource.h. |
|
Definition at line 120 of file OgreFont.h. |
|
Enum identifying the loading state of the resource.
Definition at line 96 of file OgreResource.h. |
|
Constructor.
|
|
|
|
Notify this resource of it's origin.
Definition at line 357 of file OgreResource.h. |
|
Adds a range of code points to the list of code point ranges to generate glyphs for, if this is a truetype based font.
Definition at line 312 of file OgreFont.h. |
|
Register a listener on this resource.
Reimplemented in Ogre::UnifiedHighLevelGpuProgram. |
|
Implements Ogre::Resource. Definition at line 162 of file OgreFont.h. |
|
Change the resource group ownership of a Resource.
|
|
Cleans up the static 'msDictionary' required to reset Ogre, otherwise the containers are left with invalid pointers, which will lead to a crash as soon as one of the ResourceManager implementers (e.g. MaterialManager) initializes. |
|
Clear the list of code point ranges.
Definition at line 319 of file OgreFont.h. |
|
Method for copying this object's parameters to another object.
Definition at line 300 of file OgreStringInterface.h. References Ogre::ParamDictionary::mParamDefs. |
|
Internal method for creating a parameter dictionary for the class, if it does not already exist.
Definition at line 176 of file OgreStringInterface.h. |
|
Internal method for loading from ttf.
|
|
Escalates the loading of a background loaded resource.
Reimplemented in Ogre::UnifiedHighLevelGpuProgram. |
|
Gets whether or not the colour of this font is antialiased as it is generated from a true type font.
Definition at line 365 of file OgreFont.h. |
|
Get a const reference to the list of code point ranges to be used to generate glyphs from a truetype font.
Definition at line 326 of file OgreFont.h. |
|
Gets the manager which created this resource.
Definition at line 348 of file OgreResource.h. |
|
Gets the aspect ratio (width / height) of this character.
Definition at line 273 of file OgreFont.h. |
|
Gets the information available for a glyph corresponding to a given code point, or throws an exception if it doesn't exist;.
|
|
Returns the teture coordinates of the associated glyph.
Definition at line 231 of file OgreFont.h. |
|
Gets the group which this resource is a member of.
Reimplemented in Ogre::SkeletonInstance. Definition at line 336 of file OgreResource.h. |
|
Reimplemented in Ogre::SkeletonInstance. Definition at line 262 of file OgreResource.h. |
|
Returns the current loading state.
Reimplemented in Ogre::UnifiedHighLevelGpuProgram. Definition at line 285 of file OgreResource.h. |
|
Gets the material generated for this font, as a weak reference.
Definition at line 342 of file OgreFont.h. |
|
Gets the material generated for this font, as a weak reference.
Definition at line 334 of file OgreFont.h. |
|
Gets resource name.
Reimplemented in Ogre::SkeletonInstance. Definition at line 257 of file OgreResource.h. |
|
Get the origin of this resource, e.g. a script file name.
Definition at line 355 of file OgreResource.h. |
|
Definition at line 213 of file OgreStringInterface.h. |
|
Retrieves the parameter dictionary for this class.
Definition at line 200 of file OgreStringInterface.h. |
|
Generic parameter retrieval method.
Definition at line 269 of file OgreStringInterface.h. References Ogre::ParamCommand::doGet(), and Ogre::ParamDictionary::getParamCommand(). |
|
Retrieves a list of parameters valid for this object.
|
|
Retrieves info about the size of the resource.
Reimplemented in Ogre::UnifiedHighLevelGpuProgram. Definition at line 246 of file OgreResource.h. |
|
Gets the source this font (either an image or a truetype font).
|
|
Gets the resolution (dpi) of the font used to generate the texture.
|
|
Gets the point size of the font used to generate the texture.
|
|
Gets the type of font.
|
|
Returns whether this Resource has been earmarked for background loading.
Reimplemented in Ogre::UnifiedHighLevelGpuProgram. Definition at line 302 of file OgreResource.h. |
|
Returns true if the Resource has been loaded, false otherwise.
Reimplemented in Ogre::UnifiedHighLevelGpuProgram. Definition at line 269 of file OgreResource.h. |
|
Returns whether the resource is currently in the process of background loading.
Reimplemented in Ogre::UnifiedHighLevelGpuProgram. Definition at line 278 of file OgreResource.h. |
|
Is this resource manually loaded?
Definition at line 234 of file OgreResource.h. |
|
Returns true if the Resource is reloadable, false otherwise.
Reimplemented in Ogre::UnifiedHighLevelGpuProgram. Definition at line 227 of file OgreResource.h. |
|
Loads the resource, if it is not already.
Reimplemented in Ogre::UnifiedHighLevelGpuProgram. |
|
Implements Ogre::Resource. |
|
Implementation of ManualResourceLoader::loadResource, called when the Texture that this font creates needs to (re)load.
Implements Ogre::ManualResourceLoader. |
|
Internal hook to perform actions after the load process, but before the resource has been marked as fully loaded.
Reimplemented in Ogre::Mesh. Definition at line 155 of file OgreResource.h. |
|
Internal hook to perform actions after the unload process, but before the resource has been marked as fully unloaded.
Definition at line 165 of file OgreResource.h. |
|
Internal hook to perform actions before the load process, but after the resource has been marked as 'loading'.
Definition at line 148 of file OgreResource.h. |
|
Internal hook to perform actions before the unload process.
Definition at line 160 of file OgreResource.h. |
|
Queue the firing of background loading complete event.
|
|
Reloads the resource, if it is already loaded.
Reimplemented in Ogre::UnifiedHighLevelGpuProgram. |
|
Remove a listener on this resource.
Reimplemented in Ogre::UnifiedHighLevelGpuProgram. |
|
Sets whether or not the colour of this font is antialiased as it is generated from a true type font.
Definition at line 357 of file OgreFont.h. |
|
Tells the resource whether it is background loaded or not.
Reimplemented in Ogre::UnifiedHighLevelGpuProgram. Definition at line 312 of file OgreResource.h. |
|
Sets the aspect ratio (width / height) of this character.
Definition at line 290 of file OgreFont.h. |
|
Sets the texture coordinates of a glyph.
Definition at line 252 of file OgreFont.h. References Ogre::TRect< T >::bottom, Ogre::TRect< T >::left, Ogre::TRect< T >::right, and Ogre::TRect< T >::top. |
|
Generic parameter setting method.
|
|
Generic multiple parameter setting method.
|
|
Sets the source of the font.
|
|
Gets the resolution (dpi) of the font used to generate the texture (only required for FT_TRUETYPE).
|
|
Sets the size of a truetype font (only required for FT_TRUETYPE).
|
|
Sets the type of font. Must be set before loading. |
|
'Touches' the resource to indicate it has been used.
Reimplemented in Ogre::Material, and Ogre::UnifiedHighLevelGpuProgram. |
|
Unloads the resource; this is not permanent, the resource can be reloaded later if required.
Reimplemented in Ogre::UnifiedHighLevelGpuProgram. |
|
Implements Ogre::Resource. |
|
for TRUE_TYPE font only
Definition at line 149 of file OgreFont.h. |
|
Definition at line 140 of file OgreFont.h. |
|
Range of code points to generate glyphs for (truetype only).
Definition at line 152 of file OgreFont.h. |
|
Creator.
Definition at line 109 of file OgreResource.h. |
|
The name of the resource group.
Definition at line 113 of file OgreResource.h. |
|
Numeric handle for more efficient look up than name.
Definition at line 115 of file OgreResource.h. |
|
Is this resource going to be background loaded? Only applicable for multithreaded.
Definition at line 119 of file OgreResource.h. |
|
Is this file manually loaded?
Definition at line 125 of file OgreResource.h. |
|
Definition at line 132 of file OgreResource.h. |
|
Optional manual loader; if provided, data is loaded from here instead of a file.
Definition at line 129 of file OgreResource.h. |
|
Is the resource currently loaded?
Definition at line 117 of file OgreResource.h. |
|
Unique name of the resource.
Definition at line 111 of file OgreResource.h. |
|
Origin of this resource (e.g. script name) - optional.
Definition at line 127 of file OgreResource.h. |
|
Class name for this instance to be used as a lookup (must be initialised by subclasses).
Definition at line 164 of file OgreStringInterface.h. |
|
The material which is generated for this font.
Definition at line 143 of file OgreFont.h. |
|
Definition at line 104 of file OgreFont.h. |
|
Dictionary of parameters.
Definition at line 161 of file OgreStringInterface.h. |
|
Mutex to cover the status of loading The size of the resource in bytes.
Definition at line 123 of file OgreResource.h. |
|
Source of the font (either an image name or a truetype font).
Definition at line 110 of file OgreFont.h. |
|
Definition at line 103 of file OgreFont.h. |
|
Definition at line 102 of file OgreFont.h. |
|
Definition at line 101 of file OgreFont.h. |
|
Definition at line 100 of file OgreFont.h. |
|
Texture pointer.
Definition at line 146 of file OgreFont.h. |
|
Resolution (dpi) of truetype font.
Definition at line 115 of file OgreFont.h. |
|
Size of the truetype font, in points.
Definition at line 113 of file OgreFont.h. |
|
The type of font.
Definition at line 107 of file OgreFont.h. |
Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Sep 30 10:51:16 2007