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

osgText::Text Class Reference

Inheritance diagram for osgText::Text:

Inheritance graph
[legend]
List of all members.

Public Types

typedef std::map< osg::ref_ptr<
osg::StateSet >, GlyphQuads
TextureGlyphQuadMap
enum  CharacterSizeMode { OBJECT_COORDS, SCREEN_COORDS, OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT }
enum  AlignmentType {
  LEFT_TOP, LEFT_CENTER, LEFT_BOTTOM, CENTER_TOP,
  CENTER_CENTER, CENTER_BOTTOM, RIGHT_TOP, RIGHT_CENTER,
  RIGHT_BOTTOM, LEFT_BASE_LINE, CENTER_BASE_LINE, RIGHT_BASE_LINE,
  BASE_LINE = LEFT_BASE_LINE
}
enum  AxisAlignment {
  XY_PLANE, REVERSED_XY_PLANE, XZ_PLANE, REVERSED_XZ_PLANE,
  YZ_PLANE, REVERSED_YZ_PLANE, SCREEN
}
enum  Layout { LEFT_TO_RIGHT, RIGHT_TO_LEFT, VERTICAL }
enum  DrawModeMask { TEXT = 1, BOUNDINGBOX = 2, ALIGNMENT = 4 }

Public Member Functions

 Text ()
 Text (const Text &text, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
virtual osg::ObjectcloneType () const
 Clone the type of an object, with Object* return type.
virtual osg::Objectclone (const osg::CopyOp &copyop) const
virtual bool isSameKindAs (const osg::Object *obj) const
virtual const char * className () const
 return the name of the object's class type.
virtual const char * libraryName () const
 return the name of the object's library.
void setFont (Font *font=0)
 Set the Font to use to render the text.
void setFont (const std::string &fontfile)
 Set the font, loaded from the specified front file, to use to render the text, setFont("") sets the use of the default font.
const FontgetFont () const
 Get the font.
void setFontResolution (unsigned int width, unsigned int height)
 Set the Font reference width and height resolution in texels.
unsigned int getFontWidth () const
unsigned int getFontHeight () const
void setText (const String &text)
 Set the text using a osgText::String.
void setText (const std::string &text)
 Set the text using a std::string, which is converted to an internal TextString.
void setText (const std::string &text, String::Encoding encoding)
 Set the text using a Unicode encoded std::string, which is converted to an internal TextString.
void setText (const wchar_t *text)
 Set the text using a wchar_t string, which is converted to an internal TextString.
StringgetText ()
 Get the text string.
const StringgetText () const
 Get the const text string.
void update ()
 update internal glyph respresnetation used for rendering, and bounding volume.
void setCharacterSize (float height, float aspectRatio=1.0f)
 Set the rendered character size in object coordinates.
float getCharacterHeight () const
float getCharacterAspectRatio () const
void setCharacterSizeMode (CharacterSizeMode mode)
 Set how the CharacterSize value relates to the final rendered character.
CharacterSizeMode getCharacterSizeMode () const
 Get the CharacterSizeMode.
void setMaximumWidth (float maximumWidth)
 Set the maximum width of the text box.
float getMaximumWidth () const
 Get the maximim width of the text box.
void setMaximumHeight (float maximumHeight)
 Set the maximum height of the text box.
float getMaximumHeight () const
 Get the maximum height of the text box.
void setPosition (const osg::Vec3 &pos)
 Set the position of text.
const osg::Vec3getPosition () const
 Get the position of text.
void setAlignment (AlignmentType alignment)
AlignmentType getAlignment () const
void setAxisAlignment (AxisAlignment axis)
void setRotation (const osg::Quat &quat)
const osg::QuatgetRotation () const
void setAutoRotateToScreen (bool autoRotateToScreen)
bool getAutoRotateToScreen () const
void setLayout (Layout layout)
Layout getLayout () const
void setColor (const osg::Vec4 &color)
const osg::Vec4getColor () const
void setDrawMode (unsigned int mode)
unsigned int getDrawMode () const
void setKerningType (KerningType kerningType)
KerningType getKerningType () const
virtual void drawImplementation (osg::State &state) const
 Draw the text.
virtual bool supports (osg::Drawable::AttributeFunctor &) const
 return false, osgText::Text does not support accept(AttributeFunctor&).
virtual bool supports (osg::Drawable::ConstAttributeFunctor &) const
 return true, osgText::Text does support accept(ConstAttributeFunctor&).
virtual void accept (osg::Drawable::ConstAttributeFunctor &af) const
 accept an ConstAttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has.
virtual bool supports (osg::Drawable::PrimitiveFunctor &) const
 return true, osgText::Text does support accept(PrimitiveFunctor&) .
virtual void accept (osg::Drawable::PrimitiveFunctor &pf) const
 accept a PrimtiveFunctor and call its methods to tell it about the interal primtives that this Drawable has.
const GlyphQuadsgetGlyphQuads (osg::StateSet *stateSet) const
 Direct Access to GlyphQuads.
const TextureGlyphQuadMapgetTextureGlyphQuadMap () const

Protected Member Functions

virtual ~Text ()
virtual bool computeBound () const
 compute the bounding box of the drawable.
FontgetActiveFont ()
const FontgetActiveFont () const
String::iterator computeLastCharacterOnLine (osg::Vec2 cursor, String::iterator first, String::iterator last)
void computeGlyphRepresentation ()
void computePositions ()
void computePositions (unsigned int contextID) const

Protected Attributes

osg::ref_ptr< Font_font
unsigned int _fontWidth
unsigned int _fontHeight
float _characterHeight
float _characterAspectRatio
CharacterSizeMode _characterSizeMode
float _maximumWidth
float _maximumHeight
String _text
osg::Vec3 _position
AlignmentType _alignment
osg::Quat _rotation
bool _autoRotateToScreen
Layout _layout
osg::Vec4 _color
unsigned int _drawMode
KerningType _kerningType
TextureGlyphQuadMap _textureGlyphQuadMap
osg::buffered_object< AutoTransformCache_autoTransformCache
osg::Vec3 _offset
osg::Vec3 _normal
osg::BoundingBox _textBB

Friends

class Font

Classes

struct  AutoTransformCache
struct  GlyphQuads

Member Typedef Documentation

typedef std::map<osg::ref_ptr<osg::StateSet>,GlyphQuads> osgText::Text::TextureGlyphQuadMap
 


Member Enumeration Documentation

enum osgText::Text::AlignmentType
 

Enumeration values:
LEFT_TOP 
LEFT_CENTER 
LEFT_BOTTOM 
CENTER_TOP 
CENTER_CENTER 
CENTER_BOTTOM 
RIGHT_TOP 
RIGHT_CENTER 
RIGHT_BOTTOM 
LEFT_BASE_LINE 
CENTER_BASE_LINE 
RIGHT_BASE_LINE 
BASE_LINE 

enum osgText::Text::AxisAlignment
 

Enumeration values:
XY_PLANE 
REVERSED_XY_PLANE 
XZ_PLANE 
REVERSED_XZ_PLANE 
YZ_PLANE 
REVERSED_YZ_PLANE 
SCREEN 

enum osgText::Text::CharacterSizeMode
 

Enumeration values:
OBJECT_COORDS 
SCREEN_COORDS  default
OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT  text that behavaves like OBJECT_COORDS sized text when a long distance way, but has its screen sized capped automatically when the viewer gets near.

enum osgText::Text::DrawModeMask
 

Enumeration values:
TEXT 
BOUNDINGBOX  default
ALIGNMENT 

enum osgText::Text::Layout
 

Enumeration values:
LEFT_TO_RIGHT 
RIGHT_TO_LEFT  default
VERTICAL 


Constructor & Destructor Documentation

Text::Text  ) 
 

