20 Fonts


Contents


 

20.1 Introduction

Reliable delivery of fonts is considered a critical requirement for SVG. Designers require the ability to create SVG graphics with whatever fonts they care to use and then have the same fonts appear in the end user's browser when viewing an SVG drawing, even if the given end user hasn't purchased the fonts in question. This parallels the print world, where the designer uses a given font when authoring a drawing for print, but when the end user views the same drawing within a magazine the text appears with the correct font.

SVG utilizes the Web font facility defined in the "Cascading Style Sheets (CSS) level 2" specification [CSS2] as a key mechanism for reliable delivery of font data to end users. A common scenario is that SVG authoring applications will generate compressed, subsetted Web fonts for all text elements used by a given SVG document fragment. Typically, the Web fonts will be saved in a location relative to the referencing document.

One disadvantage to the Webfont facility to date is that no particular font formats that were required to be supported. The result was that different implementations supported different Web font formats, thereby making it difficult for Web site creators to post a single Web site that is supported by a large percentage of installed browsers.

To provide a common font format that will exist in all conforming SVG user agents, SVG includes elements which allow for fonts to be defined in SVG.

SVG fonts can improve the semantic richness of graphics that represent text. For example, many company logos consist of the company name drawn artistically. In some cases, accessibility may be enhanced by expressing the logo as a series of glyphs in an SVG font and then rendering the logo as a 'text' element which references this font.

20.2 Overview of SVG fonts

An SVG font is a font defined using SVG's 'font' element.

The purpose of SVG fonts is to allow for delivery of glyph outlines in display-only environments. SVG fonts that accompany Web pages must be supported only in browsing and viewing situations. Graphics editing applications or file translation tools must not attempt to convert SVG fonts into system fonts. The intent is that SVG files be interchangeable between two content creators, but not the SVG fonts that might accompany these SVG files. Instead, each content creator will need to license the given font before being able to successfully edit the SVG file. The font-face-name element indicates the name of licensed font to use for editing.

SVG fonts contain unhinted font outlines. Because of this, on many implementations there will be limitations regarding the quality and legibility of text in small font sizes. For increased quality and legibility in small font sizes, content creators may want to use an alternate font technology, such as fonts that ship with operating systems or an alternate Web font format.

Because SVG fonts are expressed using SVG elements and attributes, in some cases the SVG font will take up more space than if the font were expressed in a different Web font format which was especially designed for compact expression of font data. For the fastest delivery of Web pages, content creators may want to use an alternate font technology.

A key value of SVG fonts is guaranteed availability in SVG user agents. In some situations, it might be appropriate for an SVG font to be the first choice for rendering some text. In other situations, the SVG font might be an alternate, back-up font in case the first choice font (perhaps a hinted system font) is not available to a given user.

The characteristics and attributes of SVG fonts correspond closely to the font characteristics and parameters described in the "Cascading Style Sheets (CSS) level 2" specification [CSS2]. In this model, various font metrics, such as advance values and baseline locations, and the glyph outlines themselves, are expressed in units that are relative to an abstract square whose height is the intended distance between lines of type in the same type size. This square is called the em square and it is the design grid on which the glyph outlines are defined. The value of the units-per-em attribute on the 'font' element specifies how many units the em square is divided into. Common values for other font types are, for example, 250 (Intellifont), 1000 (Type 1) and 2048 (TrueType, TrueType GX and Open-Type). Unlike standard graphics in SVG, where the initial coordinate system has the y-axis pointing downward (see The initial coordinate system), the design grid for SVG fonts, along with the initial coordinate system for the glyphs, has the y-axis pointing upward for consistency with accepted industry practice for many popular font formats.

SVG fonts and their associated glyphs do not specify bounding box information. Because the glyph outlines are expressed as SVG graphics elements, the implementation has the option to render the glyphs either using standard graphics calls or by using special-purpose font rendering technology, in which case any necessary maximum bounding box and overhang calculations can be performed from analysis of the graphics elements contained within the glyph outlines.

An SVG font can be either embedded within the same document that uses the font or saved as part of an external resource.

Here is an example of how you might embed an SVG font inside of an SVG document.

