Post

Text

Text

Overview

Text is a 2D (flat) geometry node that can contain multiple lines of string values. Layout and styling is controlled by a contained FontStyle node.

The Text node belongs to the Text component and requires at least level 1, its default container field is geometry. It is available since VRML 2.0 and from X3D version 3.0 or higher.

Hierarchy

1
2
3
+ X3DNode
  + X3DGeometryNode
    + Text

Fields

SFNode [in, out] metadata NULL [X3DMetadataObject]

Information about this node can be contained in a MetadataBoolean, MetadataDouble, MetadataFloat, MetadataInteger, MetadataString or MetadataSet node.

Hint

MFString [in, out] string [ ]

Single or multiple string values to present as Text. Each value in the string array (including empty strings) gets displayed on a separate line.

Hints

  • MFString arrays can have multiple values, so separate each individual string by quote marks.
  • Strings can contain quote marks by first escaping them with a backslash example: “say "hello" please”
  • Many XML tools substitute XML character references for special characters automatically if needed within an attribute value (such as & for & ampersand character, or " for “ quotation-mark character).
  • Relates to Internationalization (i18n) Example Example

MFFloat [in, out] length [ ] [0,∞)

Array of length values for each text string in the local coordinate system. Each string is stretched or compressed to fit.

SFFloat [in, out] maxExtent 0 [0,∞)

Limits/compresses all text strings if max string length is longer than maxExtent, as measured in local coordinate system.

SFBool [ ] solid FALSE

Setting solid true means draw only one side of polygons (backface culling on), setting solid false means draw both sides of polygons (backface culling off).

Hints

  • Mnemonic “this geometry is solid like a brick” (you don’t render the inside of a brick).
  • If in doubt, use solid=’false’ for maximum visibility.
  • AccessType relaxed to inputOutput in order to support animation and visualization.

Warnings

  • Default value true can completely hide geometry if viewed from wrong side!
  • solid false not supported in VRML97.

SFVec3f [out] origin

origin of the text local coordinate system, in units of the coordinate system in which the Text node is embedded. The value of the origin field represents the upper left corner of the textBounds.

Warning

  • It is an error to define this transient outputOnly field in an X3D file, instead only use it a source for ROUTE events.

SFVec2f [out] textBounds

2D bounding box value for all lines of text in the local coordinate system.

Warning

  • It is an error to define this transient outputOnly field in an X3D file, instead only use it a source for ROUTE events.

MFVec2f [out] lineBounds

Array of 2D bounding box values for each line of text in the local coordinate system.

Warning

  • It is an error to define this transient outputOnly field in an X3D file, instead only use it a source for ROUTE events.

SFNode [in, out] fontStyle NULL [X3DFontStyleNode]

The fontStyle field can contain a FontStyle or ScreenFontStyle node defining size, family, and style for presented text.

Hint

Advice

Hints

Warning

  • Text node requires X3D profile='Immersive' or <component name='Text' level='1'/>

Example

See Also

This post is licensed under CC BY 4.0 by the author.