Text::Text const Text text,
const osg::CopyOp copyop = osg::CopyOp::SHALLOW_COPY
 

Text::~Text  )  [protected, virtual]
 


Member Function Documentation

void Text::accept osg::Drawable::PrimitiveFunctor pf  )  const [virtual]
 

accept a PrimtiveFunctor and call its methods to tell it about the interal primtives that this Drawable has.

void Text::accept osg::Drawable::ConstAttributeFunctor af  )  const [virtual]
 

accept an ConstAttributeFunctor and call its methods to tell it about the interal attributes that this Drawable has.

virtual const char* osgText::Text::className  )  const [inline, virtual]
 

return the name of the object's class type.

Must be defined by derived classes.

Reimplemented from osg::Drawable.

virtual osg::Object* osgText::Text::clone const osg::CopyOp copyop  )  const [inline, virtual]
 

virtual osg::Object* osgText::Text::cloneType  )  const [inline, virtual]
 

Clone the type of an object, with Object* return type.

Must be defined by derived classes.

Implements osg::Object.

bool Text::computeBound  )  const [protected, virtual]
 

compute the bounding box of the drawable.

Method must be implemented by subclasses.

Reimplemented from osg::Drawable.

void Text::computeGlyphRepresentation  )  [protected]
 

String::iterator Text::computeLastCharacterOnLine osg::Vec2  cursor,
String::iterator  first,
String::iterator  last
[protected]
 

