Skip to content

Commit b08ce48

Browse files
author
John Daggett
committed
make same-origin restriction required
1 parent a134143 commit b08ce48

1 file changed

Lines changed: 125 additions & 88 deletions

File tree

css3-fonts/Overview.html

Lines changed: 125 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
}
102102

103103
</style>
104-
<link href="http://www.w3.org/StyleSheets/TR/W3C-WD.css" rel=stylesheet
104+
<link href="http://www.w3.org/StyleSheets/TR/W3C-ED.css" rel=stylesheet
105105
type="text/css">
106106

107107
<body>
@@ -111,15 +111,15 @@
111111

112112
<h1>CSS Fonts Module Level 3</h1>
113113

114-
<h2 class="no-num no-toc" id=w3c-working-draft-24-march-2011>W3C Working
115-
Draft 24 March 2011</h2>
114+
<h2 class="no-num no-toc" id=editors-draft-7-april-2011>Editor's Draft 7
115+
April 2011</h2>
116116

117117
<dl id=authors>
118-
<dt>This version:</dt>
119-
<!-- <dd><a href="http://dev.w3.org/csswg/css3-fonts/">http://dev.w3.org/csswg/css3-fonts/</a> -->
118+
<dt>This version:
120119

121120
<dd><a
122-
href="http://www.w3.org/TR/2011/WD-css3-fonts-20110324">http://www.w3.org/TR/2011/WD-css3-fonts-20110324</a>
121+
href="http://dev.w3.org/csswg/css3-fonts/">http://dev.w3.org/csswg/css3-fonts/</a>
122+
<!-- <dd><a href="http://www.w3.org/TR/2011/ED-css3-fonts-20110407">http://www.w3.org/TR/2011/ED-css3-fonts-20110407</a> -->
123123

124124

125125
<dt>Latest version:
@@ -134,6 +134,9 @@ <h2 class="no-num no-toc" id=w3c-working-draft-24-march-2011>W3C Working
134134

135135
<dt>Previous version (CSS3 Fonts):
136136

137+
<dd><a
138+
href="http://www.w3.org/TR/2011/WD-css3-fonts-20110324">http://www.w3.org/TR/2011/WD-css3-fonts-20110324</a>
139+
137140
<dd><a
138141
href="http://www.w3.org/TR/2009/WD-css3-fonts-20090618">http://www.w3.org/TR/2009/WD-css3-fonts-20090618</a>
139142

@@ -181,41 +184,35 @@ <h2 class="no-num no-toc" id=abstract>Abstract</h2>
181184
<h2 class="no-num no-toc" id=status>Status of this document</h2>
182185
<!--begin-status-->
183186

184-
<p><em>This section describes the status of this document at the time of
185-
its publication. Other documents may supersede this document. A list of
186-
current W3C publications and the latest revision of this technical report
187-
can be found in the <a href="http://www.w3.org/TR/">W3C technical reports
188-
index at http://www.w3.org/TR/.</a></em>
189-
190-
<p>Publication as a Working Draft does not imply endorsement by the W3C
191-
Membership. This is a draft document and may be updated, replaced or
192-
obsoleted by other documents at any time. It is inappropriate to cite this
193-
document as other than work in progress.
187+
<p>This is a public copy of the editors' draft. It is provided for
188+
discussion only and may change at any moment. Its publication here does
189+
not imply endorsement of its contents by W3C. Don't cite this document
190+
other than as work in progress.
194191

195192
<p>The (<a
196193
href="http://lists.w3.org/Archives/Public/www-style/">archived</a>) public
197-
mailing list <a href="mailto:www-style@w3.org">www-style@w3.org</a> (see
198-
<a href="http://www.w3.org/Mail/Request">instructions</a>) is preferred
199-
for discussion of this specification. When sending e-mail, please put the
200-
text “css3-fonts” in the subject, preferably like this:
194+
mailing list <a
195+
href="mailto:www-style@w3.org?Subject=%5Bcss3-fonts%5D%20PUT%20SUBJECT%20HERE">
196+
www-style@w3.org</a> (see <a
197+
href="http://www.w3.org/Mail/Request">instructions</a>) is preferred for
198+
discussion of this specification. When sending e-mail, please put the text
199+
“css3-fonts” in the subject, preferably like this:
201200
“[<!---->css3-fonts<!---->] <em>…summary of comment…</em>
202201