<?xml version="1.0" standalone="yes"?>
<svg width="400px" height="300px"
  xmlns = 'http://www.w3.org/2000/svg'>
  <defs>
    <font id="Font1">
      <font-face font-family="Super Sans" font-weight="bold" font-style="normal"
          units-per-em="1000" cap-height="600" x-height="400"
          ascent="700" descent="300" horiz-adv-x="1000"
          baseline="0" centerline="350"
          mathline="350" ideographic="400" hanging="500"
          topline="700">
        <font-face-src>
          <font-face-name name="Super Sans Bold"/>
        </font-face-src>
      </font-face>
      <missing-glyph><path d="M0,0h200v200h-200z"/></missing-glyph>
      <glyph unicode="!" horiz-adv-x="300"><!-- Outline of exclam. pt. glyph --></glyph>
      <glyph unicode="@"><!-- Outline of @ glyph --></glyph>
      <!-- more glyphs -->
    </font>
  <text style="font-family: 'Super Sans', Helvetica, sans-serif;
                  font-weight: bold; font-style: normal">Text 
    using embedded font</text>
</svg>

Here is an example of how you might use the CSS @font-face facility to reference an SVG font which is saved in an external file. First referenced SVG font file:

<?xml version="1.0" standalone="yes"?>
<svg width="100%" height="100%"
 xmlns = 'http://www.w3.org/2000/svg'>
  <defs>
    <font id="Font2">
      <font-face font-family="Super Sans" font-weight="normal" font-style="italic"
          units-per-em="1000" cap-height="600" x-height="400"
          ascent="700" descent="300" horiz-adv-x="1000"
          baseline="0" centerline="350"
          mathline="350" ideographic="400" hanging="500"
          topline="700">
        <font-face-src>
          <font-face-name name="Super Sans Italic"/>
        </font-face-src>
      </font-face>
      <missing-glyph><path d="M0,0h200v200h-200z"/></missing-glyph>
      <glyph unicode="!" horiz-adv-x="300"><!-- Outline of exclam. pt. glyph --></glyph>
      <glyph unicode="@"><!-- Outline of @ glyph --></glyph>
      <!-- more glyphs -->
    </font>
  </defs>
</svg>

The SVG file which uses/references the above SVG font

<?xml version="1.0" standalone="yes"?>
<svg width="400px" height="300px"
 xmlns = 'http://www.w3.org/2000/svg'>  <defs>
    <style type="text/css">
      <![CDATA[
        @font-face {
          font-family: 'Super Sans'; 
          font-weight: normal;
          font-style: italic;
          src: url("myfont.svg#Font2") format(svg)
        }
      ]]>
   </style>
  </defs>
  <text style="font-family: 'Super Sans'; font-weight:normal;
                  font-style: italic">Text using embedded font</text>
</svg>

20.3 The 'font' element

The 'font' element defines an SVG font.

<!ENTITY % fontExt "" >
<!ELEMENT font (%descTitleMetadata;,font-face,
                   missing-glyph,(glyph|hkern|vkern %fontExt;)*) >
<!ATTLIST font
  %stdAttrs;
  externalResourcesRequired %Boolean; #IMPLIED
  class %ClassList; #IMPLIED
  style %StyleSheet; #IMPLIED
  %PresentationAttributes-All;
  horiz-origin-x %Number; #IMPLIED
  horiz-origin-y %Number; #IMPLIED
  horiz-adv-x %Number; #REQUIRED
  vert-origin-x %Number; #IMPLIED
  vert-origin-y %Number; #IMPLIED
  vert-adv-y %Number; #IMPLIED >

Attribute definitions:

horiz-origin-x = "<number>"
The X-coordinate in the font coordinate system of the origin of a glyph to be used when drawing horizontally oriented text. (Note that the origin applies to all glyphs in the font.)
If the attribute is not specified, the effect is as if a value of "0" were specified.
Animatable: no.
horiz-origin-y = "<number>"
The Y-coordinate in the font coordinate system of the origin of a glyph to be used when drawing horizontally oriented text. (Note that the origin applies to all glyphs in the font.)
If the attribute is not specified, the effect is as if a value of "0" were specified.
Animatable: no.
horiz-adv-x = "<number>"
The default horizontal advance after rendering a glyph in horizontal orientation. Glyph widths are required to be non-negative, even if the glyph is typically rendered right-to-left, as in Hebrew and Arabic scripts.
If the attribute is not specified, the effect is as if a value equivalent of one em were specified (see units-per-em).
Animatable: no.
vert-origin-x = "<number>"
The X-coordinate in the font coordinate system of the origin of a glyph to be used when drawing vertically oriented text. (Note that the origin applies to all glyphs in the font.)
If the attribute is not specified, the effect is as if the attribute were set to half of the effective value of attribute horiz-adv-x.
Animatable: no.
vert-origin-y = "<number>"
The Y-coordinate in the font coordinate system of the origin of a glyph to be used when drawing vertically oriented text. (Note that the origin applies to all glyphs in the font.)
If the attribute is not specified, the effect is as if the attribute were set to the position specified by the font's ascent attribute.
Animatable: no.
vert-adv-y = "<number>"
The default vertical advance after rendering a glyph in vertical orientation.
If the attribute is not specified, the effect is as if the attribute were set to the sum of the values of attributes ascent and. descent.
If the attribute is not specified, the effect is as if a value equivalent of one em were specified (see units-per-em).
Animatable: no.

