You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1559 lines
78 KiB
1559 lines
78 KiB
<?xml version="1.0" encoding="utf-8"?>
|
|
<!DOCTYPE html
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
<title>WOFF File Format 1.0</title>
|
|
<style type="text/css">
|
|
.toadd {background: yellow; padding-left:3px; padding-right: 3px}
|
|
.conform:hover {background: #DFD}
|
|
.conform:target {padding: 2px; border: 2px solid #ACA; background: #DFD }
|
|
</style>
|
|
|
|
|
|
<style type="text/css">
|
|
div.note { margin: 1em 2.5em; padding: 0.5em 1em; background: #ccc }
|
|
div.note p:first-child:before { content: "NOTE: "; font-weight: bold; color: #005A9C; }
|
|
|
|
col.type { width: 5em; }
|
|
col.name { width: 10em; }
|
|
|
|
tr.header { text-align: left; }
|
|
|
|
th { padding-left: .5em; padding-right: .5em; vertical-align: top; }
|
|
td { padding-left: .5em; padding-right: .5em; vertical-align: top; }
|
|
|
|
|
|
dl.footnotes dt {
|
|
float: left;
|
|
clear: left;
|
|
width: 2em;
|
|
text-align: right;
|
|
}
|
|
dl.footnotes dd {
|
|
margin-left: 3em;
|
|
}
|
|
|
|
dl.xmlspec dd {
|
|
margin-bottom: 1em;
|
|
}
|
|
|
|
.metadata {
|
|
background: #eee;
|
|
padding: .25em 0;
|
|
}
|
|
|
|
.ednote {
|
|
background: #ffc;
|
|
padding: .25em;
|
|
}
|
|
</style>
|
|
<link rel="alternate stylesheet" type="text/css" title="Conformance" href="conform.css"/>
|
|
<!-- <link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-ED"/> -->
|
|
<link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-CR"/>
|
|
|
|
</head>
|
|
<body>
|
|
|
|
<div class="head">
|
|
<p>
|
|
<a href="http://www.w3.org/"><img alt="W3C" src="http://www.w3.org/Icons/w3c_home" height="48" width="72"/></a>
|
|
|
|
|
|
</p>
|
|
|
|
<h1 style="clear: both;" id="title">WOFF File Format 1.0</h1>
|
|
|
|
<h2 id="W3C-doctype">W3C Candidate Recommendation 04 August 2011
|
|
</h2>
|
|
|
|
<dl>
|
|
<dt>This version:</dt>
|
|
<!-- <dd><a href="http://dev.w3.org/webfonts/WOFF/spec/">http://dev.w3.org/webfonts/WOFF/spec/</a></dd> -->
|
|
<dd><a href="http://www.w3.org/TR/2011/CR-WOFF-20110804">http://www.w3.org/TR/2011/CR-WOFF-20110804</a></dd>
|
|
|
|
<dt>Latest version:</dt>
|
|
<dd><a href="http://www.w3.org/TR/WOFF">http://www.w3.org/TR/WOFF</a></dd>
|
|
|
|
<dt>Previous version:</dt>
|
|
<dd><a href="http://www.w3.org/TR/2010/WD-WOFF-20101116">http://www.w3.org/TR/2010/WD-WOFF-20101116</a></dd>
|
|
<dt>Authors:</dt>
|
|
<dd>Jonathan Kew (Mozilla Corporation)</dd>
|
|
<dd>Tal Leming (Type Supply)</dd>
|
|
<dd>Erik van Blokland (LettError)</dd>
|
|
</dl>
|
|
|
|
|
|
<p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>
|
|
© 2011 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup>
|
|
(<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>,
|
|
<a href="http://www.ercim.eu/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
|
|
<a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved.
|
|
W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>,
|
|
<a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and
|
|
<a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.</p>
|
|
|
|
</div>
|
|
|
|
<hr />
|
|
|
|
|
|
<div id="Abstract">
|
|
<h2>Abstract</h2>
|
|
<p>This document specifies the WOFF font packaging format.
|
|
This format was designed to provide lightweight, easy-to-implement compression of font data,
|
|
suitable for use with CSS <tt>@font-face</tt> rules.
|
|
Any properly licensed TrueType/OpenType/Open Font Format file can be packaged in WOFF format for Web use.
|
|
User agents decode the WOFF file to restore the font data such that it will display identically to the input font.</p>
|
|
|
|
<p>The WOFF format also allows additional metadata to be attached to the file;
|
|
this can be used by font designers or vendors to include licensing or other information,
|
|
beyond that present in the original font.
|
|
Such metadata does not affect the rendering of the font in any way,
|
|
but may be displayed to the user on request.</p>
|
|
|
|
<p>The WOFF format is not intended to replace other formats
|
|
such as TrueType/OpenType/Open Font Format or SVG fonts,
|
|
but provides an alternative solution for use cases where these formats may be less optimal,
|
|
or where licensing considerations make their use less acceptable.</p>
|
|
</div>
|
|
|
|
<h2 id="status">Status of This Document</h2>
|
|
|
|
<p><em>This section describes the status of this document at the
|
|
time of its publication. Other documents may supersede this
|
|
document. A list of current W3C publications and the latest
|
|
revision of this technical report can be found in the <a href="http://www.w3.org/TR/">W3C technical reports index</a> at
|
|
http://www.w3.org/TR/.</em></p>
|
|
|
|
<p>W3C publishes a
|
|
<a href="http://www.w3.org/2005/10/Process-20051014/tr.html#maturity-levels" shape="rect">
|
|
Candidate Recommendation</a> to indicate that the document is believed
|
|
to be stable and to encourage implementation by the developer
|
|
community. The <a href="http://www.w3.org/Fonts/WG/">WebFonts Working Group</a>. expects to request that the
|
|
Director advance this document to Proposed Recommendation once the
|
|
Working Group has documented at least two user agents passing each test in the user agent
|
|
portion of the <a href="http://dev.w3.org/webfonts/WOFF/tests/">test suite</a>, at least two authoring tools
|
|
passing each test in the authoring portion of the test suite, and tested a selection of WOFF files against the
|
|
file format portion of the test suite.
|
|
The WebFonts Working Group, working closely with the developer community, expects to show
|
|
these implementations by 4 October 2011 and will produce a preliminary implementation report following
|
|
it's 13 September f2f meeting, cohosted with the ATypI conference.
|
|
The Working Group expects to revise this report over the course of the implementation period. The Working Group does not plan to request to advance to Proposed Recommendation prior to 4 October 2011 .
|
|
</p>
|
|
|
|
|
|
<p>This specification is a Candidate Recommendation, containing changes introduced in
|
|
<a href="http://dev.w3.org/webfonts/WOFF/DoC/issues-lc-2010.html">response to feedback on the Last Call Working Draft</a>.
|
|
Comments may be sent to
|
|
<a href="mailto:www-font@w3.org">www-font@w3.org</a> (with
|
|
<a href="http://lists.w3.org/Archives/Public/www-font/">public archive</a>).</p>
|
|
|
|
<p>This document was initially developed by contributors to the <a href="mailto:www-font@w3.org">www-font@w3.org</a> mailing list.
|
|
After trial implementation, it became the <a href="http://www.w3.org/Submission/2010/SUBM-WOFF-20100408/">WOFF Submission</a>
|
|
and is being further developed at W3C.
|
|
</p>
|
|
|
|
<p>
|
|
A complete <a href="#changes">list of changes</a>
|
|
to this document, relative to the previous publication, is available.
|
|
</p>
|
|
|
|
<p>Publication as a Candidate Recommendation does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.</p>
|
|
|
|
<p>
|
|
This document was produced by a group operating under the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5
|
|
February 2004 W3C Patent Policy</a>.
|
|
|
|
W3C maintains a <a rel="disclosure" href="http://www.w3.org/2004/01/pp-impl/44556/status">public list
|
|
of any patent disclosures</a> made in connection with the
|
|
deliverables of the group; that page also includes
|
|
instructions for disclosing a patent.
|
|
|
|
An individual who has actual knowledge of a patent which the
|
|
individual believes contains <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the
|
|
information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the W3C Patent Policy</a>.
|
|
</p>
|
|
|
|
<p>This document identifies two features as being
|
|
<a href="http://www.w3.org/2005/10/Process-20051014/tr.html#cfi">at risk</a>: the
|
|
<a href="#atrisk-SOR">default Same Origin Restriction
|
|
(SOR)</a> and the <a href="#atrisk-CORS">mechanism used to relax the SOR, Cross Origin Resource Sharing (CORS)</a>.</p>
|
|
|
|
<div>
|
|
<h2 id="toc">Table of Contents</h2>
|
|
|
|
<p><a href="#Introduction">1. Introduction</a>
|
|
<br/><a href="#General">2. General Requirements</a>
|
|
<br/><a href="#OverallStructure">3. Overall File Structure</a>
|
|
<br/><a href="#WOFFHeader">4. WOFF Header</a>
|
|
<br/><a href="#TableDirectory">5. Table Directory</a>
|
|
<br/><a href="#DataTables">6. Font Data Tables</a>
|
|
<br/><a href="#Metadata">7. Extended Metadata Block</a>
|
|
<br/><a href="#Private">8. Private Data Block</a>
|
|
</p>
|
|
<p><a href="#appendix-a">Appendix A: Extended Metadata Examples</a>
|
|
<br/><a href="#appendix-b">Appendix B: Media Type Registration</a>
|
|
<br/><a href="#changes">Appendix C: Changes</a>
|
|
<br/><a href="#References">References</a></p>
|
|
|
|
</div>
|
|
|
|
<div class="main">
|
|
|
|
<h2 id="Introduction">1. Introduction</h2>
|
|
|
|
<p>This document specifies a simple compressed file format for fonts, designed
|
|
primarily for use on the Web and known as WOFF (Web Open Font Format).
|
|
Despite this name, WOFF should be regarded as a container format
|
|
or "wrapper" for font data in already-existing formats
|
|
rather than an actual font format in its own right.</p>
|
|
|
|
<p>The WOFF format is a container for the table-based sfnt structure used in e.g. TrueType [<cite><a href="#ref-TT">TrueType</a></cite>], OpenType [<cite><a href="#ref-OT">OpenType</a></cite>] and Open Font Format [<cite><a
|
|
href="#ref-OFF">OFF</a></cite>] fonts, hereafter referred to as sfnt fonts.
|
|
|
|
A WOFF file is simply a repackaged
|
|
version of a sfnt font with optional compression of the font data tables.
|
|
The WOFF file format also allows font metadata and private-use data to be
|
|
included separately from the font data. WOFF encoding tools convert an input
|
|
sfnt font into a WOFF formatted file, and user agents restore the
|
|
sfnt font data for use with a Web document.</p>
|
|
|
|
<p>The structure and contents of decoded font data exactly match
|
|
those of a well-formed input font file. Tools producing WOFF files may provide other
|
|
font editing features such as glyph subsetting, validation or font feature
|
|
additions but these are considered outside the scope of this format. Independent
|
|
of these features, both tools and user agents are expected to assure that the validity of
|
|
the underlying font data is preserved.</p>
|
|
|
|
<h3 id="Notation">Notational Conventions</h3>
|
|
|
|
<p>The all-uppercase key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
|
|
"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
|
|
interpreted as described in RFC 2119 [<cite><a href="#ref-RFC-2119"
|
|
>RFC-2119</a></cite>].
|
|
If these words occur in lower- or mixed case, they should be interpreted
|
|
in accordance with their normal English meaning.
|
|
</p>
|
|
|
|
<p>This document includes sections of text that are called out as "Notes"
|
|
and set off from the main text of the specification.
|
|
These notes are intended as informative explanations or clarifications,
|
|
to serve as hints or guides to implementers and users,
|
|
but are not part of the normative text.
|
|
</p>
|
|
|
|
|
|
<h2 id="General">2. General Requirements</h2>
|
|
|
|
<p>The primary purpose of the WOFF format is to package fonts linked to Web documents
|
|
by means of CSS <tt>@font-face</tt> rules.
|
|
<span class="conform ua" id="conform-same-origin">When using such fonts, user agents MUST implement a 'same-origin restriction'
|
|
on the downloading of WOFF files
|
|
using the same-origin matching algorithm described in the HTML5 specification</span> ([<cite><a href="#ref-HTML5">HTML5</a> <a href="http://www.w3.org/TR/html5/origin-0.html#origin-0">Section 5.3:
|
|
Origin</a></cite>]).
|
|
<span class="conform ua" id="conform-doc-origin">The origin of the stylesheet containing <tt>@font-face</tt> declarations
|
|
is not used when deciding whether a WOFF file is same-origin or not,
|
|
only the origin of containing document is used</span>.</p>
|
|
|
|
<p id="atrisk-SOR" class="ednote">Feature at risk: The WebFonts WG believes that the default Same-Origin restriction would be better applied to all fonts referenced from <tt>@font-face</tt>, rather than one specific format. Therefore, if CSS3 Fonts [<cite><a href="#ref-CSS3-Fonts">CSS3-Fonts</a></cite>] adds a normative requirement for a Same-Origin restriction, the WebFonts WG will drop it from the WOFF specification and instead refer to CSS3 Fonts.</p>
|
|
|
|
<p><span class="conform ua" id="conform-cors">User agents MUST also implement the ability to relax this restriction
|
|
using Cross-Origin Resource Sharing</span> [<cite><a href="#ref-CORS">CORS</a></cite>].
|
|
Thus, sites can explicitly allow cross-site downloading of WOFF files
|
|
using the <tt>Access-Control-Allow-Origin</tt> HTTP header.</p>
|
|
|
|
<p id="atrisk-CORS" class="ednote">Feature at risk: The WebFonts WG suspects that the From-Origin header may be a better way to infer a default Same-Origin for fonts, and the same mechanism can also be used to relax the restriction to allow font sharing across domains. Therefore, once CSS3 Fonts [<cite><a href="#ref-CSS3-Fonts">CSS3-Fonts</a></cite>] mandates a mechanism, WebFonts WG will drop the requirement to use CORS from this specification.</p>
|
|
|
|
<p><span class="conform ua" id="conform-css3font">User agents supporting the WOFF file format for linked fonts MUST respect
|
|
the requirements of the CSS3 Fonts specification</span> ([<cite><a href="#ref-CSS3-Fonts"
|
|
>CSS3-Fonts</a></cite>] <a href="http://www.w3.org/TR/css3-fonts/#font-face-rule">Section 4.1:
|
|
The @font-face rule</a>). In particular,
|
|
<span class="conform ua" id="conform-css3font-available">such linked fonts are only available to the documents that reference them;
|
|
they MUST NOT be made available to other applications or documents on the user's system</span>.</p>
|
|
|
|
<div class="note">
|
|
<p>The WOFF format is intended for use with <tt>@font-face</tt>
|
|
to provide fonts linked to specific Web documents.
|
|
Therefore, WOFF files must not be treated as an installable font format
|
|
in desktop operating systems or similar environments.
|
|
The WOFF-packaged data will typically be decoded to sfnt format
|
|
for use by existing font-rendering APIs that expect OpenType font data,
|
|
but such decoded font must not be exposed to other documents or applications.
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<h2 id="OverallStructure">3. Overall File Structure</h2>
|
|
|
|
<p>The structure of WOFF files is similar to the structure of sfnt fonts:
|
|
a table directory containing lengths and offsets to individual font data tables,
|
|
followed by the data tables themselves. The sfnt structure is described fully in
|
|
the TrueType [<cite><a href="#ref-TT">TrueType</a></cite>], OpenType [<cite><a href="#ref-OT">OpenType</a></cite>] and Open Font Format [<cite><a
|
|
href="#ref-OFF">OFF</a></cite>] specifications.</p>
|
|
|
|
<p>The main body of the file consists of the same collection of font data tables
|
|
as the input sfnt font, stored in the same order, except
|
|
that <span class="conform ff" id="conform-maycompress">each table MAY be compressed</span>, and the sfnt table directory is replaced by
|
|
the WOFF table directory.</p>
|
|
|
|
<div class="note">
|
|
<p>The WOFF specification does not guarantee that the actual font data
|
|
packaged in a valid WOFF container is in fact correct and usable.
|
|
It requires only that the WOFF packaging structure—header, table directory,
|
|
and compressed tables—conforms to this specification.
|
|
The contained data must be used with just as much caution as font data
|
|
delivered in "raw" form or via any other packaging method.</p>
|
|
</div>
|
|
|
|
<p>A complete WOFF file consists of several blocks: a 44-byte header,
|
|
immediately followed (in this order) by a variable-size table directory,
|
|
a variable number of font tables, an optional block of extended
|
|
metadata, and an optional block of private data.
|
|
Except for padding with a maximum of three null bytes
|
|
in places where 4-byte alignment of a table length
|
|
or block offset is specified,
|
|
<span class="conform ff" id="conform-noextraneous">there MUST NOT be any extraneous data between the data blocks
|
|
or font data tables indicated by the WOFF header and table directory,
|
|
or beyond the last such block or table</span>.
|
|
If such extraneous data is present <span class="conform ua" id="conform-extraneous-reject">a conforming user agent
|
|
MUST reject the file as invalid</span>.
|
|
The file <span class="conform ua" id="conform-overlap-reject">MUST also be rejected as invalid
|
|
if the offsets and lengths of any data blocks or font tables
|
|
indicate overlapping byte ranges of the file,
|
|
or ranges that would extend beyond the end of the file</span>.</p>
|
|
|
|
<table>
|
|
<col class="name"/><col class="desc"/>
|
|
<tr class="header"><th colspan="2">WOFF File</th></tr>
|
|
<tr><td>WOFFHeader</td><td>File header with basic font type and version, along
|
|
with offsets to metadata and private data blocks.</td></tr>
|
|
<tr><td>TableDirectory</td><td>Directory of font tables, indicating the original
|
|
size, compressed size and location of each table within the WOFF file.</td></tr>
|
|
<tr><td>FontTables</td><td>The font data tables from the input sfnt
|
|
font, compressed to reduce bandwidth requirements.</td></tr>
|
|
<tr><td>ExtendedMetadata</td><td>An optional block of extended metadata,
|
|
represented in XML format and compressed for storage in the WOFF file.</td></tr>
|
|
<tr><td>PrivateData</td><td>An optional block of private data for the font
|
|
designer, foundry, or vendor to use.</td></tr>
|
|
</table>
|
|
|
|
<p>Data values stored in the WOFF Header and WOFF Table Directory sections are
|
|
stored in big-endian format, just as values are within sfnt fonts. The
|
|
following basic data types are used in the description:</p>
|
|
<table>
|
|
<col class="type"/><col class="desc"/>
|
|
<tr class="header"><th colspan="2">Data types</th></tr>
|
|
<tr><td>UInt32</td><td>32-bit (4-byte) unsigned integer in big-endian
|
|
format</td></tr>
|
|
<tr><td>UInt16</td><td>16-bit (2-byte) unsigned integer in big-endian
|
|
format</td></tr>
|
|
</table>
|
|
|
|
<p>All sizes and offsets described in this document are assumed to be in bytes unless
|
|
otherwise noted.</p>
|
|
|
|
|
|
<h2 id="WOFFHeader">4. WOFF Header</h2>
|
|
|
|
<p>The header includes an identifying signature and indicates the specific kind
|
|
of font data included in the file (TrueType or CFF outline data); it also has a
|
|
font version number, offsets to additional data chunks, and the number of
|
|
entries in the table directory that immediately follows the header:</p>
|
|
|
|
<table>
|
|
<col class="type"/><col class="name"/><col class="desc"/>
|
|
<tr class="header"><th colspan="3">WOFFHeader</th></tr>
|
|
<tr><td>UInt32</td><td>signature</td><td>0x774F4646 <tt>'wOFF'</tt></td></tr>
|
|
<tr><td>UInt32</td><td>flavor</td><td>The "sfnt version" of the input font.</td></tr>
|
|
<tr><td>UInt32</td><td>length</td><td>Total size of the WOFF file.</td></tr>
|
|
<tr><td>UInt16</td><td>numTables</td><td>Number of entries in directory of font
|
|
tables.</td></tr>
|
|
<tr><td>UInt16</td><td>reserved</td><td>Reserved; set to zero.</td></tr>
|
|
<tr><td>UInt32</td><td>totalSfntSize</td><td>Total size needed for the
|
|
uncompressed font data, including the sfnt header, directory,
|
|
and font tables (including padding).</td></tr>
|
|
<tr><td>UInt16</td><td>majorVersion</td><td>Major version of the WOFF
|
|
file.</td></tr>
|
|
<tr><td>UInt16</td><td>minorVersion</td><td>Minor version of the WOFF
|
|
file.</td></tr>
|
|
<tr><td>UInt32</td><td>metaOffset</td><td>Offset to metadata block, from
|
|
beginning of WOFF file.</td></tr>
|
|
<tr><td>UInt32</td><td>metaLength</td><td>Length of compressed metadata block.</td></tr>
|
|
<tr><td>UInt32</td><td>metaOrigLength</td><td>Uncompressed size of metadata
|
|
block.</td></tr>
|
|
<tr><td>UInt32</td><td>privOffset</td><td>Offset to private data block, from
|
|
beginning of WOFF file.</td></tr>
|
|
<tr><td>UInt32</td><td>privLength</td><td>Length of private data block.</td></tr>
|
|
</table>
|
|
|
|
<p><span class="conform ff" id="conform-magicnumber">The <tt>signature</tt> field in the WOFF header
|
|
MUST contain the "magic number" 0x774F4646</span>.
|
|
<span class="conform ua" id="conform-nomagicnumber-reject">If the field does not contain this value,
|
|
user agents MUST reject the file as invalid</span>.</p>
|
|
|
|
<p>The <tt>flavor</tt> field corresponds to the "sfnt version"
|
|
field found at the beginning of an sfnt file,
|
|
indicating the type of font data contained.
|
|
Although only fonts of type 0x00010000 (the version number 1.0
|
|
as a 16.16 fixed-point value, indicating TrueType glyph data)
|
|
and 0x4F54544F (the tag <tt>'OTTO'</tt>, indicating CFF glyph data)
|
|
are widely supported at present, it is not an error in the WOFF file if the
|
|
<tt>flavor</tt> field contains a different value, indicating a
|
|
WOFF-packaged version of a different sfnt flavor. (The value 0x74727565 <tt>'true'</tt>
|
|
has been used for some TrueType-flavored fonts on Mac
|
|
OS, for example.) Whether client software will actually support other types of
|
|
sfnt font data is outside the scope of the WOFF specification, which
|
|
simply describes how the sfnt is repackaged for Web use.</p>
|
|
|
|
<p>The WOFF <tt>majorVersion</tt> and <tt>minorVersion</tt> fields specify the version number for a given
|
|
WOFF file, which can be based on the version number of the input font but is
|
|
not required to be. These fields have no effect on font loading or usage
|
|
behavior in user agents.</p>
|
|
|
|
<p>The <tt>totalSfntSize</tt> field is the sum of the
|
|
uncompressed font table sizes, each padded to a multiple of 4 bytes, plus
|
|
the size of the sfnt header and table directory. Thus, this is the size of
|
|
buffer needed to decode the complete WOFF-packaged font (but not metadata,
|
|
which is not part of the input sfnt file) into a standard sfnt structure.
|
|
<span class="conform ff" id="conform-totalsize-longword">This value MUST be a multiple of 4, because all font tables
|
|
including the last are to be padded to a 4-byte boundary</span>.
|
|
<span class="conform ua" id="conform-totalsize-longword-reject">If this value
|
|
is incorrect, a conforming user agent MUST reject the file as invalid</span>.</p>
|
|
|
|
<p>The sfnt header includes three fields (<tt>searchRange</tt>,
|
|
<tt>entrySelector</tt> and <tt>rangeShift</tt>) that are designed to
|
|
facilitate a binary search of the table directory.
|
|
As the proper value for each of these fields can be computed directly
|
|
from the number of font tables, they are not stored in the WOFF file.
|
|
User agents that decode WOFF files back to an sfnt structure
|
|
MUST therefore compute the correct values for these fields in the sfnt header,
|
|
as described in the OpenType/OFF specification.[<cite><a
|
|
href="#ref-OFF">OFF</a></cite>]</p>
|
|
|
|
<div class="note">
|
|
<p>The correct value for <tt>totalSfntSize</tt> may be computed
|
|
as illustrated by the following pseudo-code:</p>
|
|
<pre>
|
|
totalSfntSize = 12 // size of sfnt header ("offset table" in the OpenType spec)
|
|
totalSfntSize += 16 * numTables // size of table record (directory of font tables)
|
|
for each table:
|
|
totalSfntSize += (table.origLength + 3) & 0xFFFFFFFC // table size, padded
|
|
</pre>
|
|
</div>
|
|
|
|
<p><span class="conform ff" id="conform-zerometaprivate">If either or both of the metadata or private blocks is not present,
|
|
the relevant offset and length fields MUST be set to zero</span>.
|
|
<span class="conform ua" id="conform-metaprivate-overlap-reject">If the metadata or private data offset and length fields indicate byte
|
|
ranges that overlap other data blocks or tables,
|
|
or extend beyond the end of the file,
|
|
a conforming user agent MUST reject the file as invalid</span>.</p>
|
|
|
|
<p><span class="conform ff" id="conform-reserved">The header includes a <tt>reserved</tt> field; this MUST be
|
|
set to zero</span>. <span class="conform ua" id="conform-reserved-reject">If this field is non-zero, a conforming user agent
|
|
MUST reject the file as invalid</span>.</p>
|
|
|
|
|
|
<h2 id="TableDirectory">5. Table Directory</h2>
|
|
|
|
<p>The table directory is an array of WOFF table directory entries, as defined
|
|
below. The directory follows immediately after the WOFF file header; therefore,
|
|
there is no explicit offset in the header pointing to this block. Its size is
|
|
calculated by multiplying the <tt>numTables</tt> value in the
|
|
WOFF header times the size of a single WOFF table directory. Each table
|
|
directory entry specifies the size and location of a single font data table.</p>
|
|
|
|
<table>
|
|
<col class="type"/><col class="name"/><col class="desc"/>
|
|
<tr class="header"><th colspan="3">WOFF TableDirectoryEntry</th></tr>
|
|
<tr><td>UInt32</td><td>tag</td><td>4-byte sfnt table identifier.</td></tr>
|
|
<tr><td>UInt32</td><td>offset</td><td>Offset to the data, from beginning of WOFF
|
|
file.</td></tr>
|
|
<tr><td>UInt32</td><td>compLength</td><td>Length of the compressed data,
|
|
excluding padding.</td></tr>
|
|
<tr><td>UInt32</td><td>origLength</td><td>Length of the uncompressed table,
|
|
excluding padding.</td></tr>
|
|
<tr><td>UInt32</td><td>origChecksum</td><td>Checksum of the uncompressed
|
|
table.</td></tr>
|
|
</table>
|
|
|
|
<p>The format of <tt>tag</tt> values are defined by the
|
|
specifications for sfnt fonts. The <tt>offset</tt> and
|
|
<tt>compLength</tt> fields identify the location of the
|
|
compressed font table. The <tt>origLength</tt> and <tt>origCheckSum</tt>
|
|
fields are the length and checksum of the
|
|
input font table from the table directory of the input
|
|
font.</p>
|
|
|
|
<p>The sfnt format specifications require that font tables be aligned on
|
|
4-byte boundaries. Font tables whose length is not a multiple of 4 are padded
|
|
with null bytes up to the next 4-byte boundary. <span class="conform ff" id="conform-tablesize-longword">Font data tables in the WOFF
|
|
file have the same requirement: they MUST begin on 4-byte boundaries and be
|
|
zero-padded to the next 4-byte boundary</span>. The <tt>compLength</tt> and <tt>origLength</tt> fields
|
|
in the table directory store the exact, unpadded length.</p>
|
|
|
|
<p>If the <tt>offset</tt> and <tt>compLength</tt> values
|
|
indicate a byte range that overlaps
|
|
other data blocks or font tables, or if the byte range extends beyond
|
|
the end of the file, <span class="conform ua" id="conform-diroverlap-reject">a conforming user agent MUST reject the file as
|
|
invalid</span>.</p>
|
|
|
|
<p><span class="conform at ff" id="conform-compressedlarger">If the length of a compressed font table would be the same as or greater than
|
|
the length of the input font table, the font table MUST be stored
|
|
uncompressed in the WOFF file and the <tt>compLength</tt> set
|
|
equal to the <tt>origLength</tt></span>. <span class="conform at ff" id="conform-uncompressed">Tools MAY also opt to leave
|
|
other tables uncompressed (e.g. all tables less than a certain size), in which
|
|
case <tt>compLength</tt> will be equal to <tt>origLength</tt> for these tables as well</span>.
|
|
<span class="conform ua" id="conform-compLength">WOFF files containing
|
|
table directory entries for which <tt>compLength</tt> is
|
|
greater than <tt>origLength</tt> are considered invalid and
|
|
MUST NOT be loaded by user agents</span>. <span class="conform ua" id="conform-origLength">Files containing compressed font tables that
|
|
decompress to a size other than <tt>origLength</tt> are also
|
|
considered invalid and MUST NOT be loaded</span>.</p>
|
|
|
|
<p>The sfnt font specifications require that table directory entries
|
|
are sorted in ascending order of <tt>tag</tt> value. To
|
|
simplify processing, <span class="conform at ff" id="conform-ascending">WOFF-producing tools MUST produce a table directory with
|
|
entries in ascending <tt>tag</tt> value order</span>. <span class="conform ua" id="conform-ascending-recreated">User agents MUST
|
|
likewise assure that the sfnt table directory is recreated in ascending
|
|
<tt>tag</tt> order when restoring the font data to its uncompressed
|
|
state</span>. The ordering of the font tables themselves is independent of the order of
|
|
directory entries, as described below.</p>
|
|
|
|
<p>sfnt fonts store a checksum for each table in the table directory, and
|
|
an overall checksum for the entire font in the <tt>head</tt>
|
|
table (see the TrueType, OpenType or Open Font Format specifications for the
|
|
definition of each calculation). <span class="conform at" id="conform-checksumvalidate">Tools producing WOFF files MUST validate these
|
|
checksums, and reject the font if errors are found</span>.</p>
|
|
|
|
<!-- next para could be reworded to add a conformance clause -->
|
|
<p>A WOFF file contains the same set of font tables as the input font
|
|
from which it was created. This means that the overall font checksum of a
|
|
font decompressed from a conformant WOFF file will always match the checksum
|
|
in the well-formed input font. In the case where the
|
|
input font included unreferenced data between or after the actual tables,
|
|
this would affect the overall checksum of the input font, but would be
|
|
dropped during creation of the WOFF file.</p>
|
|
|
|
<!-- next para could be reworded to add a conformance clause -->
|
|
<p>A well-formed input font does not have structural anomalies such as
|
|
incorrect padding, overlapping font tables,
|
|
extraneous data between tables (which will be discarded by the WOFF
|
|
generator), or incorrect checksums. </p>
|
|
|
|
<p>To ensure that lossless round-trip conversion from sfnt to WOFF and back
|
|
will be possible, a well-formed input font should conform
|
|
to certain norms that are not
|
|
strictly required by the OpenType/OFF specification, although they are common
|
|
practice:</p>
|
|
|
|
<dl>
|
|
<dt>Font table padding</dt>
|
|
<dd>The OpenType/OFF specification is not entirely clear about whether <em>all</em>
|
|
tables in an sfnt font must be padded with 0-3 zero bytes to a multiple
|
|
of 4 bytes in length, or whether this applies only <em>between</em> tables,
|
|
and the final table of the file may be left unpadded.
|
|
Most current tools and fonts seem to expect all tables to be padded to a 4-byte
|
|
boundary, including the last.
|
|
The WOFF specification assumes this behavior, and specifies that the
|
|
<tt>totalSfntLength</tt> field in the WOFF header provides for such padding.
|
|
To ensure that a given font can be packaged as a WOFF file and then decoded
|
|
to its original format and give a byte-for-byte identical result,
|
|
the input font should therefore be padded to a multiple of 4 bytes in length.</dd>
|
|
|
|
<dt>No "hidden" data</dt>
|
|
<dd>The OpenType/OFF specification does not explicitly prohibit the
|
|
presence of "extra" data or padding in between the font tables;
|
|
as the table directory includes the offset and length of each actual table,
|
|
such data would simply be ignored. However, the WOFF format makes no
|
|
provision to preserve such non-font-table data when packaging a font,
|
|
and therefore it would not survive a round-trip format conversion.</dd>
|
|
|
|
<dt>Header fields are correct</dt>
|
|
<dd>The OpenType/OFF header fields (<tt>searchRange</tt>,
|
|
<tt>entrySelector</tt>, <tt>rangeShift</tt>)
|
|
that are designed to facilitate a binary search of the table directory
|
|
must be correct in the input sfnt file,
|
|
as the WOFF format does not directly preserve these fields
|
|
but assumes a WOFF decoder will recompute them as needed.</dd>
|
|
|
|
<dt>Checksums are correct</dt>
|
|
<dd>The WOFF specification says that table checksums must be validated
|
|
(and corrected if necessary) by WOFF creators.
|
|
In order for complete
|
|
round-trip fidelity, therefore, the checksums in the input sfnt file
|
|
must also be correct prior to WOFF packaging.</dd>
|
|
|
|
<dt>No overlapping tables</dt>
|
|
<dd>The offset and length values in the input sfnt table directory must not indicate overlapping byte ranges of the input font.</dd>
|
|
</dl>
|
|
|
|
<p>
|
|
|
|
<!-- need to add to test scheme-->
|
|
<span class="conform at" id="conform-identical">The result of creating a WOFF file and then decoding this to
|
|
regenerate an sfnt font MUST result in a final font that is bitwise-identical to
|
|
the well-formed input font.</span>.
|
|
<span class="conform at" id="conform-incorrect-reject">If the input font has defects or anomalies
|
|
that make this impossible,
|
|
the WOFF-generating tool SHOULD either reject the font
|
|
or issue an appropriate warning
|
|
that lossless round-trip conversion will not be possible</span>.</p>
|
|
|
|
|
|
<h2 id="DataTables">6. Font Data Tables</h2>
|
|
|
|
<p>The font data tables in the WOFF file are exactly the same as the tables in
|
|
the input font, except that <span class="conform" id="conform-maycompress2">each table MAY have been
|
|
compressed</span>. If compressed, <span class="conform ff" id="conform-mustzlib">it MUST have been compressed by the <tt>compress2()</tt> function of zlib</span> [<cite><a
|
|
href="#ref-Compress2">Compress2</a></cite>] (or an
|
|
equivalent, compatible algorithm). User agents use the
|
|
<tt>uncompress()</tt> function of zlib [<cite><a
|
|
href="#ref-Uncompress">Uncompress</a></cite>](or an
|
|
equivalent, compatible algorithm)
|
|
to decompress each table.
|
|
The underlying format these functions use is described in the ZLIB
|
|
specification [<cite><a href="#ref-ZLIB"
|
|
>ZLib</a></cite>]. <span class="conform ua" id="conform-mustuncompress">User agents or other programs that decode WOFF files MUST be able to handle
|
|
tables that have been compressed</span>.
|
|
<span class="conform ua" id="conform-decompressfailure">If the
|
|
decompression function fails for any table, the WOFF file is invalid
|
|
and MUST NOT be loaded</span>.</p>
|
|
|
|
<p><span class="conform ff" id="conform-afterdirectory">The font data tables MUST be stored immediately following the table
|
|
directory, without gaps except for any padding that is required (up to three
|
|
null bytes at the end of each table) to ensure 4-byte alignment</span>.</p>
|
|
|
|
<p><span class="conform ff" id="conform-sameorder">Font tables in WOFF files MUST be stored in the same order as the well-formed input font</span>.
|
|
The table order is implied by <tt>offset</tt> values in the table directory; sorting table
|
|
directory entries into ascending <tt>offset</tt> value order
|
|
produces a list of entries in an order equivalent to that of the font tables.
|
|
</p>
|
|
|
|
<div class="note">
|
|
<p>User agents need not necessarily reconstitute the input font as a whole, and may reorder tables when decoding the WOFF file to sfnt form; they may access individual tables directly as needed. Under these circumstances the resulting sfnt will no longer be an exact copy of the input font, and checksums or digital signature data may be invalidated as a result.</p>
|
|
|
|
<p>In some cases, sites deploying WOFF files as Web fonts may wish to subset the character
|
|
repertoire, optimize table ordering for efficient text layout or rasterization,
|
|
or remove (or add) optional font tables depending on the particular features needed for a site.
|
|
User agents might make similar modifications to the font during decoding,
|
|
such as omitting tables that are not needed by their particular text display system.</p>
|
|
|
|
<p>The automatic removal of OpenType features such as GPOS and GSUB information
|
|
at any stage in the process of deploying a WOFF file is strongly discouraged.
|
|
Many writing systems around the world rely on these features
|
|
for very basic display of text in the script that they use.</p>
|
|
|
|
<p>If either a WOFF-creation tool or a WOFF-consuming user agent
|
|
reorders or otherwise modifies the collection of font tables,
|
|
the font checksum in the <tt>head</tt> table will need to be recalculated
|
|
as it will be affected by the changed offsets in
|
|
the sfnt table directory.
|
|
Any <tt>DSIG</tt> table in the input font will also be invalidated by such changes, and should therefore be removed from the modified font.
|
|
A new signature could be added to the modified font,
|
|
as described by the OpenType and Open Font Format specifications
|
|
(if appropriate signing credentials are available to the tool involved).
|
|
Any such pre- and/or post-processing
|
|
represents a modification of the font data being packaged;
|
|
while it might be done in conjunction with WOFF packaging for Web deployment,
|
|
it falls outside the scope of the WOFF specification.</p>
|
|
</div>
|
|
|
|
<div class="note">
|
|
<p>The OpenType/OFF specification does not explicitly prohibit the
|
|
presence of "extra" data or padding in between the font tables in the sfnt format;
|
|
as the table directory includes the offset and length of each actual table,
|
|
such data would simply be ignored. However, the WOFF format makes no
|
|
provision to preserve such "hidden" non-font-table data when packaging a font,
|
|
and therefore it would not survive a round-trip format conversion.</p>
|
|
</div>
|
|
|
|
<h2 id="Metadata">7. Extended Metadata Block</h2>
|
|
|
|
<p><span class="conform ff" id="conform-metadata-optional">The WOFF file MAY include a block of extended metadata</span>. This may be more extensive and more easily accesible than metadata present in sfnt tables. The metadata block consists of XML data compressed by
|
|
zlib; the file header specifies both the size of the actual compressed and the
|
|
original uncompressed size in order to facilitate memory allocation.</p>
|
|
|
|
<p><span class="conform ua" id="conform-metadata-noeffect">The presence (or absence) and content of the metadata block
|
|
MUST NOT affect font loading or rendering behavior of user agents</span>;
|
|
it is intended to be purely informative.
|
|
<!-- not directly testable-->
|
|
<span class="conform ua" id="conform-metadata-maydisplay">User agents MAY provide a means for users to view information about fonts
|
|
(such as a "Font Information" panel)</span>. <span class="conform ua" id="conform-metadata-authoritative">If such information is provided,
|
|
then they MUST treat the metadata block as the primary source,
|
|
and MAY fall back to presenting information from the font's <tt>name</tt>
|
|
table entries when relevant extended metadata elements are not present</span>.</p>
|
|
|
|
<p><span class="conform ff" id="conform-metadata-alwayscompress">If present, the metadata MUST be compressed</span>; it is never stored in
|
|
uncompressed form.</p>
|
|
|
|
<p><span class="conform ff" id="conform-metadata-afterfonttable">The metadata block MUST follow immediately after the last font table</span>. As all font
|
|
data tables are padded with up to three null bytes
|
|
if needed to reach a 4-byte boundary,
|
|
the beginning of the metadata block will always be 4-byte aligned.
|
|
<span class="conform ff" id="conform-metadata-noprivatepad">If the metadata block is the last block in the WOFF file,
|
|
there SHOULD be no additional padding after the end of the block</span>.</p>
|
|
|
|
<p><span class="conform ff" id="conform-metadata-wellformed">The extended metadata MUST be well-formed XML</span> <span class="conform ff" id="conform-metadata-encoding">encoded in UTF-8</span>.</p>
|
|
|
|
<p>The schema for the extended metadata XML is described below.
|
|
<span class="conform ff" id="conform-metadata-schemavalid">If the extended metadata does not match this schema,
|
|
it is invalid</span>.
|
|
<span class="conform ff" id="conform-metadata-decompressible">It is also invalid if it cannot be decompressed
|
|
by zlib's <tt>uncompress()</tt> function (or equivalent)</span>,
|
|
or <span class="conform ff" id="conform-metaOrigLength"> if the length of the decompressed data does not match the <tt>metaOrigLength</tt> value specified in the WOFF header.</span>
|
|
Thus, valid metadata is well formed, conforms to the schema below,
|
|
and is stored in compressed form in the WOFF file.
|
|
<span class="conform ua" id="conform-invalid-mustignore">
|
|
A conforming user agent MUST ignore an invalid metadata block,
|
|
as if the block were not present</span>.</p>
|
|
|
|
<p>This description is also available
|
|
<a href="metadata/woffmeta.rng">as a RelaxNG schema</a>.
|
|
In the event of a discrepancy between the RelaxNG schema
|
|
and the text of the specification, the text takes precedence.</p>
|
|
|
|
<p>Several elements store their data in <tt>text</tt>
|
|
child elements; this is to support localization. <span class="conform ff" id="conform-textlang">The <tt>text</tt>
|
|
elements MAY be given a <tt>lang</tt> attribute
|
|
in the XML namespace</span> [<cite><a href="#ref-XML">XML</a></cite>].
|
|
For backwards compatibility, <tt>lang</tt> attributes in the default namepsace
|
|
are also accepted in older content, and SHOULD be treated the same
|
|
as <tt>xml:lang</tt>.
|
|
New content SHOULD instead use <tt>xml:lang</tt>.</p>
|
|
|
|
<p>The syntax of values of the <tt>xml:lang</tt> attribute can be found in
|
|
BCP47 [<cite><a href="#ref-BCP47">BCP47</a></cite>].
|
|
A user agent displaying metadata SHOULD choose a preferred language/locale to display from among those available, following BCP47.</p>
|
|
|
|
<p><span class="conform ua" id="conform-langselect">The user agent SHOULD choose which of the available <tt>text</tt>
|
|
elements to display as follows</span>:</p>
|
|
<ol>
|
|
<li>If a <tt>text</tt> element is available that matches the user's
|
|
preferred language, as determined via
|
|
an explicit preference or implied by the current locale, use this language.</li>
|
|
<li>If the user agent has a concept of a list of "acceptable" languages or
|
|
defaults, try each of these in turn and use the first one for which a match found.</li>
|
|
<li>If there is a <tt>text</tt> element with no <tt>xml:lang</tt>
|
|
attribute, use this; in the event that more than one exists, use the first of them.</li>
|
|
<li>If no match is found yet, use the first <tt>text</tt> element.
|
|
(Thus, the metadata creator can determine the "localization of last resort"
|
|
simply by choosing which language to put first in each group of
|
|
<tt>text</tt> elements.)</li>
|
|
</ol>
|
|
|
|
<p>Such localizable elements are
|
|
indicated by the statement
|
|
"This element may be localized using <tt>text</tt> child elements"
|
|
in the description below;
|
|
the internal structure of <tt>text</tt> elements with
|
|
<tt>xml:lang</tt> attributes is not repeated for each element
|
|
type.
|
|
In each of these localizable elements,
|
|
<span class="conform ff" id="conform-localizable-text-required">at least one
|
|
<tt>text</tt> child element MUST be present</span>,
|
|
except in the case of the <tt>license</tt> element (as described below).</p>
|
|
|
|
<dl class="xmlspec">
|
|
<dt><tt>metadata</tt> element</dt>
|
|
<dd>
|
|
<p>The main element. <span class="conform ff" id="conform-metadataelement-required">This element is REQUIRED</span>.</p>
|
|
<table>
|
|
<col class="name"/><col class="desc"/>
|
|
<tr class="header"><th colspan="2">attributes</th></tr>
|
|
<tr><td>version</td><td>A version number indicating the format version of the
|
|
<tt>metadata</tt> element. This is currently <tt>1.0</tt>.
|
|
<span class="conform ff" id="conform-metadataversion-required">This attribute is REQUIRED</span>.</td></tr>
|
|
<tr class="header"><th colspan="2">children</th></tr>
|
|
<tr><td>uniqueid</td><td>Zero or one child elements</td></tr>
|
|
<tr><td>vendor</td><td>Zero or one child elements</td></tr>
|
|
<tr><td>credits</td><td>Zero or one child elements</td></tr>
|
|
<tr><td>description</td><td>Zero or one child elements</td></tr>
|
|
<tr><td>license</td><td>Zero or one child elements</td></tr>
|
|
<tr><td>copyright</td><td>Zero or one child elements</td></tr>
|
|
<tr><td>trademark</td><td>Zero or one child elements</td></tr>
|
|
<tr><td>licensee</td><td>Zero or one child elements</td></tr>
|
|
<tr><td>extension</td><td>Zero or more child elements</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
<p>All first-level child elements of the metadata are OPTIONAL, and may occur in
|
|
any order as children of the top-level <tt>metadata</tt>
|
|
element.</p>
|
|
|
|
<p>The <tt>extension</tt> element is intended to allow
|
|
vendors to include metadata that is not covered by the specific elements
|
|
defined here, while following a standard model. <span class="conform ua" id="conform-metadata-showextension">User agents that provide a means
|
|
for the user to view WOFF file metadata SHOULD include such
|
|
<tt>extension</tt> elements in the metadata presented to the user</span>.</p>
|
|
|
|
|
|
<dl class="xmlspec">
|
|
<dt><tt>uniqueid</tt> element</dt>
|
|
<dd>
|
|
<p>A unique identifier string for the font. This element is recommended, but not
|
|
required for the metadata to be valid. <!-- conform? -->This element MUST be a child of the
|
|
<tt>metadata</tt> element. This is an empty element.</p>
|
|
<table>
|
|
<col class="name"/><col class="desc"/>
|
|
<tr class="header"><th colspan="2">attributes</th></tr>
|
|
<tr><td>id</td><td>The identification string. <span class="conform ff" id="conform-metadata-id-required">This attribute is REQUIRED</span>.</td></tr>
|
|
</table>
|
|
<p>The string defined in the <tt>uniqueid</tt> element is not
|
|
guaranteed to be truly unique, as there is no central registry or authority to
|
|
ensure this, but it is intended to allow vendors to reliably identify the exact
|
|
version of a particular font. The use of "reverse-DNS" prefixes to provide a
|
|
"namespace" is recommended; this can be augmented by additional identification
|
|
data of the vendor's own design.</p>
|
|
|
|
<div class="note">
|
|
<p>The <tt>id</tt> attribute of the <tt>uniqueid</tt> element,
|
|
and of several further metadata elements defined below,
|
|
is not required to conform to the rules for the XML type ID;
|
|
its form is at the discretion of the font creator or vendor.
|
|
</p>
|
|
</div></dd>
|
|
|
|
<dt><tt>vendor</tt> element</dt>
|
|
<dd>
|
|
<p>Information about the font vendor. This element is recommended, but not
|
|
required for the metadata to be valid. <!-- conform? -->This element MUST be a child of the
|
|
<tt>metadata</tt> element. This is an empty element.</p>
|
|
<table>
|
|
<col class="name"/><col class="desc"/>
|
|
<tr class="header"><th colspan="2">attributes</th></tr>
|
|
<tr><td>name</td><td>The name of the font vendor. <span class="conform ff" id="conform-metadata-vendor-required">This attribute is REQUIRED</span>.</td></tr>
|
|
<tr><td>url</td><td>The url for the font vendor. This attribute is
|
|
OPTIONAL.</td></tr>
|
|
<tr><td>dir</td><td>The text direction, either <tt>ltr</tt> (for "left to right") or <tt>rtl</tt> (for "right to left").
|
|
This attribute is OPTIONAL and, if omitted, defaults to <tt>ltr</tt>.</td></tr>
|
|
<tr><td>class</td><td>An arbitrary set of space-separated tokens.
|
|
This attribute is OPTIONAL.</td></tr>
|
|
</table>
|
|
</dd>
|
|
|
|
<dt><tt>credits</tt> element</dt>
|
|
<dd>
|
|
<p>Credit information for the font. This can include any type of credit the
|
|
vendor desires: designer, hinter, and so on. This element is OPTIONAL. If
|
|
present, <!-- conform? -->it MUST be a child of the <tt>metadata</tt> element
|
|
and <!-- conform? -->it MUST contain at least one <tt>credit</tt> element. This
|
|
element has no attributes.</p>
|
|
<table>
|
|
<col class="name"/><col class="desc"/>
|
|
<tr class="header"><th colspan="2">children</th></tr>
|
|
<tr><td>credit</td><td>One or more child elements</td></tr>
|
|
</table>
|
|
</dd>
|
|
|
|
<dt><tt>credit</tt> element</dt>
|
|
<dd>
|
|
<p>A single credit record. <!-- conform? -->If present, it MUST be a child of the
|
|
<tt>credits</tt> element. This is an empty element.</p>
|
|
<table>
|
|
<col class="name"/><col class="desc"/>
|
|
<tr class="header"><th colspan="2">attributes</th></tr>
|
|
<tr><td>name</td><td>The name of the entity being credited. <span class="conform ff" id="conform-creditnamerequired">This attribute is REQUIRED</span>.</td></tr>
|
|
<tr><td>url</td><td>The url for the entity being credited. This attribute is
|
|
OPTIONAL.</td></tr>
|
|
<tr><td>role</td><td>The role of the entity being credited. This attribute is
|
|
OPTIONAL.</td></tr>
|
|
<tr><td>dir</td><td>The text direction, either <tt>ltr</tt> (for "left to right") or <tt>rtl</tt> (for "right to left").
|
|
This attribute is OPTIONAL and, if omitted, defaults to <tt>ltr</tt>.</td></tr>
|
|
<tr><td>class</td><td>An arbitrary set of space-separated tokens.
|
|
This attribute is OPTIONAL.</td></tr>
|
|
</table>
|
|
</dd>
|
|
|
|
<dt><tt>description</tt> element</dt>
|
|
<dd>
|
|
<p>An arbitrary text description of the font's design, its history, etc. This
|
|
element is OPTIONAL. <!-- conform? -->If present, it MUST be a child of the <tt>metadata</tt> element.
|
|
This element may be localized using <tt>text</tt> child elements.</p>
|
|
<table>
|
|
<col class="name"/><col class="desc"/>
|
|
<tr class="header"><th colspan="2">attributes</th></tr>
|
|
<tr><td>url</td><td>The url for more information about the font design, history, etc. This attribute is OPTIONAL.
|
|
</td></tr>
|
|
<tr class="header"><th colspan="2">children</th></tr>
|
|
<tr><td>text</td><td>One or more child elements containing character data and optionally <tt>div</tt> and/or <tt>span</tt> children</td></tr>
|
|
</table>
|
|
</dd>
|
|
|
|
<dt><tt>license</tt> element</dt>
|
|
<dd>
|
|
<p>Licensing information for the font.
|
|
This element is OPTIONAL. <!-- conform? -->If present, it MUST be a
|
|
child of the <tt>metadata</tt> element.
|
|
This element may be localized using <tt>text</tt> child elements;
|
|
however, it is permitted to be empty (for example, if the vendor
|
|
prefers to just provide a license URL rather than including the actual
|
|
text of the license.)</p>
|
|
<table>
|
|
<col class="name"/><col class="desc"/>
|
|
<tr class="header"><th colspan="2">attributes</th></tr>
|
|
<tr><td>url</td><td>The url for the license, more information about the license,
|
|
etc. This attribute is OPTIONAL.</td></tr>
|
|
<tr><td>id</td><td>An identifying string for the license. This attribute is
|
|
OPTIONAL.</td></tr>
|
|
<tr class="header"><th colspan="2">children</th></tr>
|
|
<tr><td>text</td><td>Zero or more child elements containing character data and optionally <tt>div</tt> and/or <tt>span</tt> children</td></tr>
|
|
</table>
|
|
</dd>
|
|
|
|
<dt><tt>copyright</tt> element</dt>
|
|
<dd>
|
|
<p>The copyright for the font. This element is OPTIONAL. <!-- conform? -->If present, it MUST be
|
|
a child of the <tt>metadata</tt> element.
|
|
This element may be localized using <tt>text</tt> child elements.
|
|
This element has no attributes.</p>
|
|
<table>
|
|
<col class="name"/><col class="desc"/>
|
|
<tr class="header"><th colspan="2">children</th></tr>
|
|
<tr><td>text</td><td>One or more child elements containing character data and optionally <tt>div</tt> and/or <tt>span</tt> children</td></tr>
|
|
</table>
|
|
</dd>
|
|
|
|
<dt><tt>trademark</tt> element</dt>
|
|
<dd>
|
|
<p>The trademark for the font. This element is OPTIONAL. <!-- conform? -->If present, it MUST be
|
|
a child of the <tt>metadata</tt> element.
|
|
This element may be localized using <tt>text</tt> child elements.
|
|
This element has no attributes.</p>
|
|
<table>
|
|
<col class="name"/><col class="desc"/>
|
|
<tr class="header"><th colspan="2">children</th></tr>
|
|
<tr><td>text</td><td>One or more child elements containing character data and optionally <tt>div</tt> and/or <tt>span</tt> children</td></tr>
|
|
</table>
|
|
</dd>
|
|
|
|
<dt><tt>licensee</tt> element</dt>
|
|
<dd>
|
|
<p>The licensee of the font. This element is OPTIONAL. <!-- conform? -->If present, it MUST be a
|
|
child of the <tt>metadata</tt> element. This is an empty
|
|
element.</p>
|
|
<table>
|
|
<col class="name"/><col class="desc"/>
|
|
<tr class="header"><th colspan="2">attributes</th></tr>
|
|
<tr><td>name</td><td>The name of the licensee. <span class="conform ff" id="conform-licensee-required">This attribute is REQUIRED</span>.</td></tr>
|
|
<tr><td>dir</td><td>The text direction, either <tt>ltr</tt> (for "left to right") or <tt>rtl</tt> (for "right to left").
|
|
This attribute is OPTIONAL and, if omitted, defaults to <tt>ltr</tt>.</td></tr>
|
|
<tr><td>class</td><td>An arbitrary set of space-separated tokens.
|
|
This attribute is OPTIONAL.</td></tr>
|
|
</table>
|
|
</dd>
|
|
|
|
</dl>
|
|
|
|
<p>Although the metadata elements and structure defined above
|
|
are expected to be sufficient for most needs,
|
|
an extension mechanism is also provided so that font vendors
|
|
can include arbitrary metadata items that do not fit
|
|
the standard elements above:</p>
|
|
|
|
<dl class="xmlspec">
|
|
<dt><tt>extension</tt> element</dt>
|
|
<dd>
|
|
<p>A container element for extended metadata provided by the vendor. Zero or more
|
|
<tt>extension</tt> elements may be present as children of
|
|
the top-level <tt>metadata</tt> element. Each such
|
|
metadata extension has an optional <tt>name</tt>,
|
|
which may be provided in multiple languages,
|
|
and one or more <tt>item</tt> elements.</p>
|
|
<table>
|
|
<col class="name"/><col class="desc"/>
|
|
<tr class="header"><th colspan="2">attributes</th></tr>
|
|
<tr><td>id</td><td>An arbitrary identifier defined by the vendor.
|
|
This attribute is OPTIONAL.</td></tr>
|
|
<tr class="header"><th colspan="2">children</th></tr>
|
|
<tr><td>name</td><td>Zero or more child elements</td></tr>
|
|
<tr><td>item</td><td>One or more child elements</td></tr>
|
|
</table>
|
|
</dd>
|
|
|
|
<dt><tt>item</tt> element</dt>
|
|
<dd>
|
|
<p><span class="conform ff" id="conform-extension-itemrequired">At least one <tt>item</tt> element MUST be present in
|
|
each <tt>extension</tt> container</span>.</p>
|
|
<table>
|
|
<col class="name"/><col class="desc"/>
|
|
<tr class="header"><th colspan="2">attributes</th></tr>
|
|
<tr><td>id</td><td>An arbitrary identifier defined by the vendor.
|
|
This attribute is OPTIONAL.</td></tr>
|
|
<tr class="header"><th colspan="2">children</th></tr>
|
|
<tr><td>name</td><td>One or more child elements</td></tr>
|
|
<tr><td>value</td><td>One or more child elements</td></tr>
|
|
</table>
|
|
</dd>
|
|
|
|
<dt><tt>name</tt> element</dt>
|
|
<dd>
|
|
<p>Zero or more <tt>name</tt> elements may be used to provide
|
|
a human-friendly name for the collection of extended metadata items
|
|
in an <tt>extension</tt> element.
|
|
<span class="conform ua" id="conform-nameoptional">A user agent
|
|
that displays metadata SHOULD choose the name with most the appropriate language
|
|
from among those available for each named <tt>extension</tt> element.
|
|
This child element is OPTIONAL in <tt>extension</tt> elements;
|
|
anonymous extension elements are also permissible.</span></p>
|
|
<p>One or more <tt>name</tt> elements are also used to provide
|
|
a human-friendly name for a specific extended metadata item. A user agent
|
|
that displays metadata SHOULD choose the name with the most appropriate language from
|
|
among those available for each <tt>item</tt> element.
|
|
<span class="conform ff" id="conform-namerequired">This child element is REQUIRED</span> in <tt>item</tt> elements;
|
|
<span class="conform ua" id="conform-noname-ignore">an <tt>item</tt> element with no
|
|
<tt>name</tt> is invalid and SHOULD be ignored</span>.</p>
|
|
<table>
|
|
<col class="name"/><col class="desc"/>
|
|
<tr class="header"><th colspan="2">attributes</th></tr>
|
|
<tr><td>xml:lang</td><td>A language tag as defined in BCP47 [<cite><a href="#ref-BCP47">BCP47</a></cite>].
|
|
This attribute is OPTIONAL.</td></tr>
|
|
<tr><td>dir</td><td>The text direction, either <tt>ltr</tt> (for "left to right") or <tt>rtl</tt> (for "right to left").
|
|
This attribute is OPTIONAL and, if omitted, defaults to <tt>ltr</tt>.</td></tr>
|
|
<tr><td>class</td><td>An arbitrary set of space-separated tokens.
|
|
This attribute is OPTIONAL.</td></tr>
|
|
</table>
|
|
</dd>
|
|
|
|
<dt><tt>value</tt> element</dt>
|
|
<dd><p>One or more <tt>value</tt> elements are used to provide
|
|
the value of a specific extended metadata item. <span class="conform ua" id="conform-value-langselect">A user agent
|
|
that displays metadata SHOULD choose the value with the most appropriate language from
|
|
among those available for each <tt>item</tt> element</span>.
|
|
<span class="conform ff" id="conform-valuerequired">This child element is REQUIRED</span>;
|
|
<span class="conform ua" id="conform-novalue-ignore">an <tt>item</tt> element with no
|
|
<tt>value</tt> is invalid and SHOULD be ignored</span>.</p>
|
|
<table>
|
|
<col class="name"/><col class="desc"/>
|
|
<tr class="header"><th colspan="2">attributes</th></tr>
|
|
<tr><td>xml:lang</td><td>A language tag as defined in BCP47 [<cite><a href="#ref-BCP47">BCP47</a></cite>].
|
|
This attribute is OPTIONAL.</td></tr>
|
|
<tr><td>dir</td><td>The text direction, either <tt>ltr</tt> (for "left to right") or <tt>rtl</tt> (for "right to left").
|
|
This attribute is OPTIONAL and, if omitted, defaults to <tt>ltr</tt>.</td></tr>
|
|
<tr><td>class</td><td>An arbitrary set of space-separated tokens.
|
|
This attribute is OPTIONAL.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
<p>Where <tt>text</tt> elements are used to contain (localizable) content,
|
|
further structure MAY also be provided
|
|
using <tt>div</tt> and <tt>span</tt> child elements
|
|
similar to those used in HTML.</p>
|
|
|
|
<dl class="xmlspec">
|
|
<dt><tt>text</tt> element</dt>
|
|
<dd>
|
|
<p>An element used to contain a particular localization of a metadata element's contents. This element has a mixed content model;
|
|
in addition to the child elements mentioned below, it may directly contain character data.</p>
|
|
<table>
|
|
<col class="name"/><col class="desc"/>
|
|
<tr class="header"><th colspan="2">attributes</th></tr>
|
|
<tr><td>xml:lang</td><td>A language tag (as specified in BCP47 [<cite><a href="#ref-BCP47">BCP47</a></cite>]) indicating
|
|
the language of this particular version of the metadata element's content.
|
|
This attribute is OPTIONAL; however, for multiple <tt>text</tt> children
|
|
of a metadata element to be usefully distinguished,
|
|
they SHOULD all be tagged with appropriate different language codes.</td></tr>
|
|
<tr><td>dir</td><td>The text direction, either <tt>ltr</tt> (for "left to right") or <tt>rtl</tt> (for "right to left").
|
|
This attribute is OPTIONAL and, if omitted, defaults to <tt>ltr</tt>.</td></tr>
|
|
<tr><td>class</td><td>An arbitrary set of space-separated tokens.
|
|
This attribute is OPTIONAL.</td></tr>
|
|
<tr class="header"><th colspan="2">children</th></tr>
|
|
<tr><td>div</td><td>Contains a block of text, such as a paragraph or heading.</td></tr>
|
|
<tr><td>span</td><td>Contains an inline run of text.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
<dl class="xmlspec">
|
|
<dt><tt>div</tt> element</dt>
|
|
<dd>
|
|
<p>A block-level element used, for example, to contain a paragraph.</p>
|
|
<table>
|
|
<col class="name"/><col class="desc"/>
|
|
<tr class="header"><th colspan="2">attributes</th></tr>
|
|
<tr><td>dir</td><td>The text direction, either <tt>ltr</tt> (for "left to right") or <tt>rtl</tt> (for "right to left").
|
|
This attribute is OPTIONAL and, if omitted, defaults to <tt>ltr</tt>.</td></tr>
|
|
<tr><td>class</td><td>An arbitrary set of space-separated tokens.
|
|
This attribute is OPTIONAL.</td></tr>
|
|
</table>
|
|
</dd>
|
|
|
|
<dt><tt>span</tt> element</dt>
|
|
<dd>
|
|
<p>An inline element used, for example, to indicate a run of text
|
|
with a different text direction, or in a different language.</p>
|
|
<table>
|
|
<col class="name"/><col class="desc"/>
|
|
<tr class="header"><th colspan="2">attributes</th></tr>
|
|
<tr><td>dir</td><td>The text direction, either <tt>ltr</tt> (for "left to right") or <tt>rtl</tt> (for "right to left").
|
|
This attribute is OPTIONAL and, if omitted, defaults to <tt>ltr</tt>.</td></tr>
|
|
<tr><td>class</td><td>An arbitrary set of space-separated tokens.
|
|
This attribute is OPTIONAL.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
|
|
<p>The <tt>text</tt> elements used to hold
|
|
(localizable) text for a number of the individual pieces of metadata
|
|
thus have a mixed content model consisting of text content,
|
|
<tt>div</tt> and <tt>span</tt> elements;
|
|
<tt>div</tt> elements have a mixed content model of text content,
|
|
<tt>div</tt> and <tt>span</tt> elements;
|
|
and <tt>span</tt> elements have a mixed content model of text content
|
|
and <tt>span</tt> elements.
|
|
In other words, <tt>div</tt> can contain other <tt>div</tt> elements;
|
|
<tt>span</tt> can contain other <tt>span</tt> elements;
|
|
<tt>span</tt> does not require a containing <tt>div</tt>.</p>
|
|
|
|
<p><a href="#appendix-a">Appendix A</a> includes several examples
|
|
of the content of the metadata block.</p>
|
|
|
|
<div class="note">
|
|
<p>Although the metadata block is optional,
|
|
and there is no requirement for user agents to process it
|
|
in order to render the font,
|
|
clients such as Web browsers are encouraged to provide a means
|
|
(such as a "Font Information" dialog for the current page)
|
|
for users to view the metadata included in WOFF files.
|
|
Not every client will necessarily have an appropriate context for this,
|
|
but any client that enables the user to find out about the resources used by a Web document
|
|
should consider exposing information about the fonts used, and in the case of
|
|
WOFF-packaged fonts, the metadata block is the primary source of this information.</p>
|
|
</div>
|
|
|
|
<h2 id="Private">8. Private Data Block</h2>
|
|
|
|
<p><span class="conform ff" id="conform-private">The WOFF file MAY include a block of arbitrary data</span>, allowing font creators
|
|
to include whatever information they wish. <span class="conform ua" id="conform-private-noeffect">The content of this data MUST NOT
|
|
affect font usage or load behavior of user agents</span>.
|
|
User agents should make no assumptions
|
|
about the content of a private block; it may (for example) contain ASCII or
|
|
Unicode text, or some vendor-defined binary data, and it may be compressed or
|
|
encrypted, but it has no publicly defined format. Conformant user agents will
|
|
not assume anything about the structure of this data. Only the font developer or
|
|
vendor responsible for the private block is expected to understand its
|
|
contents.</p>
|
|
|
|
<p><span class="conform ff" id="conform-private-last">The private data block, if present, MUST be the last block in the WOFF file,
|
|
following all the font tables and any extended metadata block</span>.
|
|
<span class="conform ff" id="conform-private-padalign">The private data
|
|
block MUST begin on a 4-byte boundary in the WOFF file, with up to three null
|
|
bytes inserted as padding after any preceding metadata block
|
|
if needed to ensure this</span>.
|
|
<span class="conform ff" id="conform-private-end">The end of the private data block MUST correspond to the end of the WOFF file</span>.</p>
|
|
|
|
|
|
<hr/>
|
|
|
|
<h2 id="appendix-a">Appendix A: Extended Metadata Examples</h2>
|
|
|
|
<p>This appendix is purely informative, not a normative part of the WOFF specification.</p>
|
|
|
|
<p>This "dummy" metadata block illustrates the use of the metadata elements
|
|
described in section 7, including the use of multiple <tt>text</tt>
|
|
child elements to provide localized versions of certain elements.</p>
|
|
|
|
<div class="metadata">
|
|
<pre>
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<metadata version="1.0">
|
|
<uniqueid id="com.example.fontvendor.demofont.rev12345" />
|
|
<vendor name="Font Vendor" url="http://fontvendor.example.com" />
|
|
<credits>
|
|
<credit
|
|
name="Font Designer"
|
|
url="http://fontdesigner.example.com"
|
|
role="Lead" />
|
|
<credit
|
|
name="Another Font Designer"
|
|
url="http://anotherdesigner.example.org"
|
|
role="Contributor" />
|
|
<credit
|
|
name="Yet Another"
|
|
role="Hinting" />
|
|
</credits>
|
|
<description>
|
|
<text xml:lang="en">
|
|
A member of the Demo font family.
|
|
This font is a humanist sans serif style designed
|
|
for optimal legibility in low-resolution environments.
|
|
It can be obtained from fontvendor.example.com.
|
|
</text>
|
|
</description>
|
|
<license url="http://fontvendor.example.com/license"
|
|
id="fontvendor-Web-corporate-v2">
|
|
<text xml:lang="en">A license goes here.</text>
|
|
<text xml:lang="fr">Un permis va ici.</text>
|
|
</license>
|
|
<copyright>
|
|
<text xml:lang="en">Copyright ©2009 Font Vendor"</text>
|
|
<text xml:lang="ko">저작권 ©2009 Font Vendor"</text>
|
|
</copyright>
|
|
<trademark>
|
|
<text xml:lang="en">Demo Font is a trademark of Font Vendor</text>
|
|
<text xml:lang="fr">Demo Font est une marque déposée de Font Vendor</text>
|
|
<text xml:lang="de">Demo Font ist ein eingetragenes Warenzeichen der Font Vendor</text>
|
|
<text xml:lang="ja">Demo FontはFont Vendorの商標である</text>
|
|
</trademark>
|
|
<licensee name="Wonderful Websites, Inc." />
|
|
<extension id="org.example.fonts.metadata.v1">
|
|
<name xml:lang="en">Additional font information</name>
|
|
<name xml:lang="fr">L'information supplémentaire de fonte</name>
|
|
<item id="org.example.fonts.metadata.v1.why">
|
|
<name xml:lang="en">Purpose</name>
|
|
<name xml:lang="fr">But</name>
|
|
<value xml:lang="en">This font exists merely as an example of WOFF packaging.</value>
|
|
<value xml:lang="fr">Cette fonte existe simplement comme exemple de l'empaquetage de WOFF.</value>
|
|
</item>
|
|
</extension>
|
|
</metadata>
|
|
</pre>
|
|
</div>
|
|
|
|
<p>A real-life example of a simple metadata block
|
|
(reproduced by permission of FSI FontShop International GmbH).</p>
|
|
|
|
<div class="metadata">
|
|
<pre>
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<metadata version="1.0">
|
|
<uniqueid id="com.fontfont.PraterScriptWeb.7.504.1002"/>
|
|
<vendor name="FSI FontShop International GmbH" url="http://www.fontfont.com"/>
|
|
<credits>
|
|
<credit name="Steffen Sauerteig" role="design"/>
|
|
<credit name="Henning Wagenbreth" role="design"/>
|
|
<credit name="FSI FontShop International GmbH" url="http://www.fontfont.com" role="production"/>
|
|
</credits>
|
|
<description>
|
|
<text lang="en">A FontFont for the Web</text>
|
|
</description>
|
|
<license url="http://www.fontfont.com/support/licensing_web.ep" id="fontfont-Web-v1">
|
|
<text lang="en">
|
|
FontFont Web license v 1.0.
|
|
For details see http://www.fontfont.com/eula/license_Webfonts_v_1_0.html
|
|
</text>
|
|
</license>
|
|
<copyright>
|
|
<text lang="en">2009 Henning Wagenbreth, Steffen Sauerteig published by FSI FontShop International GmbH</text>
|
|
</copyright>
|
|
<trademark>
|
|
<text lang="en">Prater is a trademark of FSI FontShop International GmbH</text>
|
|
</trademark>
|
|
</metadata>
|
|
</pre>
|
|
</div>
|
|
|
|
<p>Another example of a metadata block (reproduced by permission of Ascender Corporation).
|
|
This is dynamically generated, with the <tt>uniqueid</tt> and
|
|
<tt>licensee</tt> elements modified to be unique for each customer.</p>
|
|
|
|
<div class="metadata">
|
|
<pre>
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<metadata version="1.0">
|
|
<uniqueid id="037d0f6b-b5e3-b841-05afa509061b" />
|
|
<vendor name="Ascender Corp" url="http://www.fontslive.com" />
|
|
<license url="http://www.fontslive.com/info/Web-fonts-eula.aspx"
|
|
id="ascender-Webfonts-eula-v1">
|
|
<text lang="en">This font software is the valuable property of Ascender
|
|
Corporation and/or its suppliers and its use by you is covered under the
|
|
terms of the Web Font license agreement between you and Ascender
|
|
Corporation. You may ONLY use this font software with the licensed Web site.
|
|
Except as specifically permitted by the license, you may not copy this font
|
|
software. If you have any questions, please contact Ascender Corp.</text>
|
|
</license>
|
|
<licensee name="FontsLive.com" />
|
|
</metadata>
|
|
</pre>
|
|
</div>
|
|
|
|
<p>Here is an example of how the <tt>div</tt> element could be used,
|
|
modified from a portion of the
|
|
<a href="http://dev.w3.org/webfonts/WOFF/spec/metadata/GentiumPlus-WOFF-metadata.xml">XML file for Gentium Plus</a>
|
|
which, when viewed as plain text, has paragraph formatting.</p>
|
|
|
|
<p>The original metadata file contained:</p>
|
|
<div class="metadata">
|
|
<pre>
|
|
<description>
|
|
<text lang="en">
|
|
Gentium ("belonging to the nations" in Latin) is a Unicode typeface family
|
|
designed to enable the many diverse ethnic groups around the world who use
|
|
the Latin, Cyrillic and Greek scripts to produce readable, high-quality
|
|
publications. The design is intended to be highly readable, reasonably
|
|
compact, and visually attractive. Gentium has won a "Certificate of Excellence
|
|
in Typeface Design" in two major international typeface design competitions:
|
|
bukva:raz! (2001), TDC2003 (2003).
|
|
|
|
The Gentium Plus font family is based on the original design. It currently
|
|
comes with regular and italic face only, although additional weights are in
|
|
development.
|
|
|
|
The goal for this product is to provide a single Unicode-based font family
|
|
that contains a comprehensive inventory of glyphs needed for almost any
|
|
Roman- or Cyrillic-based writing system, whether used for phonetic or
|
|
orthographic needs, and provide a matching Greek face. In addition, there
|
|
is provision for other characters and symbols useful to linguists. This
|
|
font makes use of state-of-the-art font technologies to support complex
|
|
typographic issues, such as the need to position arbitrary combinations
|
|
of base glyphs and diacritics optimally.
|
|
|
|
(and so on)
|
|
</text>
|
|
</description>
|
|
</pre>
|
|
</div>
|
|
|
|
<p>Using the <tt>div</tt> element, this could become:</p>
|
|
|
|
<div class="metadata">
|
|
<pre>
|
|
<description>
|
|
<text xml:lang="en">
|
|
<div>Gentium ("belonging to the nations" in Latin) is a Unicode
|
|
typeface family designed to enable the many diverse ethnic groups
|
|
around the world who use the Latin, Cyrillic and Greek scripts to
|
|
produce readable, high-quality publications. The design is intended
|
|
to be highly readable, reasonably compact, and visually attractive.
|
|
Gentium has won a "Certificate of Excellence in Typeface
|
|
Design" in two major international typeface design
|
|
competitions: bukva:raz! (2001), TDC2003 (2003).</div>
|
|
<div>The Gentium Plus font family is based on the original design.
|
|
It currently comes with regular and italic face only, although
|
|
additional weights are in development.</div>
|
|
<div>The goal for this product is to provide a single Unicode-based
|
|
font family that contains a comprehensive inventory of glyphs
|
|
needed for almost any Roman- or Cyrillic-based writing system,
|
|
whether used for phonetic or orthographic needs, and provide a
|
|
matching Greek face. In addition, there is provision for other
|
|
characters and symbols useful to linguists. This font makes use of
|
|
state-of-the-art font technologies to support complex typographic
|
|
issues, such as the need to position arbitrary combinations of base
|
|
glyphs and diacritics optimally.</div>
|
|
|
|
(and so on)
|
|
</text>
|
|
</description>
|
|
</pre>
|
|
</div>
|
|
|
|
<h2 id="appendix-b">Appendix B: Media Type registration</h2>
|
|
|
|
<p>
|
|
This appendix registers a new MIME media type, in conformance with <a href="http://www.ietf.org/rfc/rfc4288.txt">BCP 13</a> and <a href="http://www.w3.org/2002/06/registering-mediatype.html">W3CRegMedia</a>.
|
|
</p>
|
|
|
|
<dl><dt>
|
|
Type name:</dt><dd>
|
|
<p>
|
|
application
|
|
</p>
|
|
|
|
</dd><dt>
|
|
Subtype name:</dt><dd>
|
|
<p>
|
|
font-woff
|
|
</p>
|
|
|
|
</dd><dt>
|
|
Required parameters:</dt><dd>
|
|
|
|
<p>
|
|
None.
|
|
</p>
|
|
|
|
</dd><dt>
|
|
Optional parameters:</dt><dd>
|
|
<p>
|
|
None.
|
|
</p>
|
|
|
|
</dd><dt>
|
|
Encoding considerations:</dt><dd>
|
|
<p>
|
|
binary.
|
|
</p>
|
|
|
|
</dd><dt>
|
|
Security considerations:</dt><dd>
|
|
<p>
|
|
Fonts are interpreted data structures that represent collections of glyph outlines, metrics and layout information for various languages and writing systems. Currently, there are many standardized font data tables that allow an unspecified number of entries, and where existing, predefined data fields allow storage of binary data with variable length. There is a significant risk that the flexibility of font data structures may be exploited to hide malicious binary content disguised as a font data component.</p>
|
|
|
|
<p>WOFF is based on the table-based SFNT (scalable font) format which is highly extensible and offers an opportunity to introduce additional data structures when needed. However, this same extensibility may present specific security concerns – the flexibility and ease of defining new data structures makes it easy for any arbitrary data to be added and hidden inside a font file.</p>
|
|
|
|
<p>WOFF fonts may contain 'hints' for the alignment of graphical elements of the glyphs with the target display pixel grid, and depending on the font technology utilized in the creation of a font these hints may represent active code interpreted and executed by the font rasterizer. Even though they operate within the confines of the glyph outline conversion system and have no access outside the font rendering machinery, hint instructions can be, however, quite complex, and a maliciously designed complex font could cause undue resource consumption (e.g. memory or CPU cycles) on a machine interpreting it. Indeed, fonts are sufficiently complex that most if not all interpreters cannot be completely protected from malicious fonts without undue performance penalties.</p>
|
|
|
|
<p>Widespread use of fonts as necessary component of visual content presentation warrants that a careful attention should be given to security considerations whenever a font is either embedded into an electronic document or transmitted alongside media content as a linked resource.</p>
|
|
|
|
<p>WOFF uses gzip compression. The WOFF header contains the uncompressed length of each compressed table. Applications may therefore constrain the size of memory buffer allocated for decompression and may stop writing if a maliciously crafted WOFF file in fact contains more data than is indicated.
|
|
</p>
|
|
</dd>
|
|
<dt>Interoperability considerations:</dt>
|
|
<dd><p></p></dd>
|
|
|
|
<dt>Published specification:</dt>
|
|
<dd><p>This media type registration is extracted from
|
|
the <a href="http://www.w3.org/TR/WOFF">WOFF specification</a> at W3C.</p></dd>
|
|
|
|
<dt>Applications that use this media type:</dt>
|
|
<dd><p>WOFF is used by Web browsers, often in conjunction with HTML and CSS. </p></dd>
|
|
|
|
<dt>
|
|
Additional information:</dt><dd><dl><dt>Magic number(s):</dt><dd>The signature field in the WOFF header MUST contain the "magic number" 0x774F4646</dd><dt>File extension(s):</dt><dd>woff</dd><dt>Macintosh file type code(s):</dt><dd>(no code specified)</dd><dt>Macintosh Universal Type Identifier code: </dt><dd><tt>org.w3c.woff</tt> </dd><dt>Fragment Identifiers</dt><dd>none.</dd></dl>
|
|
|
|
</dd><dt>
|
|
Person & email address to contact for further information:</dt><dd>
|
|
<p>
|
|
Chris Lilley (www-font@w3.org).
|
|
</p>
|
|
|
|
</dd><dt>
|
|
Intended usage:</dt><dd>
|
|
<p>
|
|
COMMON
|
|
</p>
|
|
|
|
</dd><dt>
|
|
|
|
Restrictions on usage:</dt><dd>
|
|
<p>
|
|
None
|
|
</p>
|
|
|
|
</dd><dt>
|
|
Author:</dt><dd>
|
|
<p>
|
|
The WOFF specification is a work product of the World Wide Web Consortium's WebFonts Working Group.
|
|
</p>
|
|
|
|
</dd><dt>
|
|
Change controller:</dt><dd>
|
|
<p>
|
|
|
|
The W3C has change control over this specification.
|
|
</p>
|
|
|
|
</dd>
|
|
</dl>
|
|
|
|
<h2 id="changes">Appendix C: Changes</h2>
|
|
|
|
<p>The following changes have been made, relative to the
|
|
<a href="http://www.w3.org/TR/2010/WD-WOFF-20100727">27 July 2010 First Public Working Draft</a>. No new features have been added, except for optional enhancements to the metadata format; the remaining changes are clarifications and corrections to existing features.</p>
|
|
|
|
<ul>
|
|
<li>Clarified that WOFF is a font <em>packaging</em> or wrapper format, not a new font format as such.</li>
|
|
<li>Clarified padding and byte-alignment requirements throughout</li>
|
|
<li>Preferred the term 'input font' rather than 'original file' to describe
|
|
the font which is converted to WOFF</li>
|
|
<li>Clarified that any subsetting, checksum-correction, or DSIG invalidating changes <em>prior</em> to WOFF conversion are out of scope for the WOFF specification.</li>
|
|
<li>Clarified meaning of totalSfntSize.</li>
|
|
<li>Defined what is meant by a well formed input font.</li>
|
|
<li>Clarified meaning of 'invalid metadata' - must be well-formed, compressed, and conform to the schema.</li>
|
|
<li>Clarified which elements and attributes in the XML are required;
|
|
for elements, clarified their required parents.</li>
|
|
<li>Clarified that the id attribute is not of type ID in the XML sense</li>
|
|
<li>Added link to a RelaxNG grammar, which tries to express the same constraints as the prose in a machine-readable manner. The prose is normative in case of any difference.</li>
|
|
<li>Added reminder to check for overflow when decompressing.</li>
|
|
<li>Added a Media Type registration template as required by <a href="http://www.w3.org/2002/06/registering-mediatype.html">W3C Media Type registration</a> policies.</li>
|
|
<li>Separated normative and informative references.</li>
|
|
<li>Switched to upper-case for RFC-2119 keywords.</li>
|
|
<li>Added id and class attributes to all testable assertions.</li>
|
|
<li>Added some non-normative explanatory notes.</li>
|
|
<li>Minor clarifications to wording throughout.</li>
|
|
<li>Some re-ordering of text to group related assertions or to improve readability; in particular, the best practices were previously an appendix and are now integrated into the main body of the specification.</li>
|
|
<li>Added this Changes appendix.</li>
|
|
</ul>
|
|
|
|
<p>The following changes were made as a result of Last Call:</p>
|
|
<ul>
|
|
<li>Language attributes now reference BCP47, and use <tt>xml:lang</tt>.</li>
|
|
<li>Added optional <tt>div</tt> and <tt>span</tt> elements that can be used to provide structure within metadata text.</li>
|
|
<li>Added <tt>dir</tt> and <tt>class</tt> attributes to metadata elements.</li>
|
|
<li>Removed summary of conformance requirements (duplicated material from the main body of the specification).</li>
|
|
<li>Somewhat rearranged and clarified description of the metadata format.</li>
|
|
<li>Noted that same-origin requirements are at risk, in the expectation that CSS3 Fonts will handle this instead.</li>
|
|
<li>Mention the need to compute the binary search fields when reconstructing an sfnt header.</li>
|
|
<li>Require that metadata be encoded in UTF-8, rather than allowing either UTF-8 or UTF-16.</li>
|
|
</ul>
|
|
|
|
<p>A <a href="http://dev.w3.org/cvsweb/webfonts/WOFF/spec/Overview.html.diff?r1=1.58;r2=1.96;f=h">color-coded diff</a> between the editors draft used to prepare the Last Call Working Draft, and the editors draft used to prepare this Candidate Recommendation, is available.</p>
|
|
|
|
<hr/>
|
|
|
|
<h2 id="References">References</h2>
|
|
|
|
<h3 id="normative">Normative References</h3>
|
|
|
|
<dl>
|
|
<dt id="ref-BCP47">[BCP47]</dt>
|
|
<dd><cite><a
|
|
href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt">BCP 47</a> Tags for Identifying Languages and Matching of Language Tags</cite></dd>
|
|
|
|
<dt id="ref-CORS">[CORS]</dt>
|
|
<dd><cite><a
|
|
href="http://www.w3.org/TR/cors/">Cross-Origin Resource Sharing</a>, A. van Kesteren, Editor. World Wide Web Consortium, 27 July 2010. The <a
|
|
href="http://www.w3.org/TR/cors/">latest version of CORS</a> is available at http://www.w3.org/TR/cors/. (Work in Progress)</cite></dd>
|
|
|
|
<dt id="ref-CSS3-Fonts">[CSS3-Fonts]</dt>
|
|
<dd><cite><a
|
|
href="http://www.w3.org/TR/css3-fonts/">CSS Fonts Module Level 3</a>. J. Daggett, Editor. World Wide Web Consortium, 18 June 2009. The <a href="http://www.w3.org/TR/css3-fonts/">latest version of CSS3 Fonts</a> is available at http://www.w3.org/TR/css3-fonts/. (Work in Progress).
|
|
</cite></dd>
|
|
|
|
<dt id="ref-HTML5">[HTML5]</dt>
|
|
<dd><cite><a
|
|
href="http://www.w3.org/TR/2010/WD-html5-20101019/">HTML5</a>. I Hickson, Editor. World Wide Web Consortium,
|
|
19 October 2010. The <a href="http://www.w3.org/TR/html5/">latest edition of HTML5</a>
|
|
is available at http://www.w3.org/TR/html5/. (Work in Progress).
|
|
</cite></dd>
|
|
|
|
<dt id="ref-OFF">[OFF]</dt>
|
|
<dd><cite><a
|
|
href="http://standards.iso.org/ittf/PubliclyAvailableStandards/
|
|
c052136_ISO_IEC_14496-22_2009(E).zip">Open Font Format specification</a> (ISO/IEC
|
|
14496-22:2009).</cite></dd>
|
|
|
|
<dt id="ref-RFC-2119">[RFC-2119]</dt>
|
|
<dd><cite><a href="http://tools.ietf.org/html/rfc2119">RFC 2119:</a> Key words for
|
|
use in RFCs to Indicate Requirement Levels. S. Bradner, Editor. Internet Engineering Task Force, March 1997. </cite></dd>
|
|
|
|
<dt id="ref-ZLIB">[ZLIB]</dt>
|
|
<dd><cite><a href="http://tools.ietf.org/html/rfc1950">RFC 1950</a> ZLIB
|
|
Compressed Data Format Specification. P. Deutsch, J-L. Gailly, Editors. Internet Engineeering Task Force, May 1996.</cite></dd>
|
|
</dl>
|
|
|
|
<h3 id="informative">Informative References</h3>
|
|
|
|
<dl>
|
|
|
|
<dt id="ref-Compress2">[Compress2]</dt>
|
|
<dd><cite><a
|
|
href="http://refspecs.freestandards.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/zlib-compress2-1.html">zlib compress2() function</a></cite></dd>
|
|
|
|
<dt id="ref-OT">[OpenType]</dt>
|
|
<dd><cite><a href="http://www.microsoft.com/typography/otspec/">Microsoft OpenType
|
|
specification</a>, version 1.6. Microsoft, 2009. OpenType is a registered trademark of Microsoft
|
|
Corporation.</cite></dd>
|
|
|
|
<dt id="ref-TT">[TrueType]</dt>
|
|
<dd><cite><a href="http://developer.apple.com/fonts/TTRefMan/">Apple
|
|
TrueType Reference manual</a>. Apple, 2002. TrueType is a registered trademark of Apple
|
|
Computer, Inc.</cite></dd>
|
|
|
|
<dt id="ref-Uncompress">[Uncompress]</dt>
|
|
<dd><cite><a
|
|
href="http://refspecs.freestandards.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/zlib-uncompress-1.html">zlib uncompress() function</a></cite></dd>
|
|
|
|
<dt id="ref-XML">[XML]</dt>
|
|
<dd><cite><a
|
|
href="http://www.w3.org/TR/xml/">Extensible Markup Language</a></cite></dd>
|
|
|
|
</dl>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|