man SoVRMLFontStyle (Fonctions bibliothèques) -

NAME

SoVRMLFontStyle -

SYNOPSIS



#include <Inventor/VRMLnodes/SoVRMLFontStyle.h>

Inherits SoNode.

Detailed Description

The SoVRMLFontStyle class is used to define the current font.

Important note: currently, the SoVRMLText node implementation is not complete, and some of the features mentioned in the documentation below may not be working yet.

The detailed class documentation is taken verbatim from the VRML97 standard (ISO/IEC 14772-1:1997). It is copyright The Web3D Consortium, and is used by permission of the Consortium:

  FontStyle { 
    field MFString family       "SERIF"
    field SFBool   horizontal   TRUE
    field MFString justify      "BEGIN"
    field SFString language     ""
    field SFBool   leftToRight  TRUE
    field SFFloat  size         1.0          # (0,)
    field SFFloat  spacing      1.0          # [0,)
    field SFString style        "PLAIN"
    field SFBool   topToBottom  TRUE
  }
  .fi


Introduction

The FontStyle node defines the size, family, and style used for Text nodes, as well as the direction of the text strings and any language-specific rendering techniques used for non-English text. See SoVRMLText, for a description of the Text node.

The size field specifies the nominal height, in the local coordinate system of the Text node, of glyphs rendered and determines the spacing of adjacent lines of text. Values of the size field shall be greater than zero.

The spacing field determines the line spacing between adjacent lines of text. The distance between the baseline of each line of text is (spacing ? size) in the appropriate direction (depending on other fields described below). The effects of the size and spacing field are depicted in Figure 6.7 (spacing greater than 1.0). Values of the spacing field shall be non-negative.

FontStyle node example

  Figure 6.7 -- Text size and spacing fields 

Font family and style

Font attributes are defined with the family and style fields. The browser shall map the specified font attributes to an appropriate available font as described below.

The family field contains a case-sensitive MFString value that specifies a sequence of font family names in preference order. The browser shall search the MFString value for the first font family name matching a supported font family. If none of the string values matches a supported font family, the default font family 'SERIF' shall be used. All browsers shall support at least 'SERIF' (the default) for a serif font such as Times Roman; 'SANS' for a sans-serif font such as Helvetica; and 'TYPEWRITER' for a fixed-pitch font such as Courier. An empty family value is identical to ['SERIF'].

The style field specifies a case-sensitive SFString value that may be 'PLAIN' (the default) for default plain type; 'BOLD' for boldface type; 'ITALIC' for italic type; or 'BOLDITALIC' for bold and italic type. An empty style value ('') is identical to 'PLAIN'.

Direction and justification

The horizontal, leftToRight, and topToBottom fields indicate the direction of the text. The horizontal field indicates whether the text advances horizontally in its major direction (horizontal = TRUE, the default) or vertically in its major direction (horizontal = FALSE). The leftToRight and topToBottom fields indicate direction of text advance in the major (characters within a single string) and minor (successive strings) axes of layout. Which field is used for the major direction and which is used for the minor direction is determined by the horizontal field.

For horizontal text (horizontal = TRUE), characters on each line of text advance in the positive X direction if leftToRight is TRUE or in the negative X direction if leftToRight is FALSE. Characters are advanced according to their natural advance width. Each line of characters is advanced in the negative Y direction if topToBottom is TRUE or in the positive Y direction if topToBottom is FALSE. Lines are advanced by the amount of size ? spacing.

For vertical text (horizontal = FALSE), characters on each line of text advance in the negative Y direction if topToBottom is TRUE or in the positive Y direction if topToBottom is FALSE. Characters are advanced according to their natural advance height. Each line of characters is advanced in the positive X direction if leftToRight is TRUE or in the negative X direction if leftToRight is FALSE. Lines are advanced by the amount of size ? spacing.