Attributes defined elsewhere:
%stdAttrs;, externalResourcesRequired, class, style, %PresentationAttributes-All;.

Each 'font' element must have a 'font-face' child element which describes various characteristics of the font.

20.4 The 'glyph' element

The 'glyph' element defines the graphics for a given glyph. The coordinate system for the glyph is defined by the various attributes in the 'font' element.

The graphics that make up the 'glyph' can be either a single path data specification within the d attribute or arbitrary SVG as content within the 'glyph'. These two alternatives are processed differently (see below).

<!ENTITY % glyphExt "" >
<!ELEMENT glyph (desc|title|metadata|defs|
                   path|text|rect|circle|ellipse|line|polyline|polygon|
                   use|image|svg|g|view|switch|a|altGlyphDef|
                   script|style|symbol|marker|clipPath|mask|
                   linearGradient|radialGradient|pattern|filter|cursor|font|
                   animate|set|animateMotion|animateColor|animateTransform|
                   color-profile|font-face
                   %glyphExt;)* >
<!ATTLIST glyph
  %stdAttrs;
  class %ClassList; #IMPLIED
  style %StyleSheet; #IMPLIED
  %PresentationAttributes-All;
  unicode CDATA #IMPLIED
  glyph-name CDATA #IMPLIED
  d %PathData; #IMPLIED
  vert-text-orient CDATA #IMPLIED
  arabic CDATA #IMPLIED
  han CDATA #IMPLIED
  horiz-adv-x %Number; #IMPLIED
  vert-adv-y %Number; #IMPLIED >

Attribute definitions:

unicode = "<string>"
One or more Unicode characters indicating the sequence of Unicode characters which corresponds to this glyph. If a character is provided, then this glyph corresponds to the given Unicode character. If multiple characters are provided, then this glyph corresponds to the given sequence of Unicode characters. One use of sequence of characters is for ligatures. For example, if unicode="ffl", then the given glyph will be used to render the sequence of characters "f", "f", and "l". (This could alternatively have been expressed using character entities, using XML character references expressed in hexadecimal notation: unicode="&#x66;&#x66;&#x6c;", or XML character references expressed in decimal notation: unicode="&#102;&#102;&#108;".) When determining the glyph(s) to draw a given character sequence, the 'font' element is searched from its first 'glyph' element to its last in logical order to see if the upcoming sequence of Unicode characters to be rendered match the sequence of Unicode characters specified in the unicode attribute for the given 'glyph' element. The first successful match is used. Thus, the "ffl" ligature need to be defined in the font before the "f" glyph; otherwise, the "ffl" will never be selected.

Note that any occurrences of 'altGlyph' take precedence over the glyph selection rules within an SVG font.
If the unicode attribute is not provided, then the only way to use this glyph is via an 'altGlyph' reference.
Animatable: no.
glyph-name = "<name> [, <name> ]* "
A name for the glyph. It is recommended that glyph names be unique within a font. The glyph names can be used in situations where Unicode character numbers do not provide sufficient information to access the correct glyph, such as when there are multiple glyphs per Unicode character. The glyph names can be referenced in kerning definitions.
Animatable: no.
d = "path data"
The definition of the outline of a glyph, using the same syntax as for the d attribute on a 'path' element. See Path data.
See below for a discussion of this attribute.
Animatable: no.
vert-text-orient = "default | h | v"
When drawing vertical text, indicates whether the given glyph is meant to be drawn with a vertical or horizontal orientation. The default value is vertOrient="default", which indicates that the Unicode character number determines the orientation of this glyph.
Animatable: no.
arabic = "initial | medial | terminal | isolated"
For Arabic glyphs, indicates which of the four possible forms this glyph represents.
Animatable: no.
han = "ja | zht | zhs | kor"
For glyphs in the Han range, indicates which of the four possible forms this glyph represents.
Animatable: no.
horiz-adv-x = "<number>"
The horizontal advance after rendering a glyph in horizontal orientation. The default value is the value of the font's horizAdvX attribute. Glyph widths are required to be non-negative, even if the glyph is typically rendered right-to-left, as in Hebrew and Arabic scripts.
Animatable: no.
vert-adv-y = "<number>"
The vertical advance after rendering a glyph in vertical orientation.
If the attribute is not specified, the effect is as if the attribute were set to the value of the font's vertAdvY attribute.
Animatable: no.

