## class OSGTEXT_EXPORT osgText::Text

## Inheritance:

### Public Methods

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)
  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 setFontSize(unsigned int width, unsigned int height)
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
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 GlyphQuads* getGlyphQuads(osg::StateSet* stateSet) const
  Direct Access to GlyphQuads

### Public Members

enum CharacterSizeMode
enum AlignmentType
enum AxisAlignment
enum Layout
enum DrawModeMask
struct OSGTEXT_EXPORT GlyphQuads
typedef std::map<osg::ref_ptr<osg::StateSet>,GlyphQuads> TextureGlyphQuadMap

### Protected Fields

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
mutable TextureGlyphQuadMap _textureGlyphQuadMap
mutable osg::buffered_object<AutoTransformCache> _autoTransformCache
mutable osg::Vec3 _offset
mutable osg::Vec3 _normal
mutable osg::BoundingBox _textBB

### Protected Methods

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 Members

struct AutoTransformCache

## Documentation

`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)`
  Set the Font to use to render the text. setFont(0) sets the use of the default font.

`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. Return 0 if default is being used.

`void setFontSize(unsigned int width, unsigned int height)`

`void 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.

`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. The encoding parameter specificies which Unicode encodeding is used in the std::string.

`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. Note, if you modify the string you must call Text::update() for the internal glyph reprentation to be updated.

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

`enum CharacterSizeMode`

`OBJECT_COORDS`

`SCREEN_COORDS`
  default

`OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT`
  internally scale the characters to be constant screen size

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

`float getMaximumWidth() const`
  Get the maximim width of the text box

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

`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

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

`void setAlignment(AlignmentType alignment)`

`AlignmentType getAlignment() const`

`enum AxisAlignment`

`XY_PLANE`

`XZ_PLANE`

`YZ_PLANE`

`SCREEN`

`void setAxisAlignment(AxisAlignment axis)`

`void setRotation(const osg::Quat& quat)`

`const osg::Quat& getRotation() const`

`void setAutoRotateToScreen(bool autoRotateToScreen)`

`bool getAutoRotateToScreen() const`

`enum Layout`

`LEFT_TO_RIGHT`

`RIGHT_TO_LEFT`
  default

`VERTICAL`

`void setLayout(Layout layout)`

`Layout getLayout() const`

`void setColor(const osg::Vec4& color)`

`const osg::Vec4& getColor() const`

`enum DrawModeMask`

`TEXT`

`BOUNDINGBOX`
  default

`ALIGNMENT`

`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

`struct OSGTEXT_EXPORT GlyphQuads`

`typedef std::vector<Font::Glyph*> Glyphs`

`typedef std::vector<osg::Vec2> Coords2`

`typedef std::vector<osg::Vec3> Coords3`

`typedef std::vector<osg::Vec2> TexCoords`

`Glyphs _glyphs`

`Coords2 _coords`

`osg::buffered_object<Coords3> _transformedCoords`

`TexCoords _texcoords`

`Glyphs getGlyphs()`

`const Glyphs getGlyphs() const`

`Coords2& getCoords()`

`const Coords2& getCoords() const`

`Coords3& getTransformedCoords(unsigned int contexID)`

`const Coords3& getTransformedCoords(unsigned int contexID) const`

`TexCoords& getTexCoords()`

`const TexCoords& getTexCoords() const`

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

`const GlyphQuads* getGlyphQuads(osg::StateSet* stateSet) const`
  Direct Access to GlyphQuads

`virtual ~Text()`

`virtual bool computeBound() const`

`Font* getActiveFont()`

`const Font* getActiveFont() const`

`String::iterator computeLastCharacterOnLine(osg::Vec2 cursor, String::iterator first, String::iterator last)`

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

`mutable TextureGlyphQuadMap _textureGlyphQuadMap`

`void computeGlyphRepresentation()`

`struct AutoTransformCache`

`AutoTransformCache()`

`int _traversalNumber`

`int _width`

`int _height`

`osg::Vec3 _transformedPosition`

`osg::Matrix _modelview`

`osg::Matrix _projection`

`osg::Matrix _matrix`

`mutable osg::buffered_object<AutoTransformCache> _autoTransformCache`

`mutable osg::Vec3 _offset`

`mutable osg::Vec3 _normal`

`mutable osg::BoundingBox _textBB`

`void computePositions()`

`void computePositions(unsigned int contextID) const`

This class has no child classes.

Friends:
  class Font

Alphabetic index HTML hierarchy of classes or Java

This page was generated with the help of DOC++.