Skip to content

Commit 6edb879

Browse files
author
John Daggett
committed
[css3-fonts] add one more font load event example
1 parent a3d1e13 commit 6edb879

1 file changed

Lines changed: 33 additions & 5 deletions

File tree

css3-fonts/Fonts.html

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,15 @@
112112

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

115-
<h2 class="no-num no-toc" id=editors-draft-13-february-2013>Editor's Draft
116-
13 February 2013</h2>
115+
<h2 class="no-num no-toc" id=editors-draft-14-february-2013>Editor's Draft
116+
14 February 2013</h2>
117117

118118
<dl id=authors>
119119
<dt>This version:
120120

121121
<dd><a
122122
href="http://dev.w3.org/csswg/css3-fonts/">http://dev.w3.org/csswg/css3-fonts/</a>
123-
<!-- <dd><a href="http://www.w3.org/TR/2013/ED-css3-fonts-20130213/">http://www.w3.org/TR/2013/ED-css3-fonts-20130213/</a> -->
123+
<!-- <dd><a href="http://www.w3.org/TR/2013/ED-css3-fonts-20130214/">http://www.w3.org/TR/2013/ED-css3-fonts-20130214/</a> -->
124124

125125

126126
<dt>Latest version:
@@ -5668,14 +5668,42 @@ <h3 id=font-load-event-examples><span class=secno>9.3 </span>Font load
56685668
}
56695669

56705670
function doEditing() {
5671-
56725671
// content/layout operations that may cause additional font loads
5673-
56745672
document.fontloader.notifyWhenFontsReady(measureTextElements);
56755673
}
56765674
</pre>
56775675
</div>
56785676

5677+
<div class=example>
5678+
<p>Unlike the per-font load events, the <code
5679+
class=idl-code>"loadingdone"</code> event only fires after all font
5680+
related loads have completed <strong>and</strong> text has been laid out
5681+
without causing additional font loads:</p>
5682+
5683+
<pre> @font-face {
5684+
font-family: latin-serif;
5685+
src: url(latinserif.woff) format("woff"); /* contains no kanji/kana */
5686+
}
5687+
5688+
@font-face {
5689+
font-family: jpn-mincho;
5690+
src: url(mincho.woff) format("woff");
5691+
}
5692+
5693+
body { font-family: latin-serif, jpn-mincho; }
5694+
5695+
&lt;p><a href="https://twitter.com/maji_kichi_/status/292546415685693440/photo/1" style="text-decoration: none;">納豆はいかがでしょうか</a>&lt;/p>
5696+
</pre>
5697+
5698+
<p>In this situation, the user agent first downloads ‘<code
5699+
class=css>latinserif.woff</code>’ and then tries to use this to draw
5700+
the Japanese text. But because no Japanese glyphs are present in that
5701+
font, fallback occurs and the font ‘<code
5702+
class=css>mincho.woff</code>’ is downloaded. Only after the second font
5703+
is downloaded and the Japanese text laid out does the <code
5704+
class=idl-code>"loadingdone"</code> event fire.</p>
5705+
</div>
5706+
56795707
<h2 class=no-num id=platform-props-to-css>Appendix A: Mapping platform font
56805708
properties to CSS properties</h2>
56815709

0 commit comments

Comments
 (0)