void Text::computePositions unsigned int  contextID  )  const [protected]
 

void Text::computePositions  )  [protected]
 

void Text::drawImplementation osg::State state  )  const [virtual]
 

Draw the text.

const Font * Text::getActiveFont  )  const [protected]
 

Font * Text::getActiveFont  )  [protected]
 

AlignmentType osgText::Text::getAlignment  )  const [inline]
 

bool osgText::Text::getAutoRotateToScreen  )  const [inline]
 

float osgText::Text::getCharacterAspectRatio  )  const [inline]
 

float osgText::Text::getCharacterHeight  )  const [inline]
 

CharacterSizeMode osgText::Text::getCharacterSizeMode  )  const [inline]
 

Get the CharacterSizeMode.

const osg::Vec4& osgText::Text::getColor  )  const [inline]
 

unsigned int osgText::Text::getDrawMode  )  const [inline]
 

const Font* osgText::Text::getFont  )  const [inline]
 

Get the font.

Return 0 if default is being used.

unsigned int osgText::Text::getFontHeight  )  const [inline]
 

unsigned int osgText::Text::getFontWidth  )  const [inline]
 

const GlyphQuads* osgText::Text::getGlyphQuads osg::StateSet stateSet  )  const [inline]
 

Direct Access to GlyphQuads.

KerningType osgText::Text::getKerningType  )  const [inline]
 

Layout osgText::Text::getLayout  )  const [inline]
 

float osgText::Text::getMaximumHeight  )  const [inline]
 

Get the maximum height of the text box.

float osgText::Text::getMaximumWidth  )  const [inline]
 

Get the maximim width of the text box.

const osg::Vec3& osgText::Text::getPosition  )  const [inline]
 

Get the position of text.

const osg::Quat& osgText::Text::getRotation  )  const [inline]
 

const String& osgText::Text::getText  )  const [inline]
 

Get the const text string.

String& osgText::Text::getText  )  [inline]
 

Get the text string.

Note, if you modify the string you must call Text::update() for the internal glyph reprentation to be updated.

const TextureGlyphQuadMap& osgText::Text::getTextureGlyphQuadMap  )  const [inline]
 

virtual bool osgText::Text::isSameKindAs const osg::Object obj  )  const [inline, virtual]
 

virtual const char* osgText::Text::libraryName  )  const [inline, virtual]
 

return the name of the object's library.

Must be defined by derived classes. The OpenSceneGraph convention is that the namespace of a library is the same as the library name.

Reimplemented from osg::Drawable.

void Text::setAlignment AlignmentType  alignment  ) 
 

void Text::setAutoRotateToScreen bool  autoRotateToScreen  ) 
 

void Text::setAxisAlignment AxisAlignment  axis  ) 
 

void Text::setCharacterSize float  height,
float  aspectRatio = 1.0f
 

Set the rendered character size in object coordinates.

void osgText::Text::setCharacterSizeMode CharacterSizeMode  mode  )  [inline]
 

Set how the CharacterSize value relates to the final rendered character.

void Text::setColor const osg::Vec4 color  ) 
 

void Text::setDrawMode unsigned int  mode  ) 
 