Attributes defined elsewhere:
%stdAttrs;, style, class, %PresentationAttributes-All;.

The graphics for the 'glyph' can be specified using either the d attribute or arbitrary SVG as content within the 'glyph'.

If the d attribute is specified, then the path data within this attribute is processed as follows:

If the 'glyph' has child elements, then those child elements are rendered in a manner similar to how the 'use' element renders a referenced symbol. The rendering effect is as if the contents of the referenced 'glyph' element were deeply cloned into a separate non-exposed DOM tree. Because the cloned DOM tree is non-exposed, the SVG DOM does not show the cloned instance.

For user agents that support Styling with CSS, the conceptual deep cloning of the referenced 'glyph' element into a non-exposed DOM tree also copies any property values resulting from the CSS cascade [CSS2-CASCADE] on the referenced 'glyph' and its contents, and also applies any property values on the 'font' element. CSS2 selectors can be applied to the original (i.e., referenced) elements because they are part of the formal document structure. CSS2 selectors cannot be applied to the (conceptually) cloned DOM tree because its contents are not part of the formal document structure.

Property inheritance, however, works as if the referenced 'glyph' had been textually included as a deeply cloned child within the document tree. The referenced 'glyph' inherits properties from the element that contains the characters that correspond to the 'glyph'. The 'glyph' does not inherit properties from the 'font' element's original parents.

In the generated content, for each instance of a given 'glyph', a 'g' is created which carries with it all property values resulting from the CSS cascade [CSS2-CASCADE] on the 'font' element for the referenced 'glyph'. Within this 'g' is another 'g' which carries with it all property values resulting from the CSS cascade [CSS2-CASCADE] on the 'glyph' element. The original contents of the 'glyph' element are deep-cloned within the inner 'g' element.

If the 'glyph' has both a d attribute and child elements, the d attribute is rendered first, and then the child elements.

In general, the d attribute renders in the same manner as system fonts. For example, a dashed pattern will usually look the same if applied to a system font or to an SVG font which defines its glyphs using the d attribute. Many implementations will be able to render glyphs defined with the d attribute quickly and will be able to use a font cache for further performance gains.

Defining a glyph by including child elements within the 'glyph' gives greater flexibility but more complexity. Different fill and stroke techniques can be used on different parts of the glyphs. For example, the base of an "i" could be red, and the dot could be blue. This approach has an inherent complexity with units. Any properties specified on a text elements which represents a length, such as the 'stroke-width' property, might produce surprising results since the length value will be processed in the coordinate system of the glyph.

20.5 The 'missing-glyph' element

The 'missing-glyph' element defines the graphics to use if there is an attempt to draw a glyph from a given font and the given glyph has not been defined. The attributes on the 'missing-glyph' element have the same meaning as the corresponding attributes on the 'glyph' element.

<!ENTITY % missing-glyphExt "" >
<!ELEMENT missing-glyph (desc|title|metadata|defs|
                   path|text|rect|circle|ellipse|line|polyline|polygon|
                   use|image|svg|g|view|switch|a|altGlyphDef|
                   script|style|symbol|marker|clipPath|mask|
                   linearGradient|radialGradient|pattern|filter|cursor|font|
                   animate|set|animateMotion|animateColor|animateTransform|
                   color-profile|font-face
                   %missing-glyphExt;)* >
<!ATTLIST missing-glyph
  %stdAttrs;
  class %ClassList; #IMPLIED
  style %StyleSheet; #IMPLIED
  %PresentationAttributes-All;
  d %PathData; #IMPLIED
  horiz-adv-x %Number; #IMPLIED
  vert-adv-y %Number; #IMPLIED >
Attributes defined elsewhere:
%stdAttrs;, class, style, %PresentationAttributes-All;, d, horiz-adv-x, vert-adv-y.

20.6 The 'hkern' and 'vkern' elements

The 'hkern' and 'vkern' elements define kerning pairs for horizontally-oriented and vertically-oriented pairs of glyphs, respectively.

Kern pairs identify pairs of glyphs within a single font whose inter-glyph spacing is adjusted when the pair of glyphs are rendered next to each other. In addition to the requirement that the pair of glyphs are from the same font, SVG font kerning happens only when the two glyphs correspond to characters which have the same values for properties 'font-family', 'font-size', 'font-style', 'font-weight', 'font-variant', 'font-stretch', 'font-size-adjust' and 'font'.

An example of a kerning pair are the letters "Va", where the typographic result might look better if the letters "V" and the "a" were rendered slightly closer together.