203-
<p>This document was produced by the <a
204-
href="http://www.w3.org/Style/CSS/members">CSS Working Group</a> (part of
205-
the <a href="http://www.w3.org/Style/">Style Activity</a>).
202+
<p>This document was produced by the <a href="/Style/CSS/members">CSS
203+
Working Group</a> (part of the <a href="/Style/">Style Activity</a>).
206204

207205
<p>This document was produced by a group operating under the <a
208-
href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February
209-
2004 W3C Patent Policy</a>. W3C maintains a <a
210-
href="http://www.w3.org/2004/01/pp-impl/32061/status"
206+
href="/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent
207+
Policy</a>. W3C maintains a <a href="/2004/01/pp-impl/32061/status"
211208
rel=disclosure>public list of any patent disclosures</a> made in
212209
connection with the deliverables of the group; that page also includes
213210
instructions for disclosing a patent. An individual who has actual
214211
knowledge of a patent which the individual believes contains <a
215-
href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential
212+
href="/Consortium/Patent-Policy-20040205/#def-essential">Essential
216213
Claim(s)</a> must disclose the information in accordance with <a
217-
href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
218-
6 of the W3C Patent Policy</a>.</p>
214+
href="/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the
215+
W3C Patent Policy</a>.</p>
219216
<!--end-status-->
220217

221218
<h3 class="no-num no-toc" id=atrisk>Features at risk</h3>
@@ -288,6 +285,12 @@ <h2 class="no-num no-toc" id=contents>Table of contents</h2>
288285

289286
<li><a href="#font-rend-desc"><span class=secno>4.6 </span>Font
290287
features: the font-variant and font-feature-settings descriptors</a>
288+
289+
<li><a href="#font-face-loading"><span class=secno>4.7 </span>Font
290+
loading guidelines</a>
291+
292+
<li><a href="#same-origin-restriction"><span class=secno>4.8
293+
</span>Same-origin restriction for fonts</a>
291294
</ul>
292295

293296
<li><a href="#font-matching-algorithm"><span class=secno>5 </span>Font
@@ -353,13 +356,10 @@ <h2 class="no-num no-toc" id=contents>Table of contents</h2>
353356
<li><a href="#rendering-considerations"><span class=secno>7
354357
</span>Resolving font feature settings </a>
355358

356-
<li class=no-num><a href="#same-origin-restriction">Appendix A:
357-
Same-origin restriction for fonts</a>
358-
359-
<li class=no-num><a href="#platform-props-to-css">Appendix B: Mapping
359+
<li class=no-num><a href="#platform-props-to-css">Appendix A: Mapping
360360
platform font properties to CSS properties</a>
361361

362-
<li class=no-num><a href="#font-licensing">Appendix C: Font licensing
362+
<li class=no-num><a href="#font-licensing">Appendix B: Font licensing
363363
issues</a>
364364

365365
<li class=no-num><a href="#ch-ch-ch-changes">Changes</a>
@@ -2131,7 +2131,7 @@ <h3 id=src-desc><span class=secno>4.3 </span>Font reference: the <a
21312131
format hints "truetype" and "opentype" must be considered as synonymous; a
21322132
format hint of "opentype" does not imply that the font contains Postscript
21332133
CFF style glyph data or that it contains OpenType layout information (see
2134-
Appendix B for more background on this).
2134+
Appendix A for more background on this).
21352135

21362136
<p>When authors would prefer to use a locally available copy of a given
21372137
font and download it if it's not, local() can be used. The locally
@@ -2625,6 +2625,92 @@ <h3 id=font-rend-desc><span class=secno>4.6 </span>Font features: the <a
26252625
omitted. When multiple font feature descriptors or properties are used,
26262626
the cumulative effect on text rendering is described below.
26272627

