Go to the documentation of this file.
149 : codePoint(id), uvRect(rect), aspectRatio(aspect)
277 CodePointMap::const_iterator i = mCodePointMap.find(
id);
278 if (i != mCodePointMap.end())
280 return i->second.uvRect;
284 static UVRect nullRect(0.0, 0.0, 0.0, 0.0);
298 CodePointMap::iterator i = mCodePointMap.find(
id);
299 if (i != mCodePointMap.end())
301 i->second.uvRect.left = u1;
302 i->second.uvRect.top = v1;
303 i->second.uvRect.right = u2;
304 i->second.uvRect.bottom = v2;
305 i->second.aspectRatio = textureAspect * (u2 - u1) / (v2 - v1);
309 mCodePointMap.insert(
310 CodePointMap::value_type(
id,
312 textureAspect * (u2 - u1) / (v2 - v1))));
319 CodePointMap::const_iterator i = mCodePointMap.find(
id);
320 if (i != mCodePointMap.end())
322 return i->second.aspectRatio;
336 CodePointMap::iterator i = mCodePointMap.find(
id);
337 if (i != mCodePointMap.end())
339 i->second.aspectRatio = ratio;
358 mCodePointRangeList.push_back(range);
365 mCodePointRangeList.clear();
372 return mCodePointRangeList;
403 mAntialiasColour = enabled;
411 return mAntialiasColour;
void addCodePointRange(const CodePointRange &range)
Adds a range of code points to the list of code point ranges to generate glyphs for,...
void doSet(void *target, const String &val)
unsigned long long int ResourceHandle
std::pair< CodePoint, CodePoint > CodePointRange
A range of code points, inclusive on both ends.
const String & getSource(void) const
Gets the source this font (either an image or a truetype font).
uint getCharacterSpacer(void) const
Gets the spacing to allocate for font characters to overlap each other.
TexturePtr mTexture
Texture pointer.
uint getTrueTypeResolution(void) const
Gets the resolution (dpi) of the font used to generate the texture.
void doSet(void *target, const String &val)
GlyphInfo(CodePoint id, const UVRect &rect, Real aspect)
Real getGlyphAspectRatio(CodePoint id) const
Gets the aspect ratio (width / height) of this character.
CodePointRangeList mCodePointRangeList
Range of code points to generate glyphs for (truetype only)
void clearCodePointRanges()
Clear the list of code point ranges.
Class representing a font in the system.
static CmdSource msSourceCmd
@ FT_IMAGE
Loaded from an image created by an artist.
bool mAntialiasColour
for TRUE_TYPE font only
Information about the position and size of a glyph in a texture.
const CodePointRangeList & getCodePointRangeList() const
Get a const reference to the list of code point ranges to be used to generate glyphs from a truetype ...
vector< CodePointRange >::type CodePointRangeList
const UVRect & getGlyphTexCoords(CodePoint id) const
Returns the texture coordinates of the associated glyph.
String mSource
Source of the font (either an image name or a truetype font)
FontType getType(void) const
Gets the type of font.
String doGet(const void *target) const
Font(ResourceManager *creator, const String &name, ResourceHandle handle, const String &group, bool isManual=false, ManualResourceLoader *loader=0)
Constructor.
Command object for Font - see ParamCommand.
void setType(FontType ftype)
Sets the type of font.
static CmdCharSpacer msCharacterSpacerCmd
FontType
Enumerates the types of Font usable in the engine.
CodePointMap mCodePointMap
@ FT_TRUETYPE
Generated from a truetype (.ttf) font.
void setGlyphAspectRatio(CodePoint id, Real ratio)
Sets the aspect ratio (width / height) of this character.
void doSet(void *target, const String &val)
Abstract class which is command object which gets/sets parameters.
void setAntialiasColour(bool enabled)
Sets whether or not the colour of this font is antialiased as it is generated from a true type font.
map< CodePoint, GlyphInfo >::type CodePointMap
Map from unicode code point to texture coordinates.
static CmdCodePoints msCodePointsCmd
String doGet(const void *target) const
void loadResource(Resource *resource)
Implementation of ManualResourceLoader::loadResource, called when the Texture that this font creates ...
virtual void loadImpl()
Internal implementation of the meat of the 'load' action, only called if this resource is not being l...
void setTrueTypeSize(Real ttfSize)
Sets the size of a truetype font (only required for FT_TRUETYPE).
#define _OgreOverlayExport
int mTtfMaxBearingY
Max distance to baseline of this (truetype) font.
Command object for Font - see ParamCommand.
Real getTrueTypeSize(void) const
Gets the point size of the font used to generate the texture.
const MaterialPtr & getMaterial() const
Gets the material generated for this font, as a weak reference.
bool getAntialiasColour(void) const
Gets whether or not the colour of this font is antialiased as it is generated from a true type font.
static CmdResolution msResolutionCmd
Command object for Font - see ParamCommand.
void createTextureFromFont(void)
Internal method for loading from ttf.
Defines a generic resource handler.
String doGet(const void *target) const
String doGet(const void *target) const
Real mTtfSize
Size of the truetype font, in points.
Command object for Font - see ParamCommand.
String doGet(const void *target) const
const MaterialPtr & getMaterial()
Gets the material generated for this font, as a weak reference.
Abstract class representing a loadable resource (e.g.
void setSource(const String &source)
Sets the source of the font.
uint mCharacterSpacer
Add a gap between letters vertically and horizonally prevents nasty artifacts caused by fonts atypica...
const GlyphInfo & getGlyphInfo(CodePoint id) const
Gets the information available for a glyph corresponding to a given code point, or throws an exceptio...
void doSet(void *target, const String &val)
String doGet(const void *target) const
int getTrueTypeMaxBearingY() const
Gets the maximum baseline distance of all glyphs used in the texture.
void setTrueTypeResolution(uint ttfResolution)
Gets the resolution (dpi) of the font used to generate the texture (only required for FT_TRUETYPE).
Command object for Font - see ParamCommand.
void doSet(void *target, const String &val)
float Real
Software floating point type.
virtual void unloadImpl()
Internal implementation of the 'unload' action; called regardless of whether this resource is being l...
void doSet(void *target, const String &val)
uint mTtfResolution
Resolution (dpi) of truetype font.
size_t calculateSize(void) const
Calculate the size of a resource; this will only be called after 'load'.
void setCharacterSpacer(uint charSpacer)
Sets the spacing to allocate for font characters to overlap each other.
Interface describing a manual resource loader.
FontType mType
The type of font.
void setGlyphTexCoords(CodePoint id, Real u1, Real v1, Real u2, Real v2, Real textureAspect)
Sets the texture coordinates of a glyph.
MaterialPtr mMaterial
The material which is generated for this font.
Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.