Right-to-left and bidirectional text in SVG is laid out in a two-step process, which is described in Relationship with bidirectionality. If SVG fonts are used, before kerning is applied, characters are re-ordered into left-to-right (or top-to-bottom, for vertical text) visual rendering order. Kerning from SVG fonts is then applied on pairs of glyphs which are rendered contiguously. The first glyph in the kerning pair is the left (or top) glyph in visual rendering order. The second glyph in the kerning pair is the right (or bottom) glyph in the pair.

For convenience to font designers and to minimize file sizes, a single 'hkern' and 'vkern' can define a single kerning adjustment value between one set of glyphs (e.g., a range of Unicode characters) and another set of glyphs (e.g., another range of Unicode characters).

The 'hkern' element defines kerning pairs and adjustment values in the horizontal advance value when drawing pairs of glyphs which the two glyphs are contiguous and are both rendered horizontally (i.e., side-by-side). The spacing between characters is reduced by the kerning adjustment. (Negative kerning adjustments increase the spacing between characters.)

<!ELEMENT hkern EMPTY >
<!ATTLIST hkern
  %stdAttrs;
  u1 CDATA #IMPLIED
  g1 CDATA #IMPLIED
  u2 CDATA #IMPLIED
  g2 CDATA #IMPLIED
  k %Number; #REQUIRED >

Attribute definitions:

u1 = "[<character> | <urange> ] [, [<character> | <urange>] ]* "
A sequence (comma-separated) of Unicode characters (refer to the description of the unicode attribute to the 'glyph' element for a description of how to express individual Unicode characters) and/or unicode ranges (see description of unicode ranges in [CSS2]) which identify a set of possible first glyphs in the kerning pair. If a given Unicode character within the set has multiple corresponding 'glyph' elements (i.e., there are multiple 'glyph' elements with the same unicode attribute value, but different glyphName values), then all such glyphs are included in the set. Comma is the separator character; thus, to kern a comma, specify the comma as part of a Unicode range or as a glyph name using the g1 attribute. The total set of possible first glyphs in the kerning pair is the union of glyphs specified by the u1 and g1 attributes.
Animatable: no.
g1 = "<name> [, <name> ]* "
A sequence (comma-separated) of glyph names (i.e., values that match glyphName attributes on 'glyph' elements) which identify a set of possible first glyphs in the kerning pair. All glyphs with the given glyph name are included in the set. The total set of possible first glyphs in the kerning pair is the union of glyphs specified by the u1 and g1 attributes.
Animatable: no.
u2 = "[<number> | <urange>] [, [<number> | <urange>] ]* "
Same as the u1 attribute, except that u2 specifies possible second glyphs in the kerning pair.
Animatable: no.
g2 = "<name> [, <name> ]* "
Same as the g1 attribute, except that g2 specifies possible second glyphs in the kerning pair.
Animatable: no.
k = "<number>"
The amount to decrease the spacing between the two glyphs in the kerning pair. The value is in the font coordinate system.
Animatable: no.

Attributes defined elsewhere:
%stdAttrs;.

At least one each of u1 or g1 and at least one of u2 or g2 must be provided.

The 'vkern' element defines kerning pairs and adjustment values in the vertical advance value when drawing pairs of glyphs together when stacked vertically. The spacing between characters is reduced by the kerning adjustment.

<!ELEMENT vkern EMPTY >
<!ATTLIST vkern
  %stdAttrs;
  u1 CDATA #IMPLIED
  g1 CDATA #IMPLIED
  u2 CDATA #IMPLIED
  g2 CDATA #IMPLIED
  k %Number; #REQUIRED >
Attributes defined elsewhere:
%stdAttrs;, u1, g1, u2, g2, k.

20.7 Describing a font


20.7.1 Overview of font descriptions

A font description provides the bridge between an author's font specification and the font data, which is the data needed to format text and to render the abstract glyphs to which the characters map - the actual scalable outlines or bitmaps. Fonts are referenced by properties, such as the 'font-family' property.

Each specified font description is added to the font database and so that it can be used to select the relevant font data. The font description contains descriptors such as the location of the font data on the Web, and characterizations of that font data. The font descriptors are also needed to match the font properties to particular font data. The level of detail of a font description can vary from just the name of the font up to a list of glyph widths.

For more about font descriptions, refer to the font chapter in the CSS2 specification [CSS2 Fonts].


20.7.2 Alternative ways for providing a font description

Font descriptions can be specified in either of the following ways:


20.7.3 The 'font-face' element

