SoText2(3IV)NAMESoText2 (SoTxt2) - screen-aligned 2D text shape node
INHERITS FROM
SoBase > SoFieldContainer > SoNode > SoShape > SoText2SYNOPSIS
#include <Inventor_c/nodes/SoText2.h>
typedef SoText2 SoTxt2
enum SoText2Justification {
SO_TXT2_LEFT Left edges of all strings are aligned
SO_TXT2_RIGHT Right edges of all strings are aligned
SO_TXT2_CENTER Centers of all strings are aligned
}
Fields from class SoText2:
SoMFString string
SoSFFloat spacing
SoSFEnum justification
Functions from class SoText2:
SoText2 * SoTxt2Create()
SoType SoTxt2GetClassTypeId()
Functions from class SoNode:
void SoTxt2SetOverride(SoTxt2 *this, SbBool state)
SbBool SoTxt2IsOverride(const SoTxt2 *this)
SoNode * SoTxt2Copy(const SoTxt2 *this, SbBool copyConnections
= FALSE)
SbBool SoTxt2AffectsState(const SoTxt2 *this)
SoNode * SoTxt2GetByName(const char *name)
int SoTxt2GetByNameList(const char *name, SoNodeList
*list)
Functions from class SoFieldContainer:
void SoTxt2SetToDflts(SoTxt2 *this)
SbBool SoTxt2HasDfltVals(const SoTxt2 *this)
SbBool SoTxt2FldsAreEq(const SoTxt2 *this, const
SoFieldContainer *fc)
void SoTxt2CopyFieldVals(SoTxt2 *this, const
SoFieldContainer *fc, SbBool copyConnections =
FALSE)
SbBool SoTxt2Set(SoTxt2 *this, const char *fieldDataString)
void SoTxt2Get(SoTxt2 *this, SbString *fieldDataString)
int SoTxt2GetFields(const SoTxt2 *this, SoFieldList
*resultList)
Page 1SoText2(3IV)
SoField * SoTxt2GetField(const SoTxt2 *this, const char
*fieldName)
SbBool SoTxt2GetFieldName(const SoTxt2 *this, const SoField
*field, SbName *fieldName)
SbBool SoTxt2IsNotifyEnabled(const SoTxt2 *this)
SbBool SoTxt2EnableNotify(SoTxt2 *this, SbBool flag)
Functions from class SoBase:
void SoTxt2Ref(SoTxt2 *this)
void SoTxt2Unref(const SoTxt2 *this)
void SoTxt2UnrefNoDelete(const SoTxt2 *this)
void SoTxt2Touch(SoTxt2 *this)
SoType SoTxt2GetTypeId(const SoTxt2 *this)
SbBool SoTxt2IsOfType(const SoTxt2 *this, SoType type)
void SoTxt2SetName(SoTxt2 *this, const char *name)
SbName SoTxt2GetName(const SoTxt2 *this)
DESCRIPTION
This node defines one or more strings of 2D text. The text is always
aligned horizontally with the screen and does not change size with
distance in a perspective projection. The text origin is at (0,0,0) after
applying the current transformation. Rotations and scales have no effect
on the orientation or size of 2D text, just the location.
SoText2 uses the current font to determine the typeface and size. The
text is always drawn with the diffuse color of the current material; it
is not lit, regardless of the lighting model. Furthermore, 2D text can
not be textured, and it ignores the current drawing style and complexity.
Because 2D text is screen-aligned, it has some unusual characteristics.
For example, the 3D bounding box surrounding a 2D text string depends on
the current camera and the current viewport size, since changing the
field of view or the mapping onto the window changes the relative size of
the text with respect to the rest of the scene. This has implications for
caching as well, since a render cache in an SoSeparator that contains an
SoText2 node depends on the current camera.
FIELDS
SoMFString string
The text string(s) to display. Each string will appear on its own
line. The string(s) can be ascii or UTF-8.
SoSFFloat spacing
Defines the distance (in the negative y direction) between the base
points of successive strings, measured with respect to the current
font height. A value of 1 indicates single spacing, a value of 2
indicates double spacing, and so on.
SoSFEnum justification
Indicates placement and alignment of strings. With LEFT
Page 2SoText2(3IV)
justification, the left edge of the first line is at the
(transformed) origin, and all left edges are aligned. RIGHT
justification is similar. CENTER justification places the center of
the first string at the (transformed) origin, with the centers of
all remaining strings aligned under it.
FUNCTIONSSoText2 * SoTxt2Create()
Creates a 2D text node with default settings.
SoType SoTxt2GetClassTypeId()
Returns type identifier for this class.
ACTION BEHAVIOR
SoGLRenderAction
Draws text based on the current font, at a location based on the
current transformation.
SoRayPickAction
Performs a pick on the text. Text will be picked if the picking ray
intersects the bounding box of the strings. The string index and
character position are available from the SoTextDetail.
SoGetBoundingBoxAction
Computes the bounding box that encloses the text.
FILE FORMAT/DEFAULTS
Text2 {
string ""
spacing 1
justification LEFT
}
SEE ALSO
SoFont, SoText3, SoTextDetail
Page 3