H3D::Text Class Reference
[X3D node classes.]

The Text node specifies a two-sided, flat text string object positioned in the Z=0 plane of the local coordinate system based on values defined in the fontStyle field (see FontStyle). More...

#include <Text.h>

Inheritance diagram for H3D::Text:

Inheritance graph
List of all members.

Public Member Functions

 Text (Inst< SFNode > _metadata=0, Inst< SFBound > _bound=0, Inst< DisplayList > _displayList=0, Inst< SFFontStyleNode > _fontStyle=0, Inst< MFFloat > _length=0, Inst< SFFloat > _maxExtent=0, Inst< MFString > _string=0, Inst< SFBool > _solid=0)
 Constructor.
virtual void render ()
 Render the text with OpenGL.

Public Attributes

auto_ptr< SFFontStyleNodefontStyle
 The style the text should be rendered with.
auto_ptr< MFFloatlength
 The length field contains an MFFloat value that specifies the length of each text string in the local coordinate system.
auto_ptr< SFFloatmaxExtent
 The maxExtent field limits and compresses all of the text strings if the length of the maximum string is longer than the maximum extent, as measured in the local coordinate system.
auto_ptr< MFStringstringF
 The strings to render.
auto_ptr< SFBoolsolid
 The solid field determines whether one or both sides of each polygon shall be displayed.

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.

Protected Types

typedef TypedSFNode< X3DFontStyleNodeSFFontStyleNode

Protected Member Functions

virtual void scaleToMaxExtent (const vector< string > &text, X3DFontStyleNode *font)
 Scales the scene so that the text given would be contained within the value of the maxExtent field.
virtual void justifyMinor (const vector< string > &text, X3DFontStyleNode *font)
 Justify the text in the minor alignment by translating it in the way described in the FontStyle node.
virtual void moveToNewLine (const string &text, X3DFontStyleNode *font)
 Move to the position of the next line.
virtual void renderTextLine (const string &text, X3DFontStyleNode *font)
 Render a line of text in the style of the X3DFontStyleNode given.
virtual void justifyLine (const string &text, X3DFontStyleNode *font)
 Justify the line of text in the major alignment by translating it in the way described in the FontStyle node.

Classes

class  DisplayList
 We extend the DisplayList to build the fonts of the X3DFontStyleNode in the fontStyle field of the Text node this DisplayList resides in. More...
class  SFBound
 The SFBound field is specialized to update itself from the values in the fields of the Text node. More...

Detailed Description

The Text node specifies a two-sided, flat text string object positioned in the Z=0 plane of the local coordinate system based on values defined in the fontStyle field (see FontStyle).

Text nodes may contain multiple text strings specified using the UTF-8 encoding. The text strings are stored in the order in which the text mode characters are to be produced as defined by the parameters in the FontStyle node.

The text strings are contained in the string field. The fontStyle field contains one FontStyle node that specifies the font size, font family and style, direction of the text strings, and any specific language rendering techniques used for the text.

The maxExtent field limits and compresses all of the text strings if the length of the maximum string is longer than the maximum extent, as measured in the local coordinate system. If the text string with the maximum length is shorter than the maxExtent, then there is no compressing. The maximum extent is measured horizontally for horizontal text (FontStyle node: horizontal=TRUE) and vertically for vertical text (FontStyle node: horizontal=FALSE). The maxExtent field shall be greater than or equal to zero.

The length field contains an MFFloat value that specifies the length of each text string in the local coordinate system. If the string is too short, it is stretched (either by scaling the text or by adding space between the characters). If the string is too long, it is compressed (either by scaling the text or by subtracting space between the characters). If a length value is missing (for example, if there are four strings but only three length values), the missing values are considered to be 0. The length field shall be greater than or equal to zero.

Specifying a value of 0 for both the maxExtent and length fields indicates that the string may be any length.

The solid field determines whether one or both sides of each polygon shall be displayed. If solid is FALSE, each polygon is visible regardless of the viewing direction and if it is TRUE back face culling is performed to only show the front face of the polygons.


Member Function Documentation

void Text::moveToNewLine const string &  text,
X3DFontStyleNode font
[protected, virtual]
 

Move to the position of the next line.

What the next line is depends on the values in the FontStyle node, i.e. if the text is horizontal, if it is top to bottom or the other way around, spacing etc.

void Text::renderTextLine const string &  text,
X3DFontStyleNode font
[protected, virtual]
 

Render a line of text in the style of the X3DFontStyleNode given.

The OpenGL transform matrices will not be changed by the call.

void Text::scaleToMaxExtent const vector< string > &  text,
X3DFontStyleNode font
[protected, virtual]
 

Scales the scene so that the text given would be contained within the value of the maxExtent field.

The length field is inspected as well as the dimensions of the text to determine what the scale should be.


Member Data Documentation

auto_ptr< SFFontStyleNode > H3D::Text::fontStyle
 

The style the text should be rendered with.

See X3DFontStyleNode.

Access type: inputOutput

Text_fontStyle.dot

auto_ptr< MFFloat > H3D::Text::length
 

The length field contains an MFFloat value that specifies the length of each text string in the local coordinate system.

If the string is too short, it is stretched (either by scaling the text or by adding space between the characters). If the string is too long, it is compressed (either by scaling the text or by subtracting space between the characters). If a length value is missing (for example, if there are four strings but only three length values), the missing values are considered to be 0. The length field shall be greater than or equal to zero.

Access type: inputOutput
Default value: []
Valid range: >=0

Text_length.dot

auto_ptr< SFFloat > H3D::Text::maxExtent
 

The maxExtent field limits and compresses all of the text strings if the length of the maximum string is longer than the maximum extent, as measured in the local coordinate system.

If the text string with the maximum length is shorter than the maxExtent, then there is no compressing. The maximum extent is measured horizontally for horizontal text (FontStyle node: horizontal=TRUE) and vertically for vertical text (FontStyle node: horizontal=FALSE). The maxExtent field shall be greater than or equal to zero.

Access type: inputOutput
Default value: 0
Valid range: >=0

Text_maxExtent.dot

auto_ptr< SFBool > H3D::Text::solid
 

The solid field determines whether one or both sides of each polygon shall be displayed.

If solid is FALSE, each polygon is visible regardless of the viewing direction and if it is TRUE back face culling is performed to only show the front face of the polygons.

Access type: inputOutput
Default value: FALSE

auto_ptr< MFString > H3D::Text::stringF
 

The strings to render.

Each string will be on its own line.

Access type: inputOutput

Text_string.dot


Generated on Thu Aug 24 12:40:06 2006 for H3D API by  doxygen 1.4.5