Coin
4.0.3
Coin3D core library
|
The SoVRMLFontStyle class is used to define the current font. More...
#include <Inventor/VRMLnodes/SoVRMLFontStyle.h>
Public Types | |
enum | Family { SERIF , SANS , TYPEWRITER } |
enum | Style { PLAIN = 0x0 , BOLD = 0x1 , ITALIC = 0x2 , BOLDITALIC = 0x3 } |
Public Types inherited from SoNode | |
enum | NodeType { INVENTOR = 0x0000 , VRML1 = 0x0001 , VRML2 = 0x0002 , INVENTOR_1 = 0x0004 , INVENTOR_2_0 = 0x0008 , INVENTOR_2_1 = 0x0010 , INVENTOR_2_5 = 0x0020 , INVENTOR_2_6 = 0x0040 , COIN_1_0 = 0x0080 , COIN_2_0 = 0x0100 , EXTENSION = 0x0200 , COIN_2_2 = 0x0400 , COIN_2_3 = 0x0800 , COIN_2_4 = 0x1000 , INVENTOR_5_0 = 0x2000 , COIN_2_5 = 0x4000 , COIN_3_0 = 0x8000 , INVENTOR_6_0 = 0x10000 , COIN_4_0 = 0x20000 } |
Public Attributes | |
SoMFString | family |
SoSFBool | horizontal |
SoMFString | justify |
SoSFString | language |
SoSFBool | leftToRight |
SoSFFloat | size |
SoSFFloat | spacing |
SoMFString | style |
SoSFBool | topToBottom |
Protected Member Functions | |
virtual | ~SoVRMLFontStyle () |
virtual const SoFieldData * | getFieldData (void) const |
Protected Member Functions inherited from SoNode | |
SoNode (void) | |
virtual | ~SoNode () |
virtual SbBool | readInstance (SoInput *in, unsigned short flags) |
Protected Member Functions inherited from SoFieldContainer | |
SoFieldContainer (void) | |
virtual | ~SoFieldContainer () |
Protected Member Functions inherited from SoBase | |
SoBase (void) | |
virtual | ~SoBase () |
virtual SoNotRec | createNotRec (void) |
virtual void | destroy (void) |
virtual const char * | getFileFormatName (void) const |
SbBool | hasMultipleWriteRefs (void) const |
void | writeFooter (SoOutput *out) const |
SbBool | writeHeader (SoOutput *out, SbBool isgroup, SbBool isengine) const |
Static Protected Member Functions | |
static const SoFieldData ** | getFieldDataPtr (void) |
Static Protected Member Functions inherited from SoNode | |
static const SoFieldData ** | getFieldDataPtr (void) |
static int | getNextActionMethodIndex (void) |
static void | incNextActionMethodIndex (void) |
static void | setCompatibilityTypes (const SoType &nodetype, const uint32_t bitmask) |
static void | setNextActionMethodIndex (int index) |
Static Protected Member Functions inherited from SoBase | |
static uint32_t | getCurrentWriteCounter (void) |
static void | staticDataLock (void) |
static void | staticDataUnlock (void) |
Additional Inherited Members | |
Protected Types inherited from SoBase | |
enum | BaseFlags { IS_ENGINE = 0x01 , IS_GROUP = 0x02 } |
Protected Attributes inherited from SoNode | |
SbUniqueId | uniqueId |
Protected Attributes inherited from SoFieldContainer | |
SbBool | isBuiltIn |
Static Protected Attributes inherited from SoNode | |
static int | nextActionMethodIndex = 0 |
static SbUniqueId | nextUniqueId = 1 |
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 }
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
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/documents/specifications/14772/V2.0/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.
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/documents/specifications/14772/V2.0/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/documents/specifications/14772/V2.0/part1/references.html, for more information on RFC 1766 <http://www.web3d.org/documents/specifications/14772/V2.0/part1/references.html#[1766]>, ISO/IEC 10646:1993 <http://www.web3d.org/documents/specifications/14772/V2.0/part1/references.html#[UTF8]>, ISO/IEC 639:1998 <http://www.web3d.org/documents/specifications/14772/V2.0/part1/references.html#[I639]>, and ISO 3166:1993 <http://www.web3d.org/documents/specifications/14772/V2.0/part1/references.html#[I3166]>.
SoVRMLFontStyle::SoVRMLFontStyle | ( | void | ) |
Constructor.
|
protectedvirtual |
Destructor.
|
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.
This function performs the typical operation of a node for any action.
Reimplemented from SoNode.
|
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 calculate their bounding box also override this method to change the relevant state variables.
Reimplemented from SoNode.
SoSFFloat SoVRMLFontStyle::size Size of font.
SoMFString SoVRMLFontStyle::family Font family. All browsers must support "SANS", "SERIF" and "TYPEWRITER". Default value is "SERIF".
SoMFString SoVRMLFontStyle::style Font style. Can be one of "PLAIN", "BOLD", "ITALIC" or "BOLDITALIC". Default value is "PLAIN".
SoSFBool SoVRMLFontStyle::horizontal TRUE if strings should be rendered horizontally. Default value is TRUE.
SoSFBool SoVRMLFontStyle::leftToRight TRUE if strings should be rendered left to right. Default value is TRUE.
SoSFBool SoVRMLFontStyle::topToBottom True if strings should be rendered top to bottom. Default value is TRUE.
SoSFString SoVRMLFontStyle::language Text language. Empty by default.
SoMFString SoVRMLFontStyle::justify Text justification. Can be "BEGIN", "FIRST" "MIDDLE" or "END". Default value is "BEGIN".
SoSFFloat SoVRMLFontStyle::spacing Spacing constant. Default value is 1.0.
This static method returns the SoType object associated with objects of this class.
|
protectedvirtual |
Returns a pointer to the class-wide field data storage object for this instance. If no fields are present, returns NULL
.
Reimplemented from SoFieldContainer.
|
staticprotected |
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.
Returns the SoFieldData class which holds information about fields in this node.
|
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 calculate their primitive count also override this method to change the relevant state variables.
Reimplemented from SoNode.
|
virtual |
Action method for the SoGLRenderAction.
This is called during rendering traversals. Nodes influencing the rendering state in any way or want to throw geometry primitives at OpenGL override this method.
Reimplemented from SoNode.
|
virtual |
Action method for SoPickAction.
Does common processing for SoPickAction action instances.
Reimplemented from SoNode.