[css3-fonts] added in clearer definition of errors reported as part of font load events

Tue, 12 Feb 2013 16:31:34 +0900

author
John Daggett <jdaggett@mozilla.com>
date
Tue, 12 Feb 2013 16:31:34 +0900
changeset 7442
06a73291478f
parent 7441
2a7cb1ed8232
child 7443
6fdb489623ce

[css3-fonts] added in clearer definition of errors reported as part of font load events

css3-fonts/Fonts.html file | annotate | diff | comparison | revisions
     1.1 --- a/css3-fonts/Fonts.html	Mon Feb 11 18:46:59 2013 -0800
     1.2 +++ b/css3-fonts/Fonts.html	Tue Feb 12 16:31:34 2013 +0900
     1.3 @@ -112,15 +112,15 @@
     1.4  
     1.5     <h1>CSS Fonts Module Level 3</h1>
     1.6  
     1.7 -   <h2 class="no-num no-toc" id=editors-draft-6-february-2013>Editor's Draft
     1.8 -    6 February 2013</h2>
     1.9 +   <h2 class="no-num no-toc" id=editors-draft-12-february-2013>Editor's Draft
    1.10 +    12 February 2013</h2>
    1.11  
    1.12     <dl id=authors>
    1.13      <dt>This version:
    1.14  
    1.15      <dd><a
    1.16       href="http://dev.w3.org/csswg/css3-fonts/">http://dev.w3.org/csswg/css3-fonts/</a>
    1.17 -     <!-- <dd><a href="http://www.w3.org/TR/2013/ED-css3-fonts-20130206/">http://www.w3.org/TR/2013/ED-css3-fonts-20130206/</a> -->
    1.18 +     <!-- <dd><a href="http://www.w3.org/TR/2013/ED-css3-fonts-20130212/">http://www.w3.org/TR/2013/ED-css3-fonts-20130212/</a> -->
    1.19       
    1.20  
    1.21      <dt>Latest version:
    1.22 @@ -420,8 +420,8 @@
    1.23  
    1.24     <li class=no-num><a href="#ch-ch-ch-changes">Changes</a>
    1.25      <ul class=toc>
    1.26 -     <li class=no-num><a href="#recent-changes"> Changes from the December
    1.27 -      2012 CSS3 Fonts Working Draft</a>
    1.28 +     <li class=no-num><a href="#recent-changes"> Changes from the February
    1.29 +      2013 CSS3 Fonts Working Draft</a>
    1.30      </ul>
    1.31  
    1.32     <li class=no-num><a href="#acknowledgments">Acknowledgments</a>
    1.33 @@ -5321,6 +5321,13 @@
    1.34  
    1.35    <h4 id=events><span class=secno>9.2.1 </span>Events</h4>
    1.36  
    1.37 +  <p>Font load events are grouped into two general categories, events
    1.38 +   associated with a group of fonts loading (<code
    1.39 +   class=idl-code>loading</code>, <code class=idl-code>loading</code>) or
    1.40 +   finer-grained events associated with each individual font loaded (<code
    1.41 +   class=idl-code>loadstart</code>, <code class=idl-code>load</code>, <code
    1.42 +   class=idl-code>error</code>).
    1.43 +
    1.44    <p>The following are the event handlers (and their corresponding event
    1.45     handler event types) that must be supported by <code>FontLoader</code>
    1.46     objects as IDL attributes:
    1.47 @@ -5371,7 +5378,7 @@
    1.48      the given <var>font face rule</var>.
    1.49  
    1.50     <li>The <code class=idl-code>error</code> attribute is initialized to the
    1.51 -    given <var>error</var>.
    1.52 +    given <var>error</var>, if one occurred during the font load.
    1.53    </ol>
    1.54  
    1.55    <p>When the user agent determines that one or more fonts defined via
    1.56 @@ -5386,19 +5393,24 @@
    1.57      loader</var> to true.
    1.58  
    1.59     <li><a href="#fire-a-font-load-event">Fire a font load event</a> named <a
    1.60 -    id=fontloader-loading><code class=idl-code>"loading"</code></a> with
    1.61 -    <var>font face rule</var> and <var>error</var> at <var>font loader</var>.
    1.62 +    id=fontloader-loading><code class=idl-code>"loading"</code></a> at
    1.63 +    <var>font loader</var> with <code class=idl-code>fontface</code> set to
    1.64 +    the first <code>@font-face</code> rule.
    1.65  
    1.66     <li>When the user agent begins loading the first resource for a given
    1.67      <code>@font-face</code> rule, it must <a
    1.68      href="#fire-a-font-load-event">fire a font load event</a> named <a
    1.69 -    id=fontloader-loadstart><code class=idl-code>"loadstart"</code></a> with
    1.70 -    <var>font face</var> set to the <code>@font-face</code> rule that caused
    1.71 -    this load to start and <var>error</var> set to <code>????</code> at
    1.72 -    <var>font loader</var>.
    1.73 +    id=fontloader-loadstart><code class=idl-code>"loadstart"</code></a> at
    1.74 +    <var>font loader</var> with <code class=idl-code>fontface</code> set to
    1.75 +    the given <code>@font-face</code> rule.
    1.76    </ol>
    1.77  
    1.78 -  <p class=issue>What are the error types that should be used here?
    1.79 +  <p>These steps imply that if fonts are loaded concurrently, the <code
    1.80 +   class=idl-code>loading</code> event will fire just once, while the <code
    1.81 +   class=idl-code>loadstart</code> event will be fired once for each
    1.82 +   <code>@font-face</code> rule whose load is initiated. User agents must
    1.83 +   only set the <code class=idl-code>error</code> attribute of a font load
    1.84 +   event to a non-null value in the cases noted in this section.
    1.85  
    1.86    <p>The term “font load” covers any of the resources listed in the
    1.87     ‘src’ descriptor, including local fonts. When multiple resources are
    1.88 @@ -5406,10 +5418,6 @@
    1.89     successfully load or the error that occurs on the last resource for which
    1.90     a load is attempted.
    1.91  
    1.92 -  <p class=issue>Given that a set of <code>@font-face</code> rules might load
    1.93 -   concurrently, does it make sense to have a non-null value for the <code
    1.94 -   class=idl-code>"loading"</code> event?
    1.95 -
    1.96    <p>When the user agent completes each font load for a document
    1.97     <var>doc</var>, it must run the following steps:
    1.98  
    1.99 @@ -5417,23 +5425,30 @@
   1.100     <li>Let <var>font loader</var> be the value of the <code
   1.101      class=idl-code>fontloader</code> attribute of <var>doc</var>.
   1.102  
   1.103 -   <li>If none of the resources listed for the ‘<a
   1.104 -    href="#descdef-src"><code class=property>src</code></a>’ descriptor
   1.105 -    contain valid data, <a href="#fire-a-font-load-event">fire a font load
   1.106 +   <li>If a font data was successfully loaded and activated, <a
   1.107 +    href="#fire-a-font-load-event">fire a font load event</a> named <a
   1.108 +    id=fontloader-load><code class=idl-code>"load"</code></a> at <var>font
   1.109 +    loader</var> with <code class=idl-code>fontface</code> set to the
   1.110 +    <code>@font-face</code> rule for which the font data was loaded.
   1.111 +
   1.112 +   <li>Otherwise, <a href="#fire-a-font-load-event">fire a font load
   1.113      event</a> named <a id=fontloader-error><code
   1.114 -    class=idl-code>"error"</code></a> with <var>font face</var> the
   1.115 -    <code>@font-face</code> rule that caused this load to start and
   1.116 -    <var>error</var> [something?] at <var>font loader</var>.
   1.117 -
   1.118 -   <li>Otherwise, <a href="#fire-a-font-load-event">fire a font load
   1.119 -    event</a> named <a id=fontloader-load><code
   1.120 -    class=idl-code>"load"</code></a> with <var>font face</var> the
   1.121 -    <code>@font-face</code> rule that caused this load to start and
   1.122 -    <var>error</var> [something?] at <var>font loader</var>.
   1.123 +    class=idl-code>"error"</code></a> at <var>font loader</var> with <code
   1.124 +    class=idl-code>fontface</code> set to the <code>@font-face</code> rule
   1.125 +    for which the error occurred. If the font data can't be loaded <code
   1.126 +    class=idl-code>error</code> is set to one of the standard
   1.127 +    <code>DOMError</code> types (e.g. <code>NotFoundError</code>,
   1.128 +    <code>NetworkError</code>). If the font data was downloaded but invalid,
   1.129 +    then <code class=idl-code>error</code> is set to
   1.130 +    <code>"InvalidFontDataError"</code>. If several resources are listed in
   1.131 +    the <a href="#descdef-src"><code>src</code></a> descriptor, the error
   1.132 +    that caused the last font resource in the list to fail must be used.
   1.133    </ol>
   1.134  
   1.135    <p>When the user agent completes the final font load for document
   1.136 -   <var>doc</var>, it must run the following steps:
   1.137 +   <var>doc</var>, after all pending layout operations that might affect font
   1.138 +   selection have completed and no font loads are pending, it must run the
   1.139 +   following steps:
   1.140  
   1.141    <ol>
   1.142     <li>Let <var>font loader</var> be the value of the <code
   1.143 @@ -5443,18 +5458,23 @@
   1.144      loader</var> to false.
   1.145  
   1.146     <li><a href="#fire-a-font-load-event">Fire a font load event</a> named <a
   1.147 -    id=fontloader-loadingdone><code class=idl-code>"loadingdone"</code></a>
   1.148 -    with <var>font face rule</var>, set to the last font to load, and
   1.149 -    <var>error</var> at <var>font loader</var>.
   1.150 +    id=fontloader-error><code class=idl-code>"loadingdone"</code></a> at
   1.151 +    <var>font loader</var> with <code class=idl-code>fontface</code> set to
   1.152 +    the <code>@font-face</code> rule of the last font loaded.
   1.153    </ol>
   1.154  
   1.155 -  <p>Note: For example, if three fonts are loaded at the same time, a <code
   1.156 +  <p>For example, if three fonts are loaded at the same time, a <code
   1.157     class=idl-code>"loading"</code> event followed by three <code
   1.158     class=idl-code>"loadstart"</code> events and three <code
   1.159     class=idl-code>"load"</code> or <code class=idl-code>"error"</code>
   1.160     events, followed by a <code class=idl-code>"loadingdone"</code> event will
   1.161     occur.
   1.162  
   1.163 +  <p class=issue>Errors will go "unreported" when using the general category
   1.164 +   of font load events (i.e. <code class=idl-code>"loading"</code> and <code
   1.165 +   class=idl-code>"loadingdone"</code>). This seems fine but need to confirm
   1.166 +   this.
   1.167 +
   1.168    <h4 id=methods><span class=secno>9.2.2 </span>Methods</h4>
   1.169  
   1.170    <p>The methods <code class=idl-code>loadFont</code> and <code
   1.171 @@ -5738,27 +5758,13 @@
   1.172    <h2 class=no-num id=ch-ch-ch-changes>Changes</h2>
   1.173  
   1.174    <h3 class=no-num id=recent-changes> Changes from the <a
   1.175 -   href="http://www.w3.org/TR/2012/WD-css3-fonts-20121211/">December 2012
   1.176 +   href="http://www.w3.org/TR/2013/WD-css3-fonts-20130213/">February 2013
   1.177     CSS3 Fonts Working Draft</a></h3>
   1.178  
   1.179    <p>Major changes include:
   1.180  
   1.181    <ul>
   1.182 -   <li><code>loadFont</code> method takes a dictionary parameter that
   1.183 -    includes callbacks
   1.184 -
   1.185 -   <li>Added example of system font names used as normal font family name
   1.186 -
   1.187 -   <li>Added conformance section
   1.188 -
   1.189 -   <li>Added CORS cross-origin request algorithm parameters
   1.190 -
   1.191 -   <li>Added specification of Unicode caseless matching for font family names
   1.192 -    based on WG resolution
   1.193 -
   1.194 -   <li>Include issue of synthetic oblique angle in CJK vertical text runs
   1.195 -
   1.196 -   <li>Minor editorial tweaks hither and thither
   1.197 +   <li>Add details of font load errors
   1.198    </ul>
   1.199  
   1.200    <h2 class=no-num id=acknowledgments>Acknowledgments</h2>
   1.201 @@ -5950,6 +5956,15 @@
   1.202      </dd>
   1.203     <!---->
   1.204  
   1.205 +   <dt id=DOM>[DOM]
   1.206 +
   1.207 +   <dd>Anne van Kesteren; et al. <a
   1.208 +    href="http://www.w3.org/TR/2012/WD-dom-20121206/"><cite>DOM4.</cite></a>
   1.209 +    6 December 2012. W3C Working Draft. (Work in progress.) URL: <a
   1.210 +    href="http://www.w3.org/TR/2012/WD-dom-20121206/">http://www.w3.org/TR/2012/WD-dom-20121206/</a>
   1.211 +    </dd>
   1.212 +   <!---->
   1.213 +
   1.214     <dt id=HTML5>[HTML5]
   1.215  
   1.216     <dd>Ian Hickson. <a
   1.217 @@ -6030,6 +6045,7 @@
   1.218    <!--end-normative-->
   1.219    <!--{{!CSS21}}-->
   1.220    <!--{{!CSS3VAL}}-->
   1.221 +  <!--{{!DOM}}-->
   1.222    <!--{{!OPENTYPE}}-->
   1.223    <!--{{!OPENTYPE-FEATURES}}-->
   1.224    <!--{{!OPEN-FONT-FORMAT}}-->

mercurial