H3D::FontStyle Class Reference
[X3D node classes.]

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. More...

#include <H3D/FontStyle.h>

Inheritance diagram for H3D::FontStyle:

Inheritance graph

List of all members.

Classes

class  InvalidFontStyleJustify
 Thrown when the strings in the justify field are invalid values. More...
class  InvalidFontStyleRenderType
 Thrown when the strings in the renderType field are invalid values. More...
class  InvalidFontStyleStyle
 Thrown when the string in the style field is an invalid value. More...

Public Member Functions

 FontStyle (Inst< SFNode > _metadata=0, Inst< MFString > _family=0, Inst< SFBool > _horizontal=0, Inst< MFString > _justify=0, Inst< SFString > _language=0, Inst< SFBool > _leftToRight=0, Inst< SFFloat > _size=0, Inst< SFFloat > _spacing=0, Inst< SFString > _style=0, Inst< SFBool > _topToBottom=0, Inst< SFString > _renderType=0)
 Constructor.
virtual void buildFonts ()
 Build Character instances for all characters that will be allowed for use by this font node.
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.
virtual Alignment getAlignment ()
 Gets the alignment of the text.
virtual void renderChar (unsigned char c)
 Render the character.
virtual H3DFloat ascender ()
 Returns how many metres in the the positive y-direction from the origin the characters of this font use.
virtual H3DFloat descender ()
 Returns how many metres in the the negative y-direction from the origin the characters of this font use.
virtual Vec3f charDimensions (unsigned char c)
 Get the bounding box dimensions of the 3d-representation of the given character.
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.

Public Attributes

auto_ptr< MFStringfamily
 The family field contains a case-sensitive MFString value that specifies a sequence of font family names in preference order.
auto_ptr< SFBoolhorizontal
 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).
auto_ptr< MFStringjustify
 The justify field determines alignment of the above text layout relative to the origin of the object coordinate system.
auto_ptr< SFStringlanguage
 The language field specifies the context of the language for the text string in the form of a language and a country in which that language is used.
auto_ptr< SFBoolleftToRight
 The leftToRight field indicate direction of text advance in the major (characters within a single string) or minor (successive strings) axes of layout depending on the value of the horizontal field.
auto_ptr< SFFloatsize
 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.
auto_ptr< SFFloatspacing
 The spacing field determines the line spacing between adjacent lines of text.
auto_ptr< SFStringstyle
 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.
auto_ptr< SFBooltopToBottom
 The topToBottom field indicate direction of text advance in the major (characters within a single string) or minor (successive strings) axes of layout depending on the value of the horizontal field.
auto_ptr< SFStringrenderType
 The renderType field is H3D API specific and specifies which way the font will be rendered.

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.

Protected Attributes

FTFont * font
 FTGL container class for all glyphs in the current font, used to measure bounding boxes, render, advance, etc.


Detailed Description

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 Text 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 family field contains a case-sensitive MFString value that specifies a sequence of font family names in preference order. The MFString value is searched 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. "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"]. Any font family may be specified as shown in the following example of the specification of a font family:

 ["Lucida Sans Typewriter", "Lucida Sans", "Helvetica", "SANS"]
In this example, the browser would first look for the font family "Lucida Sans Typewriter" on the system on which the browser is operating. If that is not available, the browser looks for "Lucida Sans". If that is not available, the browser looks for "Helvetica". If that is not available, the browser looks for any sans-serif font. If there are not sans-serif fonts installed, the browser will use any serif font (the default). It is the responsibility of the author that a suitable list of font families be specified so that the desired appearance is achieved in most operating environments. However, the author should always be willing to accept that the requested font families may not be available resulting in the use of a browser-selected "SERIF" font being used.

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".

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. Note that the direction specification overrides any modes inherent in a particular language.

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. 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".

The language field specifies the context of the language for the text string in the form of a language and a country in which that language is used. This field is not used by H3DApi.

