H3D API  2.4.1
Public Types | Public Member Functions | Protected Attributes | List of all members
H3D::X3DFontStyleNode Class Reference

This abstract node type is the base node type for all FontStyle nodes. More...

#include <H3D/X3DFontStyleNode.h>

Inheritance diagram for H3D::X3DFontStyleNode:
Inheritance graph

Public Types

enum  Alignment
 Enumeration of the alignments allowed for text.
 
enum  Justification
 Enumeration for the different justification values allowed.
 
- Public Types inherited from H3D::Node
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...
 
- Public Member Functions inherited from H3D::X3DNode
 X3DNode (Inst< SFNode > _metadata=0)
 Constructor.
 
X3DMetadataObjectgetMetadataByName (const string &_name)
 Given a name, the first X3DMetadataObject in the metadata field that matches that name is returned. More...
 
- Public Member Functions inherited from H3D::Node
 Node ()
 Constructor.
 
virtual Nodeclone (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.
 
X3DPrototypeInstancegetProtoInstanceParent ()
 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 FieldgetField (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 Public Member Functions inherited from H3D::Node
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.
 
- Public Attributes inherited from H3D::X3DNode
H3DUniquePtr< SFNodemetadata
 Meta data about the node. More...
 
- Static Public Attributes inherited from H3D::X3DNode
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Protected Member Functions inherited from H3D::Node
void cloneFieldValue (Field &_from, Field &_to, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for the clone() method. More...
 
- Static Protected Member Functions inherited from H3D::Node
static NodegetClonedInstance (Node *original, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for nodes that implement clone() More...
 

Detailed Description

This abstract node type is the base node type for all FontStyle nodes.


Member Function Documentation

◆ ascender()

virtual H3DFloat H3D::X3DFontStyleNode::ascender ( )
inlinevirtual

Returns how many metres in the the positive y-direction from the origin the characters of this font use.


Reimplemented in H3D::FontStyle.

◆ buildFonts()

virtual void H3D::X3DFontStyleNode::buildFonts ( )
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().

◆ defaultXMLContainerField()

virtual std::string H3D::X3DFontStyleNode::defaultXMLContainerField ( )
inlinevirtual

Returns the default xml containerField attribute value.

For this node it is "fontStyle".

Reimplemented from H3D::Node.

◆ descender()

virtual H3DFloat H3D::X3DFontStyleNode::descender ( )
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().

◆ getSpacing()

virtual H3DFloat H3D::X3DFontStyleNode::getSpacing ( )
inlinevirtual

Returns the spacing between lines of text.

See FontStyle for more details.

Reimplemented in H3D::FontStyle.

Referenced by H3D::Text::moveToNewLine(), and stringDimensions().

◆ 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().


The documentation for this class was generated from the following files: