Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

osg::TextTXFGlyph Class Reference

#include <OSGTextTXFGlyph.h>

Inheritance diagram for osg::TextTXFGlyph:

osg::TextGlyph List of all members.

Public Types

enum  CoordIndex { COORD_LEFT = 0, COORD_TOP = 1, COORD_RIGHT = 2, COORD_BOTTOM = 3 }
typedef Int32 Index
enum  { INVALID_INDEX = -1 }

Public Member Functions

virtual ~TextTXFGlyph ()
virtual Real32 getWidth () const
virtual Real32 getHeight () const
virtual Real32 getHoriBearingX () const
virtual Real32 getHoriBearingY () const
virtual Real32 getVertBearingX () const
virtual Real32 getVertBearingY () const
UInt32 getX () const
UInt32 getY () const
UInt32 getPixmapWidth () const
UInt32 getPixmapHeight () const
Int32 getPixmapHoriBearingX () const
Int32 getPixmapHoriBearingY () const
Int32 getPixmapVertBearingX () const
Int32 getPixmapVertBearingY () const
Real32 getScale () const
Real32 getTexCoord (UInt32 index) const
Real32 getCoord (UInt32 index) const
Index getGlyphIndex () const
Real32 getHoriAdvance () const
Real32 getVertAdvance () const

Protected Member Functions

 TextTXFGlyph ()
void calculateCoordinates (UInt32 textureWidth, UInt32 textureHeight)

Protected Attributes

UInt32 _width
UInt32 _height
Int32 _horiBearingX
Int32 _horiBearingY
Int32 _vertBearingX
Int32 _vertBearingY
UInt32 _x
UInt32 _y
Real32 _scale
Real32 _texCoord [4]
Index _glyphIndex
Real32 _horiAdvance
Real32 _vertAdvance

Private Member Functions

 TextTXFGlyph (const TextTXFGlyph &)
const TextTXFGlyphoperator= (const TextTXFGlyph &)

Friends

class TextTXFFace

Detailed Description

Defines a TXF glyph.
Author:
Patrick Dähne

Definition at line 61 of file OSGTextTXFGlyph.h.


Member Typedef Documentation

typedef Int32 osg::TextGlyph::Index [inherited]
 

Defines the glyph index

Definition at line 65 of file OSGTextGlyph.h.


Member Enumeration Documentation

enum osg::TextTXFGlyph::CoordIndex
 

Defines the coordinate indices

Enumerator:
COORD_LEFT 
COORD_TOP 
COORD_RIGHT 
COORD_BOTTOM 

Definition at line 180 of file OSGTextTXFGlyph.h.

00180 { COORD_LEFT = 0, COORD_TOP = 1, COORD_RIGHT = 2, COORD_BOTTOM = 3 };

anonymous enum [inherited]
 

Defines the invalid glyph index

Enumerator:
INVALID_INDEX 

Definition at line 68 of file OSGTextGlyph.h.

00068 { INVALID_INDEX = -1 };


Constructor & Destructor Documentation

osg::TextTXFGlyph::~TextTXFGlyph  )  [virtual]
 

Destroys a TextTXFGlyph object.

Definition at line 62 of file OSGTextTXFGlyph.cpp.

00062 {}

osg::TextTXFGlyph::TextTXFGlyph  )  [protected]
 

Creates a new TextTXFGlyph object.

Definition at line 49 of file OSGTextTXFGlyph.cpp.

References _texCoord, COORD_BOTTOM, COORD_LEFT, COORD_RIGHT, and COORD_TOP.

00050 : TextGlyph(), _width(0), _height(0), _horiBearingX(0), _horiBearingY(0),
00051   _vertBearingX(0), _vertBearingY(0), _x(0), _y(0), _scale(1.f), _texCoord()
00052 {
00053     _texCoord[COORD_LEFT] = _texCoord[COORD_BOTTOM] =
00054     _texCoord[COORD_RIGHT] = _texCoord[COORD_TOP] = 0.f;
00055 }

osg::TextTXFGlyph::TextTXFGlyph const TextTXFGlyph  )  [private]
 

Copy constructor (not implemented!)


Member Function Documentation

Real32 osg::TextTXFGlyph::getWidth  )  const [virtual]
 

