H3D API
2.4.1
|
This abstract node type is the base node type for all FontStyle nodes. More...
#include <H3D/X3DFontStyleNode.h>
Public Types | |
enum | Alignment |
Enumeration of the alignments allowed for text. | |
enum | Justification |
Enumeration for the different justification values allowed. | |
![]() | |
typedef std::map< Node *, Node * > | DeepCopyMap |
A map type used during a deep copy clone() to map from original nodes to cloned nodes. | |
Public Member Functions | |
X3DFontStyleNode (Inst< SFNode > _metadata=0) | |
Constructor. | |
virtual void | buildFonts () |
Build Character instances for all characters that will be allowed for use by this font node. More... | |
bool | fontsBuilt () |
Returns true if buildFonts has been called, false otherwise. | |
virtual bool | isTopToBottom () |
Returns true if the text should be rendered from top to bottom, false otherwise. | |
virtual bool | isLeftToRight () |
Returns true if the text should be rendered from left to right, false otherwise. | |
virtual H3DFloat | getSpacing () |
Returns the spacing between lines of text. More... | |
virtual Alignment | getAlignment () |
Gets the alignment of the text. | |
virtual Justification | getMajorJustification () |
Gets the justification of the text in the major alignment direction. | |
virtual Justification | getMinorJustification () |
Gets the justification of the text in the minor alignment direction. | |
virtual void | renderChar (unsigned char) |
Render the given character with this font. | |
virtual void | renderHorizontalLine (const std::string &) |
Render the given string with this font from left to right horizontally. | |
virtual Vec3f | charDimensions (unsigned char) |
Get the dimensions in metres of the character given when rendered with this font. | |
virtual H3DFloat | ascender () |
Returns how many metres in the the positive y-direction from the origin the characters of this font use. More... | |
virtual H3DFloat | descender () |
Returns how many metres in the the negative y-direction from the origin the characters of this font use. More... | |
Vec3f | stringDimensions (const std::string &text, Alignment alignment) |
Given a text string and an alignment of the text the function returns the dimensions of the bounding box of the 3d representation of the text using this font. | |
Vec3f | stringDimensions (const std::vector< std::string > &text, Alignment alignment, const std::vector< H3DFloat > &length=std::vector< H3DFloat >()) |
Given a vector of text string and an alignment of the text the function returns the dimensions of the bounding box of the 3d representation of the text using this font. More... | |
virtual std::string | defaultXMLContainerField () |
Returns the default xml containerField attribute value. More... | |
![]() | |
X3DNode (Inst< SFNode > _metadata=0) | |
Constructor. | |
X3DMetadataObject * | getMetadataByName (const string &_name) |
Given a name, the first X3DMetadataObject in the metadata field that matches that name is returned. More... | |
![]() | |
Node () | |
Constructor. | |
virtual Node * | clone (bool deepCopy=true, DeepCopyMap *deepCopyMap=NULL) |
Returns a new instance of this node type with the same state as this one. More... | |
virtual | ~Node () |
Destructor. | |
X3DPrototypeInstance * | getProtoInstanceParent () |
If this node is the root node in the proto body of a X3DPrototypeInstance then this will return that node. More... | |
void | setProtoInstanceParent (X3DPrototypeInstance *p) |
Set the X3DPrototypeInstance this node is the the root node if applicaple. | |
virtual void | render () |
the render() function is used for the depth-first rendering traversal of the scene-graph. More... | |
virtual void | traverseSG (TraverseInfo &ti) |
traverseSG is called once per scenegraph loop on the scene in order to traverse the scenegraph. More... | |
virtual bool | lineIntersect (const Vec3f &from, const Vec3f &to, LineIntersectResult &result) |
Detect intersection between a line segment and the Node. More... | |
virtual void | closestPoint (const Vec3f &p, NodeIntersectResult &result) |
Find closest point on Node to p. More... | |
virtual bool | movingSphereIntersect (H3DFloat radius, const Vec3f &from, const Vec3f &to, NodeIntersectResult &result) |
Detect collision between a moving sphere and the Node. More... | |
virtual Field * | getField (const string &_name) const |
return a pointer to the field specified by name within this instance | |
int | addDestructCallback (void(*func)(Node *, void *), void *args) |
Add a callback function to be run on destruction of node. More... | |
int | removeDestructCallback (void(*func)(Node *, void *), void *args) |
Add a callback function to be run on destruction of node. More... | |
Protected Attributes | |
bool | fonts_built |
True if buildFonts has been called. | |
Additional Inherited Members | |
![]() | |
static unsigned int | nrNodesAlive () |
Returns the nr of nodes currently alive, i.e. nodes created but not destructed. | |
static int | nrNodesCreated () |
Returns the number of nodes created in total since the start of the program. | |
![]() | |
H3DUniquePtr< SFNode > | metadata |
Meta data about the node. More... | |
![]() | |
static H3DNodeDatabase | database |
The H3DNodeDatabase for this node. | |
![]() | |
void | cloneFieldValue (Field &_from, Field &_to, bool deepCopy, DeepCopyMap &deepCopyMap) |
A helper function for the clone() method. More... | |
![]() | |
static Node * | getClonedInstance (Node *original, bool deepCopy, DeepCopyMap &deepCopyMap) |
A helper function for nodes that implement clone() More... | |
This abstract node type is the base node type for all FontStyle nodes.
|
inlinevirtual |
Returns how many metres in the the positive y-direction from the origin the characters of this font use.
Reimplemented in H3D::FontStyle.
|
inlinevirtual |
Build Character instances for all characters that will be allowed for use by this font node.
Characters are to be put into the characters vector using its own value as an index. Also buildFonts has to be set to true when defining this function.
Reimplemented in H3D::FontStyle.
Referenced by H3D::Text::render(), and H3D::Text::SFBound::update().
|
inlinevirtual |
Returns the default xml containerField attribute value.
For this node it is "fontStyle".
Reimplemented from H3D::Node.
|
inlinevirtual |
Returns how many metres in the the negative y-direction from the origin the characters of this font use.
Reimplemented in H3D::FontStyle.
Referenced by H3D::Text::justifyLine(), H3D::Text::justifyMinor(), and H3D::Text::SFBound::update().
|
inlinevirtual |
Returns the spacing between lines of text.
See FontStyle for more details.
Reimplemented in H3D::FontStyle.
Referenced by H3D::Text::moveToNewLine(), and stringDimensions().
Vec3f X3DFontStyleNode::stringDimensions | ( | const std::vector< std::string > & | text, |
Alignment | alignment, | ||
const std::vector< H3DFloat > & | length = std::vector< H3DFloat >() |
||
) |
Given a vector of text string and an alignment of the text the function returns the dimensions of the bounding box of the 3d representation of the text using this font.
A vector specifying the length of the text fields as in the Text node. If this is specified this length will be used as length for as many strings in text as there are values in length.
References getSpacing(), length(), and stringDimensions().