SVG Fonts

From SVG
Jump to: navigation, search

This page gathers some notes on the kinds of things people want to use SVG Fonts for.

Defining a general purpose black and white font ("simple font") for use in SVG and/or HTML documents

This should be done with other technologies, such as WOFF or plain OpenType. While SVG Fonts support automatic selection of initial/medial/final forms for Arabic, as well as language-based glyph variant selection, that is the extent of its ability to handle non-trivial scripts. SVG Fonts can't even do diacritic placement except through the definition of ligatures, which does not scale well when multiple diacritics may be present on a glyph. Languages that require complex shaping like some Indic scripts cannot be handled.

Defining an embeddable simple font

WOFF fonts encoded in data: URIs should suffice.

Defining a font that can have its metrics inspected by script

SVG Fonts allow you to easily get metrics of individual <glyph> elements.

This is not the case for embedded WOFF fonts, although script libraries could be written to decode and parse the data: URI of a WOFF font. Maybe better would be to introduce an API that allows querying of font metrics, which would have the advantage of working with fonts not embedded in the document.

Embedding a simple font so that it can be modified at run time, or generating a whole font at run time

SVG Fonts can be modified or created easily at run time through DOM manipulations. Doing this for embedded WOFF fonts would be difficult, but not impossible. (There might be performance implications for allowing the modification of large data: URI encoded fonts.)

Defining animated glyphs

The Tiny variant of SVG Fonts does not support animation elements targeting <glyph d> attributes, although this can be done with Full SVG Fonts by defining <glyph> with animated <path> element children.

Whatever mechanism is used for run time modification of fonts could be used for script-based animation of glyphs. Embedded WOFF fonts cannot support declarative animation.

Having isolated logo text be real text

Paths and other graphical elements are used to draw logo-style text that cannot be done using <text> elements. The logo should be considered to be painting a string of text, so that the text can be searched for, selected, read out by an AT, etc. The logo does not appear as part of another text element.