Returns the width of the glyph.

Returns:
The width of the glyph

Implements osg::TextGlyph.

Definition at line 69 of file OSGTextTXFGlyph.cpp.

References _scale, and _width.

Referenced by osg::TextTXFFace::addToGeom(), osg::SimpleStatisticsForeground::draw(), and osg::GraphicStatisticsForeground::drawString().

00070 { return static_cast<Real32>(_width) * _scale; }

Real32 osg::TextTXFGlyph::getHeight  )  const [virtual]
 

Returns the height of the glyph.

Returns:
The height of the glyph

Implements osg::TextGlyph.

Definition at line 77 of file OSGTextTXFGlyph.cpp.

References _height, and _scale.

Referenced by osg::TextTXFFace::addToGeom(), osg::SimpleStatisticsForeground::draw(), and osg::GraphicStatisticsForeground::drawString().

00078 { return static_cast<Real32>(_height) * _scale; }

Real32 osg::TextTXFGlyph::getHoriBearingX  )  const [virtual]
 

Returns the x bearing of the glyph for horizontal layout. The x bearing is the distance from the origin to the left border of the glyph.

Returns:
The x bearing of the glyph for horizontal layout

Implements osg::TextGlyph.

Definition at line 85 of file OSGTextTXFGlyph.cpp.

References _horiBearingX, and _scale.

00086 { return static_cast<Real32>(_horiBearingX) * _scale; }

Real32 osg::TextTXFGlyph::getHoriBearingY  )  const [virtual]
 

Returns the y bearing of the glyph for horizontal layout. The y bearing is the distance from the origin to the top border of the glyph.

Returns:
The y bearing of the glyph for horizontal layout

Implements osg::TextGlyph.

Definition at line 93 of file OSGTextTXFGlyph.cpp.

References _horiBearingY, and _scale.

00094 { return static_cast<Real32>(_horiBearingY) * _scale; }

Real32 osg::TextTXFGlyph::getVertBearingX  )  const [virtual]
 

Returns the x bearing of the glyph for vertical layout. The x bearing is the distance from the origin to the left border of the glyph.

Returns:
The x bearing of the glyph for vertical layout

Implements osg::TextGlyph.

Definition at line 101 of file OSGTextTXFGlyph.cpp.

References _scale, and _vertBearingX.

00102 { return static_cast<Real32>(_vertBearingX) * _scale; }

Real32 osg::TextTXFGlyph::getVertBearingY  )  const [virtual]
 

Returns the y bearing of the glyph for vertical layout. The y bearing is the distance from the origin to the top border of the glyph.

Returns:
The y bearing of the glyph for vertical layout

Implements osg::TextGlyph.

Definition at line 109 of file OSGTextTXFGlyph.cpp.

References _scale, and _vertBearingY.

00110 { return static_cast<Real32>(_vertBearingY) * _scale; }

UInt32 osg::TextTXFGlyph::getX  )  const [inline]
 

Returns the x position of the glyph in the texture.

Returns:
The x position of the glyph in the texture

Definition at line 50 of file OSGTextTXFGlyph.inl.

References _x.

00050 { return _x; }

UInt32 osg::TextTXFGlyph::getY  )  const [inline]
 

Returns the y position of the glyph in the texture.

Returns:
The y position of the glyph in the texture

Definition at line 53 of file OSGTextTXFGlyph.inl.

References _y.

00053 { return _y; }

UInt32 osg::TextTXFGlyph::getPixmapWidth  )  const [inline]
 

Returns the width of the glyph in pixels.

Returns:
The width of the glyph

Definition at line 56 of file OSGTextTXFGlyph.inl.

References _width.

Referenced by osg::TextTXFFace::prepareTexture().

00056 { return _width; }

UInt32 osg::TextTXFGlyph::getPixmapHeight  )  const [inline]
 

Returns the height of the glyph in pixels.

Returns:
The height of the glyph

Definition at line 59 of file OSGTextTXFGlyph.inl.

References _height.

Referenced by osg::TextTXFFace::prepareTexture().

00059 { return _height; }

Int32 osg::TextTXFGlyph::getPixmapHoriBearingX  )  const [inline]
 

