css-fonts/Fonts.html

changeset 8640
82e75c734096
parent 8431
16e837f77ef5
child 8646
88930027e0f9
     1.1 --- a/css-fonts/Fonts.html	Thu Jul 04 08:55:31 2013 -0700
     1.2 +++ b/css-fonts/Fonts.html	Fri Jul 05 14:54:52 2013 +0900
     1.3 @@ -115,15 +115,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-11-june-2013>Editor's Draft 11
     1.8 -    June 2013</h2>
     1.9 +   <h2 class="no-num no-toc" id=editors-draft-5-july-2013>Editor's Draft 5
    1.10 +    July 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/css-fonts/">http://dev.w3.org/csswg/css-fonts/</a>
    1.17 -     <!-- <dd><a href="http://www.w3.org/TR/2013/ED-css3-fonts-20130611/">http://www.w3.org/TR/2013/ED-css3-fonts-20130611/</a> -->
    1.18 +     <!-- <dd><a href="http://www.w3.org/TR/2013/ED-css3-fonts-20130705/">http://www.w3.org/TR/2013/ED-css3-fonts-20130705/</a> -->
    1.19       
    1.20  
    1.21      <dt>Latest version:
    1.22 @@ -1653,13 +1653,6 @@
    1.23     id=aspect-value>aspect value</dfn></a>. Precisely defined, it is equal to
    1.24     the x-height of a font divided by the font size.
    1.25  
    1.26 -  <p class=issue>How does the use of ‘<a
    1.27 -   href="#propdef-font-size-adjust"><code
    1.28 -   class=property>font-size-adjust</code></a>’ affect <a
    1.29 -   href="http://www.w3.org/TR/css3-values/#font-relative-lengths"><em>font-relative</em></a>
    1.30 -   unit sizes? Are all units affected the same way, i.e. including the
    1.31 -   definition of ‘<code class=property>em</code>’?
    1.32 -
    1.33    <p>In situations where font fallback occurs, fallback fonts may not share
    1.34     the same aspect ratio as the desired font family and will thus appear less
    1.35     readable. The font-size-adjust property is a way to preserve the
    1.36 @@ -1699,9 +1692,10 @@
    1.37     <p class=caption>Text with and without the use of font-size-adjust
    1.38    </div>
    1.39  
    1.40 -  <p>This property allows authors to specify an aspect value for an element
    1.41 -   that will effectively preserve the x-height of the first choice font,
    1.42 -   whether it is substituted or not. Values have the following meanings:
    1.43 +  <p>This property allows authors to specify an <a
    1.44 +   href="#aspect-value"><i>aspect value</i></a> for an element that will
    1.45 +   effectively preserve the x-height of the first choice font, whether it is
    1.46 +   substituted or not. Values have the following meanings:
    1.47  
    1.48    <dl>
    1.49     <dt><dfn id=font-size-adjust-none-value
    1.50 @@ -1712,10 +1706,10 @@
    1.51     <dt><dfn id=font-size-adjust-auto-value
    1.52      title="auto!!font-size-adjust">auto</dfn>
    1.53  
    1.54 -   <dd>Behaves just like &lt;number>, except the number used is the aspect
    1.55 -    value calculated by user agents for the first font in the list of fonts
    1.56 -    defined for the initial value of the <a href="#propdef-font-family"
    1.57 -    title="font-family!!property">‘<code
    1.58 +   <dd>Behaves just like &lt;number>, except the number used is the <a
    1.59 +    href="#aspect-value"><i>aspect value</i></a> calculated by user agents
    1.60 +    for the first font in the list of fonts defined for the initial value of
    1.61 +    the <a href="#propdef-font-family" title="font-family!!property">‘<code
    1.62      class=property>font-family</code>’</a> property. Effectively this is
    1.63      the default font used when <a href="#propdef-font-family"
    1.64      title="font-family!!property">‘<code
    1.65 @@ -1726,39 +1720,48 @@
    1.66  
    1.67     <dt><dfn id=aspect-ratio-value><var>&lt;number&gt;</var></dfn>
    1.68  
    1.69 -   <dd>Specifies the aspect value used in the calculation below to calculate
    1.70 -    the adjusted font size:
    1.71 +   <dd>Specifies the <a href="#aspect-value"><i>aspect value</i></a> used in
    1.72 +    the calculation below to calculate the adjusted font size:
    1.73      <pre>c  =  ( a / a' ) s
    1.74  </pre>
    1.75  
    1.76      <p>where:</p>
    1.77  
    1.78      <pre>s  =  font-size value
    1.79 -a  =  aspect value as specified by the font-size-adjust property
    1.80 -a' =  aspect value of actual font
    1.81 +a  =  <a href="#aspect-value"><i>aspect value</i></a> as specified by the font-size-adjust property
    1.82 +a' =  <a href="#aspect-value"><i>aspect value</i></a> of actual font
    1.83  c  =  adjusted font-size to use
    1.84  </pre>
    1.85  
    1.86      <p>This value applies to any font that is selected but in typical usage
    1.87 -     it should be based on the aspect value of the first font in the
    1.88 -     font-family list. If this is specified accurately, the <tt>(a/a')</tt>
    1.89 -     term in the formula above is effectively 1 for the first font and no
    1.90 -     adjustment occurs. If the value is specified inaccurately, text rendered
    1.91 -     using the first font in the family list will display differently in
    1.92 -     older user agents that don't support font-size-adjust.</p>
    1.93 +     it should be based on the <a href="#aspect-value"><i>aspect
    1.94 +     value</i></a> of the first font in the font-family list. If this is
    1.95 +     specified accurately, the <tt>(a/a')</tt> term in the formula above is
    1.96 +     effectively 1 for the first font and no adjustment occurs. If the value
    1.97 +     is specified inaccurately, text rendered using the first font in the
    1.98 +     family list will display differently in older user agents that don't
    1.99 +     support font-size-adjust.</p>
   1.100    </dl>
   1.101  
   1.102 -  <p>Authors can calculate the aspect value for a given font by comparing
   1.103 -   spans with the same content but different font-size-adjust properties. If
   1.104 -   the same font-size is used, the spans will match when the font-size-adjust
   1.105 -   value is accurate for the given font.
   1.106 +  <p>The value of ‘<a href="#propdef-font-size-adjust"><code
   1.107 +   class=property>font-size-adjust</code></a>’ affects the size of relative
   1.108 +   units that are based on font metrics of the <a
   1.109 +   href="#first-available-font"><i>first available font</i></a> such as
   1.110 +   <code>ex</code> and <code>ch</code> but does not affect the size of
   1.111 +   <code>em</code> units.
   1.112 +
   1.113 +  <p>Authors can calculate the <a href="#aspect-value"><i>aspect
   1.114 +   value</i></a> for a given font by comparing spans with the same content
   1.115 +   but different font-size-adjust properties. If the same font-size is used,
   1.116 +   the spans will match when the font-size-adjust value is accurate for the
   1.117 +   given font.
   1.118  
   1.119    <div class=example>
   1.120 -   <p>Two spans with borders are used to determine the aspect value of a
   1.121 -    font. The font-size is the same for both spans but the font-size-adjust
   1.122 -    property is specified only for the right span. Starting with a value of
   1.123 -    0.5, the aspect value can be adjusted until the borders around the two
   1.124 -    letters line up.</p>
   1.125 +   <p>Two spans with borders are used to determine the <a
   1.126 +    href="#aspect-value"><i>aspect value</i></a> of a font. The font-size is
   1.127 +    the same for both spans but the font-size-adjust property is specified
   1.128 +    only for the right span. Starting with a value of 0.5, the aspect value
   1.129 +    can be adjusted until the borders around the two letters line up.</p>
   1.130  
   1.131     <pre>p {
   1.132      font-family: Futura;
   1.133 @@ -1776,14 +1779,15 @@
   1.134  &lt;p>&lt;span>b&lt;/span>&lt;span class="adjust">b&lt;/span>&lt;/p>
   1.135  </pre>
   1.136  
   1.137 -   <div class=figure><img alt="Futura with an aspect value of 0.5"
   1.138 +   <div class=figure><img alt="Futura with an <i>aspect value</i> of 0.5"
   1.139      src=beforefontsizeadjust.png>
   1.140 -    <p class=caption>Futura with an aspect value of 0.5
   1.141 +    <p class=caption>Futura with an <a href="#aspect-value"><i>aspect
   1.142 +     value</i></a> of 0.5
   1.143     </div>
   1.144  
   1.145     <p>The box on the right is a bit bigger than the one on the left, so the
   1.146 -    aspect value of this font is something less than 0.5. Adjust the value
   1.147 -    until the boxes align.</p>
   1.148 +    <a href="#aspect-value"><i>aspect value</i></a> of this font is something
   1.149 +    less than 0.5. Adjust the value until the boxes align.</p>
   1.150    </div>
   1.151    <!-- prop: font -->
   1.152  
   1.153 @@ -3051,11 +3055,11 @@
   1.154     definitions considered cross origin must not be loaded:
   1.155  
   1.156    <pre>
   1.157 -/* same origin (i.e. domain, protocol, port match document) */
   1.158 +/* same origin (i.e. domain, scheme, port match document) */
   1.159  src: url(fonts/simple.ttf);
   1.160  src: url(//fonts/simple.ttf);
   1.161  
   1.162 -/* cross origin, different protocol */
   1.163 +/* cross origin, different scheme */
   1.164  src: url(https://example.com/fonts/simple.ttf);
   1.165  
   1.166  /* cross origin, different domain */
   1.167 @@ -3069,34 +3073,16 @@
   1.168     using cross-site origin controls <a href="#CORS"
   1.169     rel=biblioentry>[CORS]<!--{{!CORS}}--></a> for fonts loaded via HTTP.
   1.170     Sites can explicitly allow cross-site downloading of font data using the
   1.171 -   <code>Access-Control-Allow-Origin</code> HTTP header. For other protocols,
   1.172 +   <code>Access-Control-Allow-Origin</code> HTTP header. For other schemes,
   1.173     no explicit relaxation mechanism is defined or required.
   1.174  
   1.175 -  <p>For font loads over HTTP, cross-origin requests must be made with the
   1.176 -   following parameter settings which are used in conjunction with the <a
   1.177 -   href="http://www.w3.org/TR/cors/#cross-origin-request-0"> <em>cross-origin
   1.178 -   request algorithm</em></a> <a href="#CORS"
   1.179 -   rel=biblioentry>[CORS]<!--{{!CORS}}--></a>:
   1.180 -
   1.181 -  <ul>
   1.182 -   <li><em>request URL</em> — the URL of the font resource in the <a
   1.183 -    href="#descdef-src"><code>src</code></a> descriptor
   1.184 -
   1.185 -   <li><em>request method</em> — GET
   1.186 -
   1.187 -   <li><em>author request headers</em> — none
   1.188 -
   1.189 -   <li><em>request entity body</em> — empty
   1.190 -
   1.191 -   <li><em>source origin</em> — the origin of the page which linked to the
   1.192 -    stylesheet
   1.193 -
   1.194 -   <li><em>manual redirect flag</em> — false
   1.195 -
   1.196 -   <li><em>omit credentials flag</em> — true
   1.197 -
   1.198 -   <li><em>force preflight flag</em> — false
   1.199 -  </ul>
   1.200 +  <p>For font loads, user agents must use the <a
   1.201 +   href="http://www.w3.org/TR/html5/infrastructure.html#cors-enabled-fetch">potentially
   1.202 +   CORS-enabled fetch</a> method defined by the <a href="#HTML5"
   1.203 +   rel=biblioentry>[HTML5]<!--{{!HTML5}}--></a> specification for URL's
   1.204 +   defined within @font-face rules. When fetching, user agents must use
   1.205 +   "Anonymous" mode, set the referrer source to the stylesheet's URL and set
   1.206 +   the origin to the URL of the containing document.
   1.207  
   1.208    <h2 id=font-matching-algorithm><span class=secno>5 </span>Font Matching
   1.209     Algorithm</h2>
   1.210 @@ -5779,25 +5765,61 @@
   1.211     rule.
   1.212  
   1.213    <pre class=idl>interface CSSFontFeatureValuesRule : CSSRule {
   1.214 -  readonly attribute DOMString familyList;
   1.215 -  readonly attribute DOMString valueText;
   1.216 -};</pre>
   1.217 +  attribute DOMString fontFamily;
   1.218 +  readonly attribute CSSFontFeatureValuesMap annotation;
   1.219 +  readonly attribute CSSFontFeatureValuesMap ornaments;
   1.220 +  readonly attribute CSSFontFeatureValuesMap stylistic;
   1.221 +  readonly attribute CSSFontFeatureValuesMap swash;
   1.222 +  readonly attribute CSSFontFeatureValuesMap characterVariant;
   1.223 +  readonly attribute CSSFontFeatureValuesMap styleset;
   1.224 +}
   1.225 +
   1.226 +[MapClass(DOMString, sequence&lt;unsigned long&gt;)]
   1.227 +interface CSSFontFeatureValuesMap {
   1.228 +  void set(DOMString featureValueName, sequence&lt;unsigned long&gt; values);
   1.229 +}</pre>
   1.230  
   1.231    <dl class=idl-attributes>
   1.232 -   <dt><var>familyList</var> of type <code>DOMString</code>, readonly
   1.233 +   <dt><var>fontFamily</var> of type <code>DOMString</code>
   1.234  
   1.235     <dd>The list of one or more font families for which a given set of feature
   1.236      values is defined.
   1.237  
   1.238 -   <dt><var>valueText</var> of type <code>DOMString</code>, readonly
   1.239 -
   1.240 -   <dd>Serialized set of feature values.
   1.241 +   <dt>value maps of type <code>CSSFontFeatureValuesMap</code>, readonly
   1.242 +
   1.243 +   <dd>Maps of feature values associated with feature value names for a given
   1.244 +    ‘<a href="#propdef-font-variant-alternates"><code
   1.245 +    class=property>font-variant-alternates</code></a>’ value type
   1.246    </dl>
   1.247  
   1.248 -  <p class=issue>This needs to be reworked along the lines of <a
   1.249 -   href="http://lists.w3.org/Archives/Public/www-style/2013May/0781.html">Tab's
   1.250 -   proposal</a> for a rule containing a family list and map objects for each
   1.251 -   of the feature types.
   1.252 +  <p>Each value map attribute of <a
   1.253 +   href="#cssfontfeaturevaluesrule"><code>CSSFontFeatureValuesRule</code></a>
   1.254 +   reflects the values defined via a corresponding <a
   1.255 +   href="#featurevalueblock"><i title="feature_value_block">feature value
   1.256 +   block</i></a>. Thus, the <var title="annotation
   1.257 +   attribute">annotation</var> attribute contains the values contained within
   1.258 +   a <code title="@annotation">@annotation</code> <a
   1.259 +   href="#featurevalueblock"><i title="feature_value_block">feature value
   1.260 +   block</i></a>, the <var title="ornaments attribute">ornaments</var>
   1.261 +   attribute contains the values contained with a <code
   1.262 +   title="@ornaments">@ornaments</code> <a href="#featurevalueblock"><i
   1.263 +   title="feature_value_block">feature value block</i></a> and so forth.
   1.264 +
   1.265 +  <p>The <code>CSSFontFeatureValuesMap</code> interface inherits the
   1.266 +   <code>clear</code>, <code>delete</code>, <code>get</code>, and
   1.267 +   <code>has</code> methods from <code>MapClass</code>. The <code>set</code>
   1.268 +   method takes an array of unsigned integers and associates it with a given
   1.269 +   <code>featureValueName</code>. The method behaves the same as the
   1.270 +   inherited method in <code>MapClass</code> but if the associated <a
   1.271 +   href="#featurevalueblock"><i title="feature_value_block">feature value
   1.272 +   block</i></a> only allows a limited number of values, the <code>set</code>
   1.273 +   method throws an <code>InvalidAccessError</code> exception when the input
   1.274 +   array to <code>set</code> contains more than the limited number of values.
   1.275 +   See the description of <a
   1.276 +   href="#multi-valued-feature-value-definitions">multi-valued feature value
   1.277 +   definitions</a> for details on the maximum number of values allowed for a
   1.278 +   given type of <a href="#featurevalueblock"><i
   1.279 +   title="feature_value_block">feature value block</i></a>.
   1.280  
   1.281    <h2 class=no-num id=platform-props-to-css>Appendix A: Mapping platform font
   1.282     properties to CSS properties</h2>
   1.283 @@ -5896,12 +5918,17 @@
   1.284      href="#at-font-feature-values-rule"><code>@font-feature-values</code></a>
   1.285      rules
   1.286  
   1.287 -   <li>Tightened definition of synthetic oblique
   1.288 -
   1.289     <li>Revised definition of ‘<a href="#descdef-unicode-range"><code
   1.290      class=property>unicode-range</code></a>’ descriptor
   1.291  
   1.292     <li>Detailed font matching of composite faces
   1.293 +
   1.294 +   <li>Revised object model interface of CSSFontFeatureValuesRule
   1.295 +
   1.296 +   <li>Detailed effect of ‘<a href="#propdef-font-size-adjust"><code
   1.297 +    class=property>font-size-adjust</code></a>’ on relative unit sizes
   1.298 +
   1.299 +   <li>Reference the potentially CORS-enabled fetch method defined in HTML5
   1.300    </ul>
   1.301  
   1.302    <h2 class=no-num id=acknowledgments>Acknowledgments</h2>

mercurial