void Text::setFont const std::string &  fontfile  ) 
 

Set the font, loaded from the specified front file, to use to render the text, setFont("") sets the use of the default font.

void Text::setFont Font font = 0  ) 
 

Set the Font to use to render the text.

setFont(0) sets the use of the default font.

void Text::setFontResolution unsigned int  width,
unsigned int  height
 

Set the Font reference width and height resolution in texels.

Note, the size may not be supported by current font, the closest supported font size will be selected.

void osgText::Text::setKerningType KerningType  kerningType  )  [inline]
 

void Text::setLayout Layout  layout  ) 
 

void Text::setMaximumHeight float  maximumHeight  ) 
 

Set the maximum height of the text box.

With horizontal layouts any characters which do not fit are wrapped around. 0 or negative values indicate that no maximum height is set, lines can be as long as they need be to fit thre required text

void Text::setMaximumWidth float  maximumWidth  ) 
 

Set the maximum width of the text box.

With horizontal layouts any characters which do not fit are wrapped around. 0 or negative values indicate that no maximum width is set, lines can be as long as they need be to fit thre required text

void Text::setPosition const osg::Vec3 pos  ) 
 

Set the position of text.

void Text::setRotation const osg::Quat quat  ) 
 

void Text::setText const wchar_t *  text  ) 
 

Set the text using a wchar_t string, which is converted to an internal TextString.

void Text::setText const std::string &  text,
String::Encoding  encoding
 

Set the text using a Unicode encoded std::string, which is converted to an internal TextString.

The encoding parameter specificies which Unicode encodeding is used in the std::string.

void Text::setText const std::string &  text  ) 
 

Set the text using a std::string, which is converted to an internal TextString.

void Text::setText const String text  ) 
 

Set the text using a osgText::String.

virtual bool osgText::Text::supports osg::Drawable::PrimitiveFunctor  )  const [inline, virtual]
 

return true, osgText::Text does support accept(PrimitiveFunctor&) .

virtual bool osgText::Text::supports osg::Drawable::ConstAttributeFunctor  )  const [inline, virtual]
 

return true, osgText::Text does support accept(ConstAttributeFunctor&).

virtual bool osgText::Text::supports osg::Drawable::AttributeFunctor  )  const [inline, virtual]
 

return false, osgText::Text does not support accept(AttributeFunctor&).

void osgText::Text::update  )  [inline]
 

update internal glyph respresnetation used for rendering, and bounding volume.


Friends And Related Function Documentation

friend class Font [friend]
 


Member Data Documentation

AlignmentType osgText::Text::_alignment [protected]
 

bool osgText::Text::_autoRotateToScreen [protected]
 

osg::buffered_object<AutoTransformCache> osgText::Text::_autoTransformCache [mutable, protected]
 

float osgText::Text::_characterAspectRatio [protected]
 

float osgText::Text::_characterHeight [protected]
 

CharacterSizeMode osgText::Text::_characterSizeMode [protected]
 

osg::Vec4 osgText::Text::_color [protected]
 

unsigned int osgText::Text::_drawMode [protected]
 

osg::ref_ptr<Font> osgText::Text::_font [protected]
 

unsigned int osgText::Text::_fontHeight [protected]
 

unsigned int osgText::Text::_fontWidth [protected]
 

KerningType osgText::Text::_kerningType [protected]
 

Layout osgText::Text::_layout [protected]
 

float osgText::Text::_maximumHeight [protected]
 

float osgText::Text::_maximumWidth [protected]
 

osg::Vec3 osgText::Text::_normal [mutable, protected]
 

osg::Vec3 osgText::Text::_offset [mutable, protected]
 

osg::Vec3 osgText::Text::_position [protected]
 

osg::Quat osgText::Text::_rotation [protected]
 

String osgText::Text::_text [protected]
 

osg::BoundingBox osgText::Text::_textBB [mutable, protected]
 

TextureGlyphQuadMap osgText::Text::_textureGlyphQuadMap [mutable, protected]
 


The documentation for this class was generated from the following files:
Generated at Thu Oct 13 09:04:14 2005 for the OpenSceneGraph by doxygen 1.4.1.