Returns the x bearing of the glyph in pixels for horizontal layout. The x bearing is the distance from the origin to the left border of the glyph.

Returns:
The x bearing of the glyph for horizontal layout

Definition at line 62 of file OSGTextTXFGlyph.inl.

References _horiBearingX.

00062 { return _horiBearingX; }

Int32 osg::TextTXFGlyph::getPixmapHoriBearingY  )  const [inline]
 

Returns the y bearing of the glyph in pixels for horizontal layout. The y bearing is the distance from the origin to the top border of the glyph.

Returns:
The y bearing of the glyph for horizontal layout

Definition at line 65 of file OSGTextTXFGlyph.inl.

References _horiBearingY.

00065 { return _horiBearingY; }

Int32 osg::TextTXFGlyph::getPixmapVertBearingX  )  const [inline]
 

Returns the x bearing of the glyph in pixels for vertical layout. The x bearing is the distance from the origin to the left border of the glyph.

Returns:
The x bearing of the glyph for vertical layout

Definition at line 68 of file OSGTextTXFGlyph.inl.

References _vertBearingX.

00068 { return _vertBearingX; }

Int32 osg::TextTXFGlyph::getPixmapVertBearingY  )  const [inline]
 

Returns the y bearing of the glyph in pixels for vertical layout. The y bearing is the distance from the origin to the top border of the glyph.

Returns:
The y bearing of the glyph for vertical layout

Definition at line 71 of file OSGTextTXFGlyph.inl.

References _vertBearingY.

00071 { return _vertBearingY; }

Real32 osg::TextTXFGlyph::getScale  )  const [inline]
 

Returns the scale factor.

Returns:
The scale factor

Definition at line 74 of file OSGTextTXFGlyph.inl.

References _scale.

00074 { return _scale; }

Real32 osg::TextTXFGlyph::getTexCoord UInt32  index  )  const [inline]
 

Returns a texture coordinate.

Parameters:
index The index of the texture coordinate (must be between 0 and 3, inclusively)
Returns:
The texture coordinate

Definition at line 77 of file OSGTextTXFGlyph.inl.

References _texCoord.

Referenced by osg::TextTXFFace::addToGeom(), osg::SimpleStatisticsForeground::draw(), and osg::GraphicStatisticsForeground::drawString().

00078 {
00079     assert(index < 4);
00080     return _texCoord[index];
00081 }

Real32 osg::TextTXFGlyph::getCoord UInt32  index  )  const [inline]
 

Returns a coordinate.

Parameters:
index The index of the coordinate (must be between 0 and 3, inclusively)
Returns:
The coordinate

void osg::TextTXFGlyph::calculateCoordinates UInt32  textureWidth,
UInt32  textureHeight
[protected]
 

Calculates coordinates

Definition at line 117 of file OSGTextTXFGlyph.cpp.

References _height, _texCoord, _width, _x, _y, COORD_BOTTOM, COORD_LEFT, COORD_RIGHT, and COORD_TOP.

00119 {
00120     Real32 w = static_cast<Real32>(textureWidth);
00121     Real32 h = static_cast<Real32>(textureHeight);
00122     _texCoord[TextTXFGlyph::COORD_LEFT] = _x / w;
00123     _texCoord[TextTXFGlyph::COORD_BOTTOM] = _y / h;
00124     _texCoord[TextTXFGlyph::COORD_RIGHT] = (_x + _width) / w;
00125     _texCoord[TextTXFGlyph::COORD_TOP] = (_y + _height) / h;
00126 }

const TextTXFGlyph& osg::TextTXFGlyph::operator= const TextTXFGlyph  )  [private]
 

Copy operator (not implemented!)

TextGlyph::Index osg::TextGlyph::getGlyphIndex  )  const [inline, inherited]
 

Returns the index of the glyph.

Returns:
The index of the glyph

Definition at line 43 of file OSGTextGlyph.inl.

References osg::TextGlyph::_glyphIndex.

00043 { return _glyphIndex; }

Real32 osg::TextGlyph::getHoriAdvance  )  const [inline, inherited]
 

Returns the advance of the glyph for horizontal layout. The advance is the distance to the next character on the base line.

