Home Hierarchy Members Alphabetical Related Pages

FontStyle Class Reference
[Standard Node Types]

#include <fontstyle.h>

Inherits Node.

Inheritance diagram for FontStyle:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 FontStyle (const char *name="")
virtual ~FontStyle ()
virtual unsigned int nbFields () const
virtual FieldHandle field (const std::string &n)
virtual FieldHandle field (const unsigned int i)
virtual bool isSetToDefaultValue (const unsigned int i) const
virtual unsigned int nbEventsIn () const
virtual EventInHandle eventIn (const std::string &n)
virtual EventInHandle eventIn (const unsigned int i)
virtual unsigned int nbEventsOut () const
virtual EventOutHandle eventOut (const std::string &n)
virtual EventOutHandle eventOut (const unsigned int i)
const char * typeName () const
virtual Nodeduplicate () const
virtual Nodeduplicate (std::map< const Node *, Node * > &) const

Public Attributes

Fields
A property or attribute of a node. Each node type has a fixed set of fields. Fields may contain various kinds of data and one or many values. Each field has a default value.

MFString family
SFBool horizontal
MFString justify
SFString language
SFBool leftToRight
SFFloat size
SFFloat spacing
SFString style
SFBool topToBottom

Detailed Description

Here is the documentation for this node type, from the ISO standard.

+6.22 FontStyle

6.22.1 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 6.47, 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 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

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

6.22.3 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 describe the behaviour in terms of which portion of the text is at the origin

Table 6.2 -- Major Alignment, horizontal= TRUE

justify 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  Centred about X-axis  Centred about X-axis
 END  Right edge of each line  Left edge of each line



Table 6.3 -- Major Alignment, horizontal = FALSE

justify 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  Centred about Y-axis  Centre about Y-axis
 END  Bottom edge of each line  Top edge of each line



Table 6.4 -- Minor Alignment, horizontal = TRUE

justify 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  Centred about Y-axis  Centred about Y-axis
 END  Bottom edge of last line   Top edge of last line



Table 6.5 -- Minor Alignment, horizontal = FALSE

justify 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  Centred about X-axis  Centred 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 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.

Key for Tables 6.6 and 6.7
Figure 6.8 -- Key for Tables 6.6 and 6.7


Table 6.6 -- horizontal = TRUE

horizontal = TRUE


Table 6.7 -- horizontal = FALSE

horizontal = FALSE


6.22.4 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] 2.[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 2, Normative references, for more information on RFC 1766 (2.[1766]), ISO/IEC 10646:1993 (2.[UTF8]), ISO/IEC 639:1998 (2.[I639]), and ISO 3166:1993 (2.[I3166]).


Constructor & Destructor Documentation

FontStyle const char *  name = ""  ) 
 

Construct a node with all its fields set to default value, which is equivalent to the code below:

  horizontal = true;
  
  language = string("");
  leftToRight = true;
  size = 1;
  spacing = 1;
  style = string("PLAIN");
  topToBottom = true;

~FontStyle  )  [virtual]
 

Virtual destructor, does nothing


Member Function Documentation

wrl::Node * duplicate std::map< const Node *, Node * > &   )  const [virtual]
 

Implements Node.

wrl::Node * duplicate  )  const [virtual]
 

Returns a deep copy of this node, that is a fully independant node with all children (if any) also copied. This is mainly useful for instanciating protos.

Implements Node.

wrl::Node::EventInHandle eventIn const unsigned int  i  )  [virtual]
 

Return a handle on the i th event in of the node or a "unknown" typed handle if there is no such node. emarks This class has no eventIn. This function is useful, with nbEventsIn() if you want to traverse all events in of a Node.

Implements Node.

wrl::Node::EventInHandle eventIn const std::string &  n  )  [virtual]
 

Return a handle on the event in named n of the node or a "unknown" typed handle if there is no such event. Valid names are:

Implements Node.

wrl::Node::EventOutHandle eventOut const unsigned int  i  )  [virtual]
 

Return a handle on the i th event out of the node or a "unknown" typed handle if there is no such node. Here is how i is related to fields: This function is useful, with nbEventsOut() if you want to traverse all events in of a Node.

Implements Node.

wrl::Node::EventOutHandle eventOut const std::string &  n  )  [virtual]
 

Return a handle on the event out named n of the node or a "unknown" typed handle if there is no such event. Valid names are:

Implements Node.

wrl::Node::FieldHandle field const unsigned int  n  )  [virtual]
 

Return a handle on the i th field of the node or a "unknown" typed handle if there is no such node. Here is how i is related to fields:

  • 0 : family
  • 1 : horizontal
  • 2 : justify
  • 3 : language
  • 4 : leftToRight
  • 5 : size
  • 6 : spacing
  • 7 : style
  • 8 : topToBottom This function is useful, with nbFields() if you want to traverse all fields of a Node.

Implements Node.

wrl::Node::FieldHandle field const std::string &  n  )  [virtual]
 

Return a handle on the field named n of the node or a "unknown" typed handle if there is no such field. Valid names are:

  • family
  • horizontal
  • justify
  • language
  • leftToRight
  • size
  • spacing
  • style
  • topToBottom

Implements Node.

bool isSetToDefaultValue const unsigned int  i  )  const [virtual]
 

Implements Node.

unsigned int nbEventsIn  )  const [inline, virtual]
 

Returns the number of events in for this node type.

Implements Node.

unsigned int nbEventsOut  )  const [inline, virtual]
 

Returns the number of events out for this node type.

Implements Node.

unsigned int nbFields  )  const [inline, virtual]
 

Returns the number of fields (exposed or not) for this node type.

Implements Node.

const char * typeName  )  const [inline, virtual]
 

Returns "FontStyle". Useful for printing.

Implements Node.


Member Data Documentation

MFString family
 

See Detailed Description for meaning of this field. Default value is set to

SFBool horizontal
 

See Detailed Description for meaning of this field. Default value is set to

       horizontal = true;

MFString justify
 

See Detailed Description for meaning of this field. Default value is set to

SFString language
 

See Detailed Description for meaning of this field. Default value is set to

       language = string("");

SFBool leftToRight
 

See Detailed Description for meaning of this field. Default value is set to

       leftToRight = true;

SFFloat size
 

See Detailed Description for meaning of this field. Default value is set to

       size = 1;

SFFloat spacing
 

See Detailed Description for meaning of this field. Default value is set to

       spacing = 1;

SFString style
 

See Detailed Description for meaning of this field. Default value is set to

       style = string("PLAIN");

SFBool topToBottom
 

See Detailed Description for meaning of this field. Default value is set to

       topToBottom = true;


Generated on 24 Feb 2005 with doxygen version 1.3.9.1. Valid HTML 4.0! Valid CSS!