The renderType field is H3D API specific and specifies which way the font will be rendered. Possible values are "TEXTURE", "POLYGON" and "OUTLINE". "TEXTURE" will use texture maps to render the font, "POLYGON" will create a polygon model for each character and render it and "OUTLINE" will render the outlines for each character.


Member Function Documentation

virtual H3DFloat H3D::FontStyle::ascender (  )  [inline, virtual]

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

Reimplemented from H3D::X3DFontStyleNode.

void FontStyle::buildFonts (  )  [virtual]

Build Character instances for all characters that will be allowed for use by this font node.

For Windows wglUseFontOutlines will be used to generate polygon versions of the characters of the font.

Reimplemented from H3D::X3DFontStyleNode.

References H3D::X3DFontStyleNode::fonts_built, H3D_FULL_LOCATION, and renderType.

virtual Vec3f H3D::FontStyle::charDimensions ( unsigned char  c  )  [inline, virtual]

Get the bounding box dimensions of the 3d-representation of the given character.

Reimplemented from H3D::X3DFontStyleNode.

virtual H3DFloat H3D::FontStyle::descender (  )  [inline, virtual]

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

Reimplemented from H3D::X3DFontStyleNode.

virtual H3DFloat H3D::FontStyle::getSpacing (  )  [inline, virtual]

Returns the spacing between lines of text.

See FontStyle for more details.

Reimplemented from H3D::X3DFontStyleNode.

virtual bool H3D::FontStyle::isLeftToRight (  )  [inline, virtual]

Returns true if the text should be rendered from left to right, false otherwise.

Reimplemented from H3D::X3DFontStyleNode.

virtual bool H3D::FontStyle::isTopToBottom (  )  [inline, virtual]

Returns true if the text should be rendered from top to bottom, false otherwise.

Reimplemented from H3D::X3DFontStyleNode.


Member Data Documentation

The family field contains a case-sensitive MFString value that specifies a sequence of font family names in preference order.

See the detailed desription for details.

Access type: initializeOnly
Default value: ["SERIF"]

FTFont* H3D::FontStyle::font [protected]

FTGL container class for all glyphs in the current font, used to measure bounding boxes, render, advance, etc.

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

Access type: initializeOnly
Default value: TRUE

Referenced by FontStyle().

The justify field determines alignment of the above text layout relative to the origin of the object coordinate system.

See the detailed desription for details.

Access type: initializeOnly
Default value: ["BEGIN"]
Value range: "BEGIN", "FIRST", "MIDDLE" or "END"

Referenced by FontStyle(), getMajorJustification(), and getMinorJustification().

The language field specifies the context of the language for the text string in the form of a language and a country in which that language is used.

This field is not used by H3DApi.

Access type: initializeOnly

The leftToRight field indicate direction of text advance in the major (characters within a single string) or minor (successive strings) axes of layout depending on the value of the horizontal field.

See detailed description for details.

Access type: initializeOnly
Default value: TRUE

Referenced by FontStyle().

The renderType field is H3D API specific and specifies which way the font will be rendered.

Possible values are "TEXTURE", "POLYGON" and "OUTLINE". "TEXTURE" will use texture maps to render the font, "POLYGON" will create a polygon model for each character and render it and "OUTLINE" will render the outlines for each character. Access type: initializeOnly
Default value: "TEXTURE"
Value range: "TEXTURE", "POLYGON" or "OUTLINE"

Referenced by buildFonts(), and FontStyle().

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.

Access type: initializeOnly
Default value: 1
Value range: >0

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.

Access type: initializeOnly
Default value: 1
Value range: >0

Referenced by FontStyle().

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".

Access type: initializeOnly
Default value: "PLAIN"
Value range: "PLAIN", "BOLD", "ITALIC" or "BOLDITALIC"

The topToBottom field indicate direction of text advance in the major (characters within a single string) or minor (successive strings) axes of layout depending on the value of the horizontal field.

See detailed description for details.

Access type: initializeOnly
Default value: TRUE

Referenced by FontStyle().


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

Generated on Fri Nov 7 10:30:07 2008 for H3D API by  doxygen 1.5.7