Returns:
The advance for horizontal layout

Definition at line 46 of file OSGTextGlyph.inl.

References osg::TextGlyph::_horiAdvance.

00046 { return _horiAdvance; }

Real32 osg::TextGlyph::getVertAdvance  )  const [inline, inherited]
 

Returns the advance of the glyph for vertical layout. The advance is the distance to the next character on the base line. This value is usually negative!

Returns:
The advance for vertical layout

Definition at line 49 of file OSGTextGlyph.inl.

References osg::TextGlyph::_vertAdvance.

00049 { return _vertAdvance; }


Friends And Related Function Documentation

friend class TextTXFFace [friend]
 

Needs access to constructor

Definition at line 65 of file OSGTextTXFGlyph.h.


Member Data Documentation

UInt32 osg::TextTXFGlyph::_width [protected]
 

The width of the glyph in pixels

Definition at line 205 of file OSGTextTXFGlyph.h.

Referenced by calculateCoordinates(), getPixmapWidth(), and getWidth().

UInt32 osg::TextTXFGlyph::_height [protected]
 

The height of the glyph in pixels

Definition at line 208 of file OSGTextTXFGlyph.h.

Referenced by calculateCoordinates(), getHeight(), and getPixmapHeight().

Int32 osg::TextTXFGlyph::_horiBearingX [protected]
 

The x bearing of the glyph in pixels for horizontal layout

Definition at line 211 of file OSGTextTXFGlyph.h.

Referenced by getHoriBearingX(), and getPixmapHoriBearingX().

Int32 osg::TextTXFGlyph::_horiBearingY [protected]
 

The y bearing of the glyph in pixels for horizontal layout

Definition at line 214 of file OSGTextTXFGlyph.h.

Referenced by getHoriBearingY(), and getPixmapHoriBearingY().

Int32 osg::TextTXFGlyph::_vertBearingX [protected]
 

The x bearing of the glyph in pixels for vertical layout

Definition at line 217 of file OSGTextTXFGlyph.h.

Referenced by getPixmapVertBearingX(), and getVertBearingX().

Int32 osg::TextTXFGlyph::_vertBearingY [protected]
 

The y bearing of the glyph in pixels for vertical layout

Definition at line 220 of file OSGTextTXFGlyph.h.

Referenced by getPixmapVertBearingY(), and getVertBearingY().

UInt32 osg::TextTXFGlyph::_x [protected]
 

The x position of the glyph in the texture in pixels

Definition at line 223 of file OSGTextTXFGlyph.h.

Referenced by calculateCoordinates(), and getX().

UInt32 osg::TextTXFGlyph::_y [protected]
 

The y position of the glyph in the texture in pixels

Definition at line 226 of file OSGTextTXFGlyph.h.

Referenced by calculateCoordinates(), and getY().

Real32 osg::TextTXFGlyph::_scale [protected]
 

The scaling factor

Definition at line 229 of file OSGTextTXFGlyph.h.

Referenced by getHeight(), getHoriBearingX(), getHoriBearingY(), getScale(), getVertBearingX(), getVertBearingY(), and getWidth().

Real32 osg::TextTXFGlyph::_texCoord[4] [protected]
 

The texture coordinates

Definition at line 232 of file OSGTextTXFGlyph.h.

Referenced by calculateCoordinates(), getTexCoord(), and TextTXFGlyph().

Index osg::TextGlyph::_glyphIndex [protected, inherited]
 

The index of the glyph

Definition at line 145 of file OSGTextGlyph.h.

Referenced by osg::TextGlyph::getGlyphIndex().

Real32 osg::TextGlyph::_horiAdvance [protected, inherited]
 

The advance of the glyph for horizontal layout

Definition at line 148 of file OSGTextGlyph.h.

Referenced by osg::TextGlyph::getHoriAdvance().

Real32 osg::TextGlyph::_vertAdvance [protected, inherited]
 

The advance of the glyph for vertical layout

Definition at line 151 of file OSGTextGlyph.h.

Referenced by osg::TextGlyph::getVertAdvance().


The documentation for this class was generated from the following files:
Generated on Thu Aug 25 04:23:09 2005 for OpenSG by  doxygen 1.4.3