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

osgText::Text Class Reference

Inheritance diagram for osgText::Text:

osg::Drawable osg::Object osg::Referenced 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::Object * cloneType () const
virtual osg::Object * clone (const osg::CopyOp &copyop) const
virtual bool isSameKindAs (const osg::Object *obj) const
virtual const char * className () const
virtual const char * libraryName () const
void setFont (Font *font=0)
void setFont (const std::string &fontfile)
const Font * getFont () const
void setFontResolution (unsigned int width, unsigned int height)
unsigned int getFontWidth () const
unsigned int getFontHeight () const
void setText (const String &text)
void setText (const std::string &text)
void setText (const std::string &text, String::Encoding encoding)
void setText (const wchar_t *text)
String & getText ()
const String & getText () const
void update ()
void setCharacterSize (float height, float aspectRatio=1.0f)
float getCharacterHeight () const
float getCharacterAspectRatio () const
void setCharacterSizeMode (CharacterSizeMode mode)
CharacterSizeMode getCharacterSizeMode () const
void setMaximumWidth (float maximumWidth)
float getMaximumWidth () const
void setMaximumHeight (float maximumHeight)
float getMaximumHeight () const
void setPosition (const osg::Vec3 &pos)
const osg::Vec3 & getPosition () const
void setAlignment (AlignmentType alignment)
AlignmentType getAlignment () const
void setAxisAlignment (AxisAlignment axis)
void setRotation (const osg::Quat &quat)
const osg::Quat & getRotation () const
void setAutoRotateToScreen (bool autoRotateToScreen)
bool getAutoRotateToScreen () const
void setLayout (Layout layout)
Layout getLayout () const
void setColor (const osg::Vec4 &color)
const osg::Vec4 & getColor () const
void setDrawMode (unsigned int mode)
unsigned int getDrawMode () const
void setKerningType (KerningType kerningType)
KerningType getKerningType () const
virtual void drawImplementation (osg::State &state) const
virtual bool supports (osg::Drawable::AttributeFunctor &) const
virtual bool supports (osg::Drawable::ConstAttributeFunctor &) const
virtual void accept (osg::Drawable::ConstAttributeFunctor &af) const
virtual bool supports (osg::Drawable::PrimitiveFunctor &) const
virtual void accept (osg::Drawable::PrimitiveFunctor &pf) const
const GlyphQuads * getGlyphQuads (osg::StateSet *stateSet) const
const TextureGlyphQuadMap & getTextureGlyphQuadMap () const

Protected Member Functions

virtual ~Text ()
virtual bool computeBound () const
Font * getActiveFont ()
const Font * getActiveFont () 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

osgText::Text::Text (   ) 
 

osgText::Text::Text (  const Text &  text,
const osg::CopyOp &  copyop = osg::CopyOp::SHALLOW_COPY
) 
 

virtual osgText::Text::~Text (   )  [protected, virtual]
 


Member Function Documentation

virtual void osgText::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.

virtual void osgText::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.

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

compute the bounding box of the drawable. Method must be implemented by subclasses.

Reimplemented from osg::Drawable.

void osgText::Text::computeGlyphRepresentation (   )  [protected]
 

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

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

void osgText::Text::computePositions (   )  [protected]
 

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

Draw the text.

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

Font* osgText::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 osgText::Text::setAlignment (  AlignmentType  alignment  ) 
 

void osgText::Text::setAutoRotateToScreen (  bool  autoRotateToScreen  ) 
 

void osgText::Text::setAxisAlignment (  AxisAlignment  axis  ) 
 

void osgText::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 osgText::Text::setColor (  const osg::Vec4 &  color  ) 
 

void osgText::Text::setDrawMode (  unsigned int  mode  ) 
 

void osgText::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 osgText::Text::setFont (  Font *  font = 0  ) 
 

Set the Font to use to render the text. setFont(0) sets the use of the default font.

void osgText::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 osgText::Text::setLayout (  Layout  layout  ) 
 

void osgText::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 osgText::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 osgText::Text::setPosition (  const osg::Vec3 &  pos  ) 
 

Set the position of text.

void osgText::Text::setRotation (  const osg::Quat &  quat  ) 
 

void osgText::Text::setText (  const wchar_t *  text  ) 
 

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

void osgText::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 osgText::Text::setText (  const std::string &  text  ) 
 

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

void osgText::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 file:
Generated on Fri May 13 15:15:53 2005 for openscenegraph by  doxygen 1.4.2