Specifies font size, family, style, etc. More...
#include <Inventor/VRMLnodes/SoVRMLFontStyle.h>
Public Types | |
enum | Family { SERIF, SANS, TYPEWRITER } |
enum | Style { PLAIN = 0, BOLD = 0x1, ITALIC = 0x2, BOLDITALIC = 0x3 } |
Public Member Functions | |
virtual SoType | getTypeId () const |
SoVRMLFontStyle () | |
SbString | getFontName () |
Static Public Member Functions | |
static SoType | getClassTypeId () |
Public Attributes | |
SoSFFloat | size |
SoMFString | family |
SoSFString | style |
SoSFBool | horizontal |
SoSFBool | leftToRight |
SoSFBool | topToBottom |
SoSFString | language |
SoMFString | justify |
SoSFFloat | spacing |
The SoVRMLFontStyle node defines the size, font family, and style of text's font, as well as the direction of the text strings and any specific language rendering techniques that must be used for non-English text. See SoVRMLText node for application of SoVRMLFontStyle.
NOTE: This class does not exist in Open Inventor 10.0 and later.The size field specifies the height (in object space units) of glyphs rendered and determines the spacing of adjacent lines of text. All subsequent strings advance in Y by -(size * spacing). Only horizontal text is supported in this release.
Font attributes are defined with the family and style fields.
The family field specifies a case-sensitive MFString value that may be "SERIF" (the default) for a serif font such as Times Roman; "SANS" for a sans-serif font such as Helvetica; or "TYPEWRITER" for a fixed-pitch font such as Courier. A family value of empty quotes, "", 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. A style value of empty quotes, \"\", is identical to "PLAIN".
The horizontal, leftToRight, and topToBottom fields indicate the direction of the text. NOTE: Only horizontal text drawn leftToRight is supported in this release. Characters on each line of text advance in the positive X direction according to their natural advance width. Then each line of characters is advanced in the negative Y direction.
The justify field determines alignment of the above text layout relative to the origin of the object coordinate system. It 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. NOTE: Only the major axis alignment is supported in this release. An empty justify value is equivalent to the default values.
The major alignment is along the X axis. The possible values for each enumerant of the justify field are "BEGIN", "MIDDLE", and "END". Each line of text is positioned individually according to the alignment enumerant.
This section may reference portions of the VRML97 specification that are not present in this help file. The complete VRML97 spec is available at http://www.web3d.org .
The SoVRMLFontStyle node defines the size, font family, and style of text's font, as well as the direction of the text strings and any specific language rendering techniques that must be used for non-English text. See SoVRMLText node for application of SoVRMLFontStyle.
The size field specifies the height (in object space units) of glyphs rendered and determines the spacing of adjacent lines of text. All subsequent strings advance in either X or Y by -(size * spacing).
Font Family and Style
Font attributes are defined with the family and style fields. It is up to the browser to assign specific fonts to the various attribute combinations.
The family field specifies a case-sensitve MFString value that may be "SERIF" (the default) for a serif font such as Times Roman; "SANS" for a sans-serif font such as Helvetica; or "TYPEWRITER" for a fixed-pitch font such as Courier. A family value of empty quotes, "", 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. A style value of empty quotes, "", is identical to "PLAIN".
Direction, Justification and Spacing
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. Then 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. Then 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. It 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. A justify value of "" is equivalent to the default values. If the second string, minor alignment, is not specified then it 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. The following tables describe the behavior in terms of which portion of the text is at the origin:
Major Alignment, horizontal = TRUE:
Enumerant | leftToRight = TRUE | leftToRight = FALSE |
FIRST | Left edge of each line | Right edge of each line |
BEGIN | Left edge of each line | Right edge of each line |
MIDDLE | Centered about X-axis | Centered about X-axis |
END | Right edge of each line | Left edge of each line |
Major Alignment, horizontal = FALSE:
Enumerant | topToBottom = TRUE | topToBottom = FALSE |
FIRST | Top edge of each line | Bottom edge of each line |
BEGIN | Top edge of each line | Bottom edge of each line |
MIDDLE | Centered about Y-axis | Center about Y-axis |
END | Bottom edge of each line | Top edge of each line |
Minor Alignment, horizontal = TRUE:
Enumerant | topToBottom = TRUE | topToBottom = FALSE |
FIRST | Baseline of first line | Baseline of first line |
BEGIN | Top edge of first line | Bottom edge of first line |
MIDDLE | Centered about Y-axis | Centered about Y-axis |
END | Bottom edge of last line | Top edge of last line |
Minor Alignment, horizontal = FALSE:
Enumerant | leftToRight = TRUE | leftToRight = FALSE |
FIRST | Left edge of first line | Right edge of first line |
BEGIN | Left edge of first line | Right edge of first line |
MIDDLE | Centered about X-axis | Centered about X-axis |
END | Right edge of last line | Left edge of last line |
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 the following tables, each small cross indicates where the X and Y axes should be in relation to the text:
horizontal = TRUE:
horizontal = FALSE:
The language field specifies the context of the language for the text string. Due to the multilingual nature of the ISO 10646-1:1993, the language field is needed to provide a proper language attribute of the text string. The format is based on the POSIX locale specification as well as the RFC 1766: language[_territory]. The values for the language tag is based on the ISO 639, i.e., zh for Chinese, jp for Japanese, sc for Swedish. The territory tag is based on the ISO 3166 country code, i.e., TW is for Taiwan and CN for China for the "zh" Chinese language tag. If the language field is set to empty "", then local language bindings are used.
Please refer to these sites for more details: http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_639.html http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_3166.html
family | "SERIF" |
horizontal | TRUE |
justify | "BEGIN" |
language | "" |
leftToRight | TRUE |
size | 1.0 |
spacing | 1.0 |
style | "PLAIN" |
topToBottom | TRUE |
metadata | NULL |
SoSFNode | set_metadata |
SoSFNode | metadata_changed |
SoVRMLFontStyle::SoVRMLFontStyle | ( | ) |
Constructor.
static SoType SoVRMLFontStyle::getClassTypeId | ( | ) | [static] |
Returns the type identifier for this class.
Reimplemented from SoVRMLNode.
SbString SoVRMLFontStyle::getFontName | ( | ) |
Return the font name used by this node based on the settings of family and style.
virtual SoType SoVRMLFontStyle::getTypeId | ( | ) | const [virtual] |
Returns the type identifier for this specific instance.
Reimplemented from SoVRMLNode.
Specifies the family of font to use.
NOTE: Although it is possible to specify multiple font families, only the first font family is used.
Characters advance in the X direction if TRUE.
This release supports TRUE only.
Indicates placement and alignment of strings.
With LEFT justification, the left edge of the first line is at the (transformed) origin, and all left edges are aligned. RIGHT justification is similar. CENTER justification places the center of the first string at the (transformed) origin, with the centers of all remaining strings aligned under it. The second justify string, FIRST, is not supported in this release.
(Note: Not implemented) Language-specific rendering techniques used for non-English text.
Characters advance in the positive X direction if TRUE.
This release supports TRUE only.
Specifies the height of glyphs rendered and helps determine the spacing of adjacent lines.
Specifies the distance (in the negative y direction) between the base points of successive strings, measured with respect to the current font height.
A value of 1 indicates single spacing, a value of 2 indicates double spacing, and so on.
Defines style modification to the chosen font (bold, italic, etc.
).
(Note: Not implemented) Default value of FALSE is used.