The justify field determines alignment of the above text layout relative to the origin of the object coordinate system. The justify field is an MFString which can contain 2 values. The first value specifies alignment along the major axis and the second value specifies alignment along the minor axis, as determined by the horizontal field. An empty justify value ('') is equivalent to the default value. If the second string, minor alignment, is not specified, minor alignment defaults to the value 'FIRST'. Thus, justify values of '', 'BEGIN', and ['BEGIN' 'FIRST'] are equivalent.

The major alignment is along the X-axis when horizontal is TRUE and along the Y-axis when horizontal is FALSE. The minor alignment is along the Y-axis when horizontal is TRUE and along the X-axis when horizontal is FALSE. The possible values for each enumerant of the justify field are 'FIRST', 'BEGIN', 'MIDDLE', and 'END'. For major alignment, each line of text is positioned individually according to the major alignment enumerant. For minor alignment, the block of text representing all lines together is positioned according to the minor alignment enumerant. Tables 6.2-6.5 at <http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-IS-VRML97WithAmendment1/part1/nodesRef.html#Table6.2> describe the behaviour in terms of which portion of the text is at the origin.

The default minor alignment is 'FIRST'. This is a special case of minor alignment when horizontal is TRUE. Text starts at the baseline at the Y-axis. In all other cases, 'FIRST' is identical to 'BEGIN'. In Tables 6.6 and 6.7, each colour-coded cross-hair indicates where the X-axis and Y-axis shall be in relation to the text. Figure 6.8 describes the symbols used in Tables 6.6 and 6.7.

  Figure 6.8 -- Key for Tables 6.6 and 6.7 

  Table 6.6 -- horizontal = TRUE 

  Table 6.7 -- horizontal = FALSE 

Language

The language field specifies the context of the language for the text string. Due to the multilingual nature of the ISO/IEC 10646-1:1993, the language field is needed to provide a proper language attribute of the text string. The format is based on RFC 1766: language[_territory] <http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-IS-VRML97WithAmendment1/part1/references.html#[1766]>. The value for the language tag is based on ISO 639:1988 (e.g., 'zh' for Chinese, 'jp' for Japanese, and 'sc' for Swedish.) The territory tag is based on ISO 3166:1993 country codes (e.g., 'TW' for Taiwan and 'CN' for China for the 'zh' Chinese language tag). If the language field is empty (''), local language bindings are used.

See <http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-IS-VRML97WithAmendment1/part1/references.html>, for more information on RFC 1766 <http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-IS-VRML97WithAmendment1/part1/references.html#[1766]>, ISO/IEC 10646:1993 <http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-IS-VRML97WithAmendment1/part1/references.html#[UTF8]>, ISO/IEC 639:1998 <http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-IS-VRML97WithAmendment1/part1/references.html#[I639]>, and ISO 3166:1993 <http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-IS-VRML97WithAmendment1/part1/references.html#[I3166]>. 

Public Types

enum Family { SERIF, SANS, TYPEWRITER }

enum Style { PLAIN = 0x0, BOLD = 0x1, ITALIC = 0x2, BOLDITALIC = 0x3 }

Public Member Functions

virtual SoType getTypeId (void) const

SoVRMLFontStyle (void)

SbString getFontName (void)

virtual void doAction (SoAction *action)

virtual void callback (SoCallbackAction *action)

virtual void GLRender (SoGLRenderAction *action)

virtual void getBoundingBox (SoGetBoundingBoxAction *action)

virtual void pick (SoPickAction *action)

virtual void getPrimitiveCount (SoGetPrimitiveCountAction *action)

Static Public Member Functions

static SoType getClassTypeId (void)

static void initClass (void)

Public Attributes

SoSFFloat size

SoMFString family

SoMFString style

SoSFBool horizontal

SoSFBool leftToRight

SoSFBool topToBottom

SoSFString language

SoMFString justify

SoSFFloat spacing

Protected Member Functions

virtual const SoFieldData * getFieldData (void) const

virtual ~SoVRMLFontStyle ()

Static Protected Member Functions

static const SoFieldData ** getFieldDataPtr (void)

