FontStyle
Overview
FontStyle is an X3DFontStyleNode that defines the size, family, justification, and other styles used by Text nodes.
The FontStyle node belongs to the Text component and requires at least level 1, its default container field is fontStyle. It is available since VRML 2.0 and from X3D version 3.0 or higher.
Hierarchy
1
2
3
+ X3DNode
+ X3DFontStyleNode
+ FontStyle
Fields
SFNode [in, out] metadata NULL [X3DMetadataObject]
Information about this node can be contained in a MetadataBoolean, MetadataDouble, MetadataFloat, MetadataInteger, MetadataString or MetadataSet node.
Hint
SFString [in, out] language “”
Language codes consist of a primary code and a (possibly empty) series of subcodes. [ language-code = primary-code ( “-“ subcode )* ] Two-letter primary codes are reserved for language abbreviations. Two-letter primary codes include en (English), fr (French), de (German), it (Italian), nl (Dutch), el (Greek), es (Spanish), pt (Portuguese), ar (Arabic), he (Hebrew), ru (Russian), zh (Chinese), ja (Japanese), hi (Hindi), ur (Urdu), and sa (Sanskrit). Any two-letter subcode is understood to be a country code.
Hints
- See ISO639.2 Codes for the Representation of Names of Languages
- See RFC3066 Tags for the Identification of Languages
- See ISO3166 or
- Relates to Internationalization (i18n)
- AccessType relaxed to inputOutput in order to support animation and user accessibility.
Warning
- Do not wrap extra quotation marks around these SFString enumeration values, since “quotation” “marks” are only used for MFString values.
MFString [in, out] family “SERIF” String or [URI]
Array of quoted font family names in preference order, browsers use the first supported family.
Hints
- Example family array might be “Times” “SERIF”
- Values with guaranteed support include “SERIF” “SANS” “TYPEWRITER”.
- SERIF and SANS are variable-width fonts (for example, Times Roman and Arial).
- TYPEWRITER is a fixed-width font (for example, Courier).
- MFString arrays can have multiple values, so “separate each individual string” “by using quote marks”.
- See 15.2.2.2 Font family and style for details.
- Relates to Internationalization (i18n)
- AccessType relaxed to inputOutput in order to support animation and user accessibility.
Warning
- Font family support often varies.
SFString [in, out] style “PLAIN” [“PLAIN”|”BOLD”|”ITALIC”|”BOLDITALIC”|””]
Pick one of four values for text style (PLAIN or BOLD or ITALIC or BOLDITALIC).
Hints
- See 15.2.2.2 Font family and style for details.
- Overlapping functionality with CSS style attribute provides a “best of both worlds” approach. The style attribute provides an inline block of CSS source for element styling, reserved for use by Cascading Style Sheets (CSS) and XML stylesheets.
- X3D Architecture Annex L, HTML authoring guidelines, CSS considerations
- W3C Cascading Style Sheets
- CSS Snapshot
- Https://www.w3.org/TR/css-style-attr
- Wikibooks, XML - Managing Data Exchange/XSLT and Style Sheets
- AccessType relaxed to inputOutput in order to support animation and user accessibility.
Warnings
- Overloaded name for CSS style attribute.
- Do not wrap extra quotation marks around these SFString enumeration values, since “quotation” “marks” are only used for MFString values.
SFFloat [in, out] size 1 (0,∞)
Nominal height (in local coordinate system) of text glyphs, also sets default spacing between adjacent lines of text.
Hint
- AccessType relaxed to inputOutput in order to support animation and user accessibility.
SFFloat [in, out] spacing 1 [0,∞)
Adjustment factor for line spacing between adjacent lines of text.
Hint
- AccessType relaxed to inputOutput in order to support animation and user accessibility.
SFBool [in, out] horizontal TRUE
Whether text direction is horizontal (true) or vertical (false).
Hints
- See 15.2.2.3 Direction and justification for details.
- Relates to Internationalization (i18n)
- AccessType relaxed to inputOutput in order to support animation and user accessibility.
SFBool [in, out] leftToRight TRUE
Whether text direction is left-to-right (true) or right-to-left (false).
Hints
- See 15.2.2.3 Direction and justification for details.
- Relates to Internationalization (i18n)
- AccessType relaxed to inputOutput in order to support animation and user accessibility.
SFBool [in, out] topToBottom TRUE
Whether text direction is top-to-bottom (true) or bottom-to-top (false).
Hints
- See 15.2.2.3 Direction and justification for details.
- Relates to Internationalization (i18n)
- AccessType relaxed to inputOutput in order to support animation and user accessibility.
MFString [in, out] justify “BEGIN” [“BEGIN”, “END”, “FIRST”, “MIDDLE”, “”]
The justify field determines horizontal and vertical alignment of text layout, relative to the origin of the object coordinate system.
Hints
- Preferred value is usually justify=’ “MIDDLE” “MIDDLE” ‘ for centered justification horizontally and vertically.
- MFString arrays can have multiple values, so “separate each individual string” “by using quote marks”.
- See 15.2.2.3 Direction and justification for details.
- AccessType relaxed to inputOutput in order to support animation and user accessibility.
Warnings
- Exactly two string values are provided for major and minor axis alignment.
- Do not use illegal values such as LEFT RIGHT TOP BOTTOM or CENTER.
Supported File Formats
It is possible to specify in the family field a URL of a custom font file of the following types:
Encoding | File Extension | MIME Type |
---|---|---|
Open Type | .otf | application/x-font-opentype |
True Type | .ttf | application/x-font-truetype |
WOFF | .woff | application/x-font-woff |
Advice
Hints
- Full internationalization (i18n) and localization (l10n) features are available for any written language.
- DEF/USE copies of a single node can provide a similar “look + feel” style for related shapes.
- Relates to Internationalization (i18n)
- First add a Text node as a parent node for FontStyle.
- Wikipedia
- Wikipedia