The 'font-face' element corresponds directly to the @font-face facility in CSS2. It can be used to describe the characteristics of any font, SVG font or otherwise.

When used to describe the characteristics of an SVG font contained within the same document, it is recommended that the 'font-face' element be a child of the 'font' element it is describing so that the 'font' element can be self-contained and fully-described. In this case, any 'font-face-src' elements within the 'font-face' element are ignored as it is assumed that the 'font-face' element is describing the characteristics of its parent 'font' element.

<!ELEMENT font-face (%descTitleMetadata;,font-face-src?,definition-src?) >
<!ATTLIST font-face 
  %stdAttrs;
  font-family CDATA #IMPLIED
  font-style CDATA #IMPLIED
  font-variant CDATA #IMPLIED
  font-weight CDATA #IMPLIED
  font-stretch CDATA #IMPLIED
  font-size CDATA #IMPLIED
  unicode-range CDATA #IMPLIED
  units-per-em %Number; #IMPLIED
  panose-1 CDATA #IMPLIED
  stemv %Number; #IMPLIED
  stemh %Number; #IMPLIED
  slope %Number; #IMPLIED
  cap-height %Number; #IMPLIED
  x-height %Number; #IMPLIED
  accent-height %Number; #IMPLIED
  ascent %Number; #IMPLIED
  descent %Number; #IMPLIED
  widths CDATA #IMPLIED
  bbox CDATA #IMPLIED
  ideographic %Number; #IMPLIED
  baseline %Number; #IMPLIED
  centerline %Number; #IMPLIED
  mathline %Number; #IMPLIED
  hanging %Number; #IMPLIED
  topline %Number; #IMPLIED
  underline-position %Number; #IMPLIED
  underline-thickness %Number; #IMPLIED
  strikethrough-position %Number; #IMPLIED
  strikethrough-thickness %Number; #IMPLIED
  overline-position %Number; #IMPLIED
  overline-thickness %Number; #IMPLIED >

Attribute definitions:

font-family = "<string>"
Same syntax and semantics as the 'font-family' descriptor within an @font-face rule.
Animatable: no.
font-style = "all | [ normal | italic | oblique] [, [normal | italic | oblique]]*"
Same syntax and semantics as the 'font-style' descriptor within an @font-face rule. The style of a font. Takes on the same values as the 'font-style' property, except that a comma-separated list is permitted.
If the attribute is not specified, the effect is as if a value of "all" were specified.
Animatable: no.
font-variant = "[normal | small-caps] [,[normal | small-caps]]*"
Same syntax and semantics as the 'font-variant' descriptor within an @font-face rule. Indication of whether this face is the small-caps variant of a font. Takes on the same values as the 'font-variant' property, except that a comma-separated list is permitted.
If the attribute is not specified, the effect is as if a value of "normal" were specified.
Animatable: no.
font-weight = "all | [normal | bold |100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900] [, [normal | bold |100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900]]*"
Same syntax and semantics as the 'font-weight' descriptor within an @font-face rule.
The weight of a face relative to others in the same font family. Takes on the same values as the 'font-weight' property with three exceptions:
  • relative keywords (bolder, lighter) are not permitted
  • a comma-separated list of values is permitted, for fonts that contain multiple weights
  • an additional keyword, 'all', is permitted, which means that the font will match for all possible weights; either because it contains multiple weights, or because that face only has a single weight.
If the attribute is not specified, the effect is as if a value of "all" were specified.
Animatable: no.
font-stretch = "all | [ normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded] [, [ normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded] ]*"
Same syntax and semantics as the 'font-stretch' descriptor within an @font-face rule. Indication of the condensed or expanded nature of the face relative to others in the same font family. Takes on the same values as the 'font-stretch' property except that:
  • relative keywords (wider,narrower) are not permitted
  • a comma-separated list is permitted
  • the keyword 'all' is permitted