Constructor & Destructor Documentation

SoVRMLFontStyle::SoVRMLFontStyle (void)

Constructor.

SoVRMLFontStyle::~SoVRMLFontStyle () [protected, virtual]

Destructor.

Member Function Documentation

SoType SoVRMLFontStyle::getClassTypeId (void) [static]

SoSFFloat SoVRMLFontStyle::spacing Spacing constant. Default value is 1.0.

Reimplemented from SoNode.

SoType SoVRMLFontStyle::getTypeId (void) const [virtual]

Returns the type identification of an object derived from a class inheriting SoBase. This is used for run-time type checking and 'downward' casting.

Usage example:

  void foo(SoNode * node)
  {
    if (node->getTypeId() == SoFile::getClassTypeId()) {
      SoFile * filenode = (SoFile *)node;  // safe downward cast, knows the type
    }
    else if (node->getTypeId().isOfType(SoGroup::getClassTypeId())) {
      SoGroup * group = (SoGroup *)node;  // safe downward cast, knows the type
    }
  }

For application programmers wanting to extend the library with new nodes, engines, nodekits, draggers or others: this method needs to be overridden in all subclasses. This is typically done as part of setting up the full type system for extension classes, which is usually accomplished by using the pre-defined macros available through for instance Inventor/nodes/SoSubNode.h (SO_NODE_INIT_CLASS and SO_NODE_CONSTRUCTOR for node classes), Inventor/engines/SoSubEngine.h (for engine classes) and so on.

For more information on writing Coin extensions, see the class documentation of the toplevel superclasses for the various class groups.

Implements SoBase.

const SoFieldData ** SoVRMLFontStyle::getFieldDataPtr (void) [static, protected]

This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.

Reimplemented from SoNode.

const SoFieldData * SoVRMLFontStyle::getFieldData (void) const [protected, virtual]

Returns a pointer to the class-wide field data storage object for this instance. If no fields are present, returns NULL.

Reimplemented from SoFieldContainer.

void SoVRMLFontStyle::initClass (void) [static]

Sets up initialization for data common to all instances of this class, like submitting necessary information to the Coin type system.

Reimplemented from SoNode.

void SoVRMLFontStyle::doAction (SoAction * action) [virtual]

This function performs the typical operation of a node for any action.

Reimplemented from SoNode.

void SoVRMLFontStyle::callback (SoCallbackAction * action) [virtual]

Action method for SoCallbackAction.

Simply updates the state according to how the node behaves for the render action, so the application programmer can use the SoCallbackAction for extracting information about the scene graph.

Reimplemented from SoNode.

void SoVRMLFontStyle::GLRender (SoGLRenderAction * action) [virtual]

Action method for the SoGLRenderAction.

This is called during rendering traversals. Nodes influencing the rendering state in any way or who wants to throw geometry primitives at OpenGL overrides this method.

Reimplemented from SoNode.

void SoVRMLFontStyle::getBoundingBox (SoGetBoundingBoxAction * action) [virtual]

Action method for the SoGetBoundingBoxAction.

Calculates bounding box and center coordinates for node and modifies the values of the action to encompass the bounding box for this node and to shift the center point for the scene more towards the one for this node.

Nodes influencing how geometry nodes calculates their bounding box also overrides this method to change the relevant state variables.

Reimplemented from SoNode.

void SoVRMLFontStyle::pick (SoPickAction * action) [virtual]

Action method for SoPickAction.

Does common processing for SoPickAction action instances.

Reimplemented from SoNode.

void SoVRMLFontStyle::getPrimitiveCount (SoGetPrimitiveCountAction * action) [virtual]

Action method for the SoGetPrimitiveCountAction.

Calculates the number of triangle, line segment and point primitives for the node and adds these to the counters of the action.

Nodes influencing how geometry nodes calculates their primitive count also overrides this method to change the relevant state variables.

Reimplemented from SoNode.

Author

Generated automatically by Doxygen for Coin from the source code.