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

# osgText::Text Class Reference

Inheritance diagram for osgText::Text:

[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, LEFT_BOTTOM_BASE_LINE, CENTER_BOTTOM_BASE_LINE, RIGHT_BOTTOM_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
| Clone the type of an object, with Object* return type.
virtual osg::Object * | clone (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 Font * | getFont () 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.
String & | getText ()
| Get the text string.
const String & | getText () 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::Vec3 & | getPosition () 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::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
unsigned int | getLineCount ()
| Get the number of wrapped lines - only valid after computeGlyphRepresentation() has been called, returns -1 otherwise.
virtual void | drawImplementation (osg::State &state) const
| Draw the text.
virtual bool | supports (const osg::Drawable::AttributeFunctor &) const
| return false, osgText::Text does not support accept(AttributeFunctor&).
virtual bool | supports (const 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 (const osg::PrimitiveFunctor &) const
| return true, osgText::Text does support accept(PrimitiveFunctor&) .
virtual void | accept (osg::PrimitiveFunctor &pf) const
| accept a PrimtiveFunctor and call its methods to tell it about the interal primtives that this Drawable has.
virtual void | releaseGLObjects (osg::State *state=0) const
| If State is non-zero, this function releases OpenGL objects for the specified graphics context.
const GlyphQuads * | getGlyphQuads (osg::StateSet *stateSet) const
| Direct Access to GlyphQuads.
const TextureGlyphQuadMap & | getTextureGlyphQuadMap () const
virtual osg::BoundingBox | computeBound () const
| Compute the bounding box around Drawables's geometry.
## Protected Member Functions
virtual | ~Text ()
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
unsigned int | _lineCount
TextureGlyphQuadMap | _textureGlyphQuadMap
osg::buffered_object< AutoTransformCache > | _autoTransformCache
osg::Vec3 | _offset
osg::Vec3 | _normal
osg::BoundingBox | _textBB

## 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 |
  LEFT_BOTTOM_BASE_LINE |
  CENTER_BOTTOM_BASE_LINE |
  RIGHT_BOTTOM_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::PrimitiveFunctor & | pf | ) | const`[virtual]`

| accept a PrimtiveFunctor and call its methods to tell it about the interal primtives that this Drawable has. Reimplemented from osg::Drawable.

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 osg::BoundingBox osgText::Text::computeBound | ( |  | ) | const`[virtual]`

| Compute the bounding box around Drawables's geometry. 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. Implements osg::Drawable.

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]`

unsigned int osgText::Text::getLineCount | ( |  | ) | `[inline]`

| Get the number of wrapped lines - only valid after computeGlyphRepresentation() has been called, returns -1 otherwise.

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.

virtual void osgText::Text::releaseGLObjects | ( | osg::State * | state = 0 | ) | const`[virtual]`

| If State is non-zero, this function releases OpenGL objects for the specified graphics context. Otherwise, releases OpenGL objexts for all graphics contexts. 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. See the osgText::readFontFile function for how the font file will be located.

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 | ( | const osg::PrimitiveFunctor & |  | ) | const`[inline, virtual]`

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

virtual bool osgText::Text::supports | ( | const osg::Drawable::ConstAttributeFunctor & |  | ) | const`[inline, virtual]`

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

virtual bool osgText::Text::supports | ( | const 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.

## 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]`

unsigned int osgText::Text::_lineCount`[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:

- Text