If the attribute is not specified, the effect is as if a value of "normal" were specified.
Animatable: no.
font-size = "<string>"
Same syntax and semantics as the 'font-size' descriptor within an @font-face rule.
Animatable: no.
unicode-range = "<urange> [, <urange>]*"
Same syntax and semantics as the 'unicode-range' descriptor within an @font-face rule. The range of ISO 10646 characters [UNICODE] possibly covered by the glyphs in the font. Except for any additional information provided in this specification, the normative definition of the attribute is in [CSS2].
If the attribute is not specified, the effect is as if a value of "U+0-10FFFF" were specified.
Animatable: no.
units-per-em = "<number>"
Same syntax and semantics as the 'units-per-em' descriptor within an @font-face rule. The number of coordinate units on the em square, the size of the design grid on which glyphs are laid out.
This value is almost always necessary as nearly every other attribute requires the definition of a design grid.
If the attribute is not specified, the effect is as if a value of "1000" were specified.
Animatable: no.
panose-1 = "[<integer>]{10}"
Same syntax and semantics as the 'panose-1' descriptor within an @font-face rule. The Panose-1 number, consisting of ten decimal integers, separated by whitespace. Except for any additional information provided in this specification, the normative definition of the attribute is in [CSS2].
If the attribute is not specified, the effect is as if a value of "0 0 0 0 0 0 0 0 0 0" were specified.
Animatable: no.
stemv = "<number>"
Same syntax and semantics as the 'stemv' descriptor within an @font-face rule.
Animatable: no.
stemh = "<number>"
Same syntax and semantics as the 'stemh' descriptor within an @font-face rule.
Animatable: no.
slope = "<number>"
Same syntax and semantics as the 'slope' descriptor within an @font-face rule. The vertical stroke angle of the font. Except for any additional information provided in this specification, the normative definition of the attribute is in [CSS2].
If the attribute is not specified, the effect is as if a value of "0" were specified.
Animatable: no.
cap-height = "<number>"
Same syntax and semantics as the 'cap-height' descriptor within an @font-face rule. The height of uppercase glyphs in the font within the font coordinate system.
Animatable: no.
x-height = "<number>"
Same syntax and semantics as the 'x-height' descriptor within an @font-face rule. The height of lowercase glyphs in the font within the font coordinate system.
Animatable: no.
accent-height = "<number>"
The distance from the baseline to the top of accent characters, measured by a distance within the font coordinate system.
If the attribute is not specified, the effect is as if the attribute were set to the value of the ascent attribute. If this descriptor is used, the units-per-em attribute must also be specified.
Animatable: no.
ascent = "<number>"
Same syntax and semantics as the 'ascent' descriptor within an @font-face rule. The maximum unaccented height of the font within the font coordinate system.
Animatable: no.
descent = "<number>"
Same syntax and semantics as the 'descent' descriptor within an @font-face rule. The maximum unaccented depth of the font within the font coordinate system.
Animatable: no.
widths = "<string>"
Same syntax and semantics as the 'widths' descriptor within an @font-face rule.
Animatable: no.
bbox = "<string>"
Same syntax and semantics as the 'bbox' descriptor within an @font-face rule.
Animatable: no.
ideographic = "<number>"
Comparable syntax and semantics as the 'baseline' descriptor within an @font-face rule. Indicates the alignment coordinate for glyphs which represent ideographic characters. If this descriptor is provided, the units-per-em attribute must also be specified.
Animatable: no.
baseline = "<number>"
Same syntax and semantics as the 'baseline' descriptor within an @font-face rule. The lower baseline of a font within the font coordinate system.
Animatable: no.
centerline = "<number>"
Same syntax and semantics as the 'centerline' descriptor within an @font-face rule. The central baseline of a font within the font coordinate system.
Animatable: no.
mathline = "<number>"
Same syntax and semantics as the 'mathline' descriptor within an @font-face rule. The mathematical baseline of a font within the font coordinate system.
Animatable: no.
hanging = "<number>"
Comparable syntax and semantics as the 'baseline' descriptor within an @font-face rule. Indicates the alignment coordinate for glyphs which represent ideographic characters. If this descriptor is provided, the units-per-em attribute must also be specified.
Animatable: no.
topline = "<number>"
Same syntax and semantics as the 'topline' descriptor within an @font-face rule. The top baseline of a font within the font coordinate system.
Animatable: no.
underline-position = "<number>"
The ideal position of an underline within the font coordinate system. If this descriptor is provided, the units-per-em attribute must also be specified. If this descriptor is provided, the units-per-em attribute must also be specified.
Animatable: no.
underline-thickness = "<number>"
The ideal thickness of an underline, expressed as a length within the font coordinate system. If this descriptor is provided, the units-per-em attribute must also be specified.
Animatable: no.
strikethrough-position = "<number>"
The ideal position of a strike-through within the font coordinate system. If this descriptor is provided, the units-per-em attribute must also be specified.
Animatable: no.
strikethrough-thickness = "<number>"
The ideal thickness of a strike-through, expressed as a length within the font coordinate system. If this descriptor is provided, the units-per-em attribute must also be specified.
Animatable: no.
overline-position = "<number>"
The ideal position of an overline within the font coordinate system. If this descriptor is provided, the units-per-em attribute must also be specified.
Animatable: no.
overline-thickness = "<number>"
The ideal thickness of an overline, expressed as a length within the font coordinate system. If this descriptor is provided, the units-per-em attribute must also be specified.
Animatable: no.
Attributes defined elsewhere:
%stdAttrs;.