2628+
<h3 id=font-face-loading><span class=secno>4.7 </span>Font loading
2629+
guidelines</h3>
2630+
2631+
<p>The @font-face rule is designed to allow lazy loading of fonts, fonts
2632+
are only downloaded when needed for use within a document. A stylesheet
2633+
can include @font-face rules for a library of fonts of which only a select
2634+
set are used; user agents must only download those fonts that are referred
2635+
to within the style rules applicable to a given page. User agents that
2636+
download all fonts defined in @font-face rules without considering whether
2637+
those fonts are in fact used within a page are considered non-conformant.
2638+
In cases where a font might be downloaded in character fallback cases,
2639+
user agents may download a font if it's listed in a font list but is not
2640+
actually used for a given text run.
2641+
2642+
<pre>
2643+
@font-face {
2644+
font-family: GeometricModern;
2645+
src: url(font.ttf);
2646+
}
2647+
2648+
p {
2649+
/* font will be downloaded for pages with p elements */
2650+
font-family: GeometricModern, sans-serif;
2651+
}
2652+
2653+
h2 {
2654+
/* font may be downloaded for pages with h2 elements, even if Futura is available locally */
2655+
font-family: Futura, GeometricModern, sans-serif;
2656+
}
2657+
</pre>
2658+
2659+
<p>In cases where textual content is loaded before downloadable fonts are
2660+
available, user agents may render text as it would be rendered if
2661+
downloadable font resources are not available or they may render text
2662+
transparently with fallback fonts to avoid a flash of text using a
2663+
fallback font. In cases where the font download fails user agents must
2664+
display text, simply leaving transparent text is considered non-conformant
2665+
behavior. Authors are advised to use fallback fonts in their font lists
2666+
that closely match the vertical metrics of the downloadable fonts to avoid
2667+
large page reflows where possible.
2668+
2669+
<h3 id=same-origin-restriction><span class=secno>4.8 </span>Same-origin
2670+
restriction for fonts</h3>
2671+
2672+
<p>User agents must implement a same-origin restriction when loading fonts
2673+
via the @font-face mechanism. This restriction limits the loading of fonts
2674+
for a given document to fonts loaded from the same origin. Fonts can only
2675+
be loaded via the same host, port, and method combination as the
2676+
containing document, using the <a
2677+
href="http://www.w3.org/TR/html5/origin-0.html">origin matching
2678+
algorithm</a> described in the <a href="#HTML5"
2679+
rel=biblioentry>[HTML5]<!--{{!HTML5}}--></a> specification. The origin of
2680+
the stylesheet containing @font-face rules is not used when deciding
2681+
whether a font is same origin or not, only the origin of the containing
2682+
document is used.
2683+
2684+
<p>Given a document located at http://example.com/page.html, fonts defined
2685+
with ‘<a href="#descdef-src"><code class=property>src</code></a>
2686+
definitions considered cross origin must not be loaded:
2687+
2688+
<pre>
2689+
/* same origin (i.e. domain, protocol, port match document) */
2690+
src: url(fonts/simple.ttf);
2691+
src: url(//fonts/simple.ttf);
2692+
2693+
/* cross origin, different protocol */
2694+
src: url(https://example.com/fonts/simple.ttf);
2695+
2696+
/* cross origin, different domain */
2697+
src: url(http://another.example.com/fonts/simple.ttf);
2698+
</pre>
2699+
2700+
<p>User agents must also implement the ability to relax this restriction
2701+
using cross-site origin controls <a href="#CORS"
2702+
rel=biblioentry>[CORS]<!--{{!CORS}}--></a>. Sites can explicitly allow
2703+
cross-site downloading of font data using the
2704+
<code>Access-Control-Allow-Origin</code> HTTP header.
2705+
2706+
<p class=issue>Some implementers feel a same-origin restriction should be
2707+
the default for all new resource types, including fonts, while others feel
2708+
strongly that an opt-in strategy usuable for all resource types would be a
2709+
better mechanism and that the default should always be to allow
2710+
cross-origin linking for consistency with existing resource types (e.g.
2711+
script, images). As such, this subsection should be considered at risk for
2712+
removal if the consensus is to use an alternative mechanism.
2713+
26282714
<h2 id=font-matching-algorithm><span class=secno>5 </span>Font matching
26292715
algorithm</h2>
26302716

@@ -4569,56 +4655,7 @@ <h2 id=rendering-considerations><span class=secno>7 </span>Resolving font
45694655
<!-- simple example of using both font-variant subproperty and descriptor value -->
45704656
<!-- example showing conflicting values and how they are resolved -->
45714657

4572-
<h2 class=no-num id=same-origin-restriction>Appendix A: Same-origin
4573-
restriction for fonts</h2>
4574-
4575-
<p><em>This appendix is normative.</em>
4576-
4577-
<p>Some user agents implement a same-origin restriction when loading font
4578-
resources. This section defines the meaning of that restriction.
4579-
4580-
<p>A same-origin restriction limits the loading of fonts for a given
4581-
document to fonts loaded from the same origin. This means that fonts can
4582-
only be loaded via the same host, port, and method combination as the
4583-
containing document, using the same origin matching algorithm described in
4584-
the <a href="#HTML5" rel=biblioentry>[HTML5]<!--{{!HTML5}}--></a>
4585-
specification. The origin of the stylesheet containing @font-face rules is
4586-
not used when deciding whether a font is same origin or not, only the
4587-
origin of the containing document is used.
4588-
4589-
<p>Given a document located at http://example.com/page.html, fonts defined
4590-
with ‘<a href="#descdef-src"><code class=property>src</code></a>
4591-
definitions considered cross origin must not be loaded:
4592-
4593-
<pre>
4594-
/* same origin (i.e. domain, protocol, port match document) */
4595-
src: url(fonts/simple.ttf);
4596-
src: url(//fonts/simple.ttf);
4597-
4598-
/* cross origin, different protocol */
4599-
src: url(https://example.com/fonts/simple.ttf);
4600-
4601-
/* cross origin, different domain */
4602-
src: url(http://another.example.com/fonts/simple.ttf);
4603-
</pre>
4604-
4605-
<p>If a user agent implements a same-origin restriction for fonts loaded
4606-
via @font-face rules it must implement that restriction for all font
4607-
types, rather than for a subset of possible types. It must also implement
4608-
the ability to relax this restriction using cross-site origin controls <a
4609-
href="#CORS" rel=biblioentry>[CORS]<!--{{!CORS}}--></a>. Sites can
4610-
explicitly allow cross-site downloading of font data using the
4611-
<code>Access-Control-Allow-Origin</code> HTTP header.
4612-
4613-
<p class=issue>Some implementers feel a same-origin restriction should be
4614-
the default for all new resource types while others feel strongly that an
4615-
opt-in strategy usuable for all resource types would be a better mechanism
4616-
and that the default should always be to allow cross-origin linking for
4617-
consistency with existing resource types (e.g. script, images). As such,
4618-
this section should be considered at risk for removal if the consensus is
4619-
to use an alternative mechanism.
4620-
4621-
<h2 class=no-num id=platform-props-to-css>Appendix B: Mapping platform font
4658+
<h2 class=no-num id=platform-props-to-css>Appendix A: Mapping platform font
46224659
properties to CSS properties</h2>
46234660

46244661
<p><em>This appendix is included as background for some of the problems and
@@ -4692,7 +4729,7 @@ <h2 class=no-num id=platform-props-to-css>Appendix B: Mapping platform font
46924729
<p class=issue>Need to define normatively how WWS names are handled across
46934730
platforms.
46944731

4695-
<h2 class=no-num id=font-licensing>Appendix C: Font licensing issues</h2>
4732+
<h2 class=no-num id=font-licensing>Appendix B: Font licensing issues</h2>
46964733

46974734
<p><em>This appendix is informative only.</em>
46984735

@@ -4947,9 +4984,9 @@ <h3 class=no-num id=other-references>Other References</h3>
49474984
<dt id=OPENTYPE-FONT-GUIDE>[OPENTYPE-FONT-GUIDE]
49484985

49494986
<dd><a
4950-
href="http://www.fontfont.com/opentype/FF_OT_UserGuide_v2.pdf"><cite>OpenType
4987+
href="https://www.fontfont.com/staticcontent/downloads/FF_OT_UserGuide_v2.pdf"><cite>OpenType
49514988
User Guide.</cite></a> FontShop International. URL: <a
4952-
href="http://www.fontfont.com/opentype/FF_OT_UserGuide_v2.pdf">http://www.fontfont.com/opentype/FF_OT_UserGuide_v2.pdf</a>
4989+
href="https://www.fontfont.com/staticcontent/downloads/FF_OT_UserGuide_v2.pdf">https://www.fontfont.com/staticcontent/downloads/FF_OT_UserGuide_v2.pdf</a>
49534990
</dd>
49544991
<!---->
49554992

0 commit comments

Comments
 (0)