The following elements and attributes correspond to the 'src' descriptor within an @font-face rule.

<!ELEMENT font-face-src (font-face-uri|font-face-name)+ >
<!ATTLIST font-face-src 
  %stdAttrs; >

<!ELEMENT font-face-uri (font-face-format*) >
<!ATTLIST font-face-uri 
  %stdAttrs;
  %xlinkRefAttrs;
  xlink:href %URI; #REQUIRED >

<!ELEMENT font-face-format EMPTY >
<!ATTLIST font-face-format 
  %stdAttrs;
  string CDATA #IMPLIED >

<!ELEMENT font-face-name EMPTY >
<!ATTLIST font-face-name 
  %stdAttrs;
  name CDATA #IMPLIED >

<!ELEMENT definition-src EMPTY >
<!ATTLIST definition-src 
  %stdAttrs;
  %xlinkRefAttrs;
  xlink:href %URI; #REQUIRED >
Attributes defined elsewhere:
%stdAttrs;, %xlinkRefAttrs;, xlink:href.

20.8 DOM interfaces

The following interfaces are defined below: SVGFontElement, SVGGlyphElement, SVGMissingGlyphElement, SVGHKernElement, SVGVKernElement, SVGFontFaceElement, SVGFontFaceSrcElement, SVGFontFaceUriElement, SVGFontFaceFormatElement, SVGFontFaceNameElement, SVGDefinitionSrcElement.


Interface SVGFontElement

The SVGFontElement interface corresponds to the 'font' element.

Object-oriented access to the attributes of the 'font' element via the SVG DOM is not available.


IDL Definition
interface SVGFontElement : 
                SVGElement,
                SVGExternalResourcesRequired,
                SVGStylable {};


Interface SVGGlyphElement

The SVGGlyphElement interface corresponds to the 'glyph' element.

Object-oriented access to the attributes of the 'glyph' element via the SVG DOM is not available.


IDL Definition
interface SVGGlyphElement : 
                SVGElement,
                SVGStylable {};


Interface SVGMissingGlyphElement

The SVGMissingGlyphElement interface corresponds to the 'missing-glyph' element.

Object-oriented access to the attributes of the 'missing-glyph' element via the SVG DOM is not available.


IDL Definition
interface SVGMissingGlyphElement : 
                SVGElement,
                SVGStylable {};


Interface SVGHKernElement

The SVGHKernElement interface corresponds to the 'hkern' element.

Object-oriented access to the attributes of the 'hkern' element via the SVG DOM is not available.


IDL Definition
interface SVGHKernElement : SVGElement {};


Interface SVGVKernElement

The SVGVKernElement interface corresponds to the 'vkern' element.

Object-oriented access to the attributes of the 'vkern' element via the SVG DOM is not available.


IDL Definition
interface SVGVKernElement : SVGElement {};


Interface SVGFontFaceElement

The SVGFontFaceElement interface corresponds to the 'font-face' element.

Object-oriented access to the attributes of the 'font-face' element via the SVG DOM is not available.


IDL Definition
interface SVGFontFaceElement : SVGElement {};


Interface SVGFontFaceSrcElement

The SVGFontFaceSrcElement interface corresponds to the 'font-face-src' element.


IDL Definition
interface SVGFontFaceSrcElement : SVGElement {};


Interface SVGFontFaceUriElement

The SVGFontFaceUriElement interface corresponds to the 'font-face-uri' element.

Object-oriented access to the attributes of the 'font-face-uri' element via the SVG DOM is not available.


IDL Definition
interface SVGFontFaceUriElement : SVGElement {};


Interface SVGFontFaceFormatElement

The SVGFontFaceFormatElement interface corresponds to the 'font-face-format' element.

Object-oriented access to the attributes of the 'font-face-format' element via the SVG DOM is not available.


IDL Definition
interface SVGFontFaceFormatElement : SVGElement {};


Interface SVGFontFaceNameElement

The SVGFontFaceNameElement interface corresponds to the 'font-face-name' element.

Object-oriented access to the attributes of the 'font-face-name' element via the SVG DOM is not available.


IDL Definition
interface SVGFontFaceNameElement : SVGElement {};


Interface SVGDefinitionSrcElement

The SVGDefinitionSrcElement interface corresponds to the 'definition-src' element.

Object-oriented access to the attributes of the 'definition-src' element via the SVG DOM is not available.


IDL Definition
interface SVGDefinitionSrcElement : SVGElement {};