Skip to content

Commit 4e9418c

Browse files
author
John Daggett
committed
[css3-fonts] revise @font-feature-values rule OM, add in description of how font-size-adjust affects relative unit sizes
1 parent 5412ef6 commit 4e9418c

1 file changed

Lines changed: 107 additions & 80 deletions

File tree

css-fonts/Fonts.html

Lines changed: 107 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,15 @@
115115

116116
<h1>CSS Fonts Module Level 3</h1>
117117

118-
<h2 class="no-num no-toc" id=editors-draft-11-june-2013>Editor's Draft 11
119-
June 2013</h2>
118+
<h2 class="no-num no-toc" id=editors-draft-5-july-2013>Editor's Draft 5
119+
July 2013</h2>
120120

121121
<dl id=authors>
122122
<dt>This version:
123123

124124
<dd><a
125125
href="http://dev.w3.org/csswg/css-fonts/">http://dev.w3.org/csswg/css-fonts/</a>
126-
<!-- <dd><a href="http://www.w3.org/TR/2013/ED-css3-fonts-20130611/">http://www.w3.org/TR/2013/ED-css3-fonts-20130611/</a> -->
126+
<!-- <dd><a href="http://www.w3.org/TR/2013/ED-css3-fonts-20130705/">http://www.w3.org/TR/2013/ED-css3-fonts-20130705/</a> -->
127127

128128

129129
<dt>Latest version:
@@ -1653,13 +1653,6 @@ <h3 id=font-size-adjust-prop><span class=secno>3.6 </span>Relative sizing:
16531653
id=aspect-value>aspect value</dfn></a>. Precisely defined, it is equal to
16541654
the x-height of a font divided by the font size.
16551655

1656-
<p class=issue>How does the use of ‘<a
1657-
href="#propdef-font-size-adjust"><code
1658-
class=property>font-size-adjust</code></a>’ affect <a
1659-
href="http://www.w3.org/TR/css3-values/#font-relative-lengths"><em>font-relative</em></a>
1660-
unit sizes? Are all units affected the same way, i.e. including the
1661-
definition of ‘<code class=property>em</code>’?
1662-
16631656
<p>In situations where font fallback occurs, fallback fonts may not share
16641657
the same aspect ratio as the desired font family and will thus appear less
16651658
readable. The font-size-adjust property is a way to preserve the
@@ -1699,9 +1692,10 @@ <h3 id=font-size-adjust-prop><span class=secno>3.6 </span>Relative sizing:
16991692
<p class=caption>Text with and without the use of font-size-adjust
17001693
</div>
17011694

1702-
<p>This property allows authors to specify an aspect value for an element
1703-
that will effectively preserve the x-height of the first choice font,
1704-
whether it is substituted or not. Values have the following meanings:
1695+
<p>This property allows authors to specify an <a
1696+
href="#aspect-value"><i>aspect value</i></a> for an element that will
1697+
effectively preserve the x-height of the first choice font, whether it is
1698+
substituted or not. Values have the following meanings:
17051699

17061700
<dl>
17071701
<dt><dfn id=font-size-adjust-none-value
@@ -1712,10 +1706,10 @@ <h3 id=font-size-adjust-prop><span class=secno>3.6 </span>Relative sizing:
17121706
<dt><dfn id=font-size-adjust-auto-value
17131707
title="auto!!font-size-adjust">auto</dfn>
17141708

1715-
<dd>Behaves just like &lt;number>, except the number used is the aspect
1716-
value calculated by user agents for the first font in the list of fonts
1717-
defined for the initial value of the <a href="#propdef-font-family"
1718-
title="font-family!!property"><code
1709+
<dd>Behaves just like &lt;number>, except the number used is the <a
1710+
href="#aspect-value"><i>aspect value</i></a> calculated by user agents
1711+
for the first font in the list of fonts defined for the initial value of
1712+
the <a href="#propdef-font-family" title="font-family!!property"><code
17191713
class=property>font-family</code></a> property. Effectively this is
17201714
the default font used when <a href="#propdef-font-family"
17211715
title="font-family!!property"><code
@@ -1726,39 +1720,48 @@ <h3 id=font-size-adjust-prop><span class=secno>3.6 </span>Relative sizing:
17261720

17271721
<dt><dfn id=aspect-ratio-value><var>&lt;number&gt;</var></dfn>
17281722

1729-
<dd>Specifies the aspect value used in the calculation below to calculate
1730-
the adjusted font size:
1723+
<dd>Specifies the <a href="#aspect-value"><i>aspect value</i></a> used in
1724+
the calculation below to calculate the adjusted font size:
17311725
<pre>c = ( a / a' ) s
17321726
</pre>
17331727

17341728
<p>where:</p>
17351729

17361730
<pre>s = font-size value
1737-
a = aspect value as specified by the font-size-adjust property
1738-
a' = aspect value of actual font
1731+
a = <a href="#aspect-value"><i>aspect value</i></a> as specified by the font-size-adjust property
1732+
a' = <a href="#aspect-value"><i>aspect value</i></a> of actual font
17391733
c = adjusted font-size to use
17401734
</pre>
17411735

17421736
<p>This value applies to any font that is selected but in typical usage
1743-
it should be based on the aspect value of the first font in the
1744-
font-family list. If this is specified accurately, the <tt>(a/a')</tt>
1745-
term in the formula above is effectively 1 for the first font and no
1746-
adjustment occurs. If the value is specified inaccurately, text rendered
1747-
using the first font in the family list will display differently in
1748-
older user agents that don't support font-size-adjust.</p>
1737+
it should be based on the <a href="#aspect-value"><i>aspect
1738+
value</i></a> of the first font in the font-family list. If this is
1739+
specified accurately, the <tt>(a/a')</tt> term in the formula above is
1740+
effectively 1 for the first font and no adjustment occurs. If the value
1741+
is specified inaccurately, text rendered using the first font in the
1742+
family list will display differently in older user agents that don't
1743+
support font-size-adjust.</p>
17491744
</dl>
17501745

1751-
<p>Authors can calculate the aspect value for a given font by comparing
1752-
spans with the same content but different font-size-adjust properties. If
1753-
the same font-size is used, the spans will match when the font-size-adjust
1754-
value is accurate for the given font.
1746+
<p>The value of ‘<a href="#propdef-font-size-adjust"><code
1747+
class=property>font-size-adjust</code></a>’ affects the size of relative
1748+
units that are based on font metrics of the <a
1749+
href="#first-available-font"><i>first available font</i></a> such as
1750+
<code>ex</code> and <code>ch</code> but does not affect the size of
1751+
<code>em</code> units.
1752+
1753+
<p>Authors can calculate the <a href="#aspect-value"><i>aspect
1754+
value</i></a> for a given font by comparing spans with the same content
1755+
but different font-size-adjust properties. If the same font-size is used,
1756+
the spans will match when the font-size-adjust value is accurate for the
1757+
given font.
17551758

17561759
<div class=example>
1757-
<p>Two spans with borders are used to determine the aspect value of a
1758-
font. The font-size is the same for both spans but the font-size-adjust
1759-
property is specified only for the right span. Starting with a value of
1760-
0.5, the aspect value can be adjusted until the borders around the two
1761-
letters line up.</p>
1760+
<p>Two spans with borders are used to determine the <a
1761+
href="#aspect-value"><i>aspect value</i></a> of a font. The font-size is
1762+
the same for both spans but the font-size-adjust property is specified
1763+
only for the right span. Starting with a value of 0.5, the aspect value
1764+
can be adjusted until the borders around the two letters line up.</p>
17621765

17631766
<pre>p {
17641767
font-family: Futura;
@@ -1776,14 +1779,15 @@ <h3 id=font-size-adjust-prop><span class=secno>3.6 </span>Relative sizing:
17761779
&lt;p>&lt;span>b&lt;/span>&lt;span class="adjust">b&lt;/span>&lt;/p>
17771780
</pre>
17781781

1779-
<div class=figure><img alt="Futura with an aspect value of 0.5"
1782+
<div class=figure><img alt="Futura with an <i>aspect value</i> of 0.5"
17801783
src=beforefontsizeadjust.png>
1781-
<p class=caption>Futura with an aspect value of 0.5
1784+
<p class=caption>Futura with an <a href="#aspect-value"><i>aspect
1785+
value</i></a> of 0.5
17821786
</div>
17831787

17841788
<p>The box on the right is a bit bigger than the one on the left, so the
1785-
aspect value of this font is something less than 0.5. Adjust the value
1786-
until the boxes align.</p>
1789+
<a href="#aspect-value"><i>aspect value</i></a> of this font is something
1790+
less than 0.5. Adjust the value until the boxes align.</p>
17871791
</div>
17881792
<!-- prop: font -->
17891793

@@ -3051,11 +3055,11 @@ <h4 id=default-same-origin-restriction><span class=secno>4.9.1
30513055
definitions considered cross origin must not be loaded:
30523056

30533057
<pre>
3054-
/* same origin (i.e. domain, protocol, port match document) */
3058+
/* same origin (i.e. domain, scheme, port match document) */
30553059
src: url(fonts/simple.ttf);
30563060
src: url(//fonts/simple.ttf);
30573061

3058-
/* cross origin, different protocol */
3062+
/* cross origin, different scheme */
30593063
src: url(https://example.com/fonts/simple.ttf);
30603064

30613065
/* cross origin, different domain */
@@ -3069,34 +3073,16 @@ <h4 id=allowing-cross-origin-font-loading><span class=secno>4.9.2
30693073
using cross-site origin controls <a href="#CORS"
30703074
rel=biblioentry>[CORS]<!--{{!CORS}}--></a> for fonts loaded via HTTP.
30713075
Sites can explicitly allow cross-site downloading of font data using the
3072-
<code>Access-Control-Allow-Origin</code> HTTP header. For other protocols,
3076+
<code>Access-Control-Allow-Origin</code> HTTP header. For other schemes,
30733077
no explicit relaxation mechanism is defined or required.
30743078

3075-
<p>For font loads over HTTP, cross-origin requests must be made with the
3076-
following parameter settings which are used in conjunction with the <a
3077-
href="http://www.w3.org/TR/cors/#cross-origin-request-0"> <em>cross-origin
3078-
request algorithm</em></a> <a href="#CORS"
3079-
rel=biblioentry>[CORS]<!--{{!CORS}}--></a>:
3080-
3081-
<ul>
3082-
<li><em>request URL</em> — the URL of the font resource in the <a
3083-
href="#descdef-src"><code>src</code></a> descriptor
3084-
3085-
<li><em>request method</em> — GET
3086-
3087-
<li><em>author request headers</em> — none
3088-
3089-
<li><em>request entity body</em> — empty
3090-
3091-
<li><em>source origin</em> — the origin of the page which linked to the
3092-
stylesheet
3093-
3094-
<li><em>manual redirect flag</em> — false
3095-
3096-
<li><em>omit credentials flag</em> — true
3097-
3098-
<li><em>force preflight flag</em> — false
3099-
</ul>
3079+
<p>For font loads, user agents must use the <a
3080+
href="http://www.w3.org/TR/html5/infrastructure.html#cors-enabled-fetch">potentially
3081+
CORS-enabled fetch</a> method defined by the <a href="#HTML5"
3082+
rel=biblioentry>[HTML5]<!--{{!HTML5}}--></a> specification for URL's
3083+
defined within @font-face rules. When fetching, user agents must use
3084+
"Anonymous" mode, set the referrer source to the stylesheet's URL and set
3085+
the origin to the URL of the containing document.
31003086

31013087
<h2 id=font-matching-algorithm><span class=secno>5 </span>Font Matching
31023088
Algorithm</h2>
@@ -5779,25 +5765,61 @@ <h3 id=om-fontfeaturevalues><span class=secno>8.2 </span>The <a
57795765
rule.
57805766

57815767
<pre class=idl>interface CSSFontFeatureValuesRule : CSSRule {
5782-
readonly attribute DOMString familyList;
5783-
readonly attribute DOMString valueText;
5784-
};</pre>
5768+
attribute DOMString fontFamily;
5769+
readonly attribute CSSFontFeatureValuesMap annotation;
5770+
readonly attribute CSSFontFeatureValuesMap ornaments;
5771+
readonly attribute CSSFontFeatureValuesMap stylistic;
5772+
readonly attribute CSSFontFeatureValuesMap swash;
5773+
readonly attribute CSSFontFeatureValuesMap characterVariant;
5774+
readonly attribute CSSFontFeatureValuesMap styleset;
5775+
}
5776+
5777+
[MapClass(DOMString, sequence&lt;unsigned long&gt;)]
5778+
interface CSSFontFeatureValuesMap {
5779+
void set(DOMString featureValueName, sequence&lt;unsigned long&gt; values);
5780+
}</pre>
57855781

57865782
<dl class=idl-attributes>
5787-
<dt><var>familyList</var> of type <code>DOMString</code>, readonly
5783+
<dt><var>fontFamily</var> of type <code>DOMString</code>
57885784

57895785
<dd>The list of one or more font families for which a given set of feature
57905786
values is defined.
57915787

5792-
<dt><var>valueText</var> of type <code>DOMString</code>, readonly
5788+
<dt>value maps of type <code>CSSFontFeatureValuesMap</code>, readonly
57935789

5794-
<dd>Serialized set of feature values.
5790+
<dd>Maps of feature values associated with feature value names for a given
5791+
<a href="#propdef-font-variant-alternates"><code
5792+
class=property>font-variant-alternates</code></a>’ value type
57955793
</dl>
57965794

5797-
<p class=issue>This needs to be reworked along the lines of <a
5798-
href="http://lists.w3.org/Archives/Public/www-style/2013May/0781.html">Tab's
5799-
proposal</a> for a rule containing a family list and map objects for each
5800-
of the feature types.
5795+
<p>Each value map attribute of <a
5796+
href="#cssfontfeaturevaluesrule"><code>CSSFontFeatureValuesRule</code></a>
5797+
reflects the values defined via a corresponding <a
5798+
href="#featurevalueblock"><i title="feature_value_block">feature value
5799+
block</i></a>. Thus, the <var title="annotation
5800+
attribute">annotation</var> attribute contains the values contained within
5801+
a <code title="@annotation">@annotation</code> <a
5802+
href="#featurevalueblock"><i title="feature_value_block">feature value
5803+
block</i></a>, the <var title="ornaments attribute">ornaments</var>
5804+
attribute contains the values contained with a <code
5805+
title="@ornaments">@ornaments</code> <a href="#featurevalueblock"><i
5806+
title="feature_value_block">feature value block</i></a> and so forth.
5807+
5808+
<p>The <code>CSSFontFeatureValuesMap</code> interface inherits the
5809+
<code>clear</code>, <code>delete</code>, <code>get</code>, and
5810+
<code>has</code> methods from <code>MapClass</code>. The <code>set</code>
5811+
method takes an array of unsigned integers and associates it with a given
5812+
<code>featureValueName</code>. The method behaves the same as the
5813+
inherited method in <code>MapClass</code> but if the associated <a
5814+
href="#featurevalueblock"><i title="feature_value_block">feature value
5815+
block</i></a> only allows a limited number of values, the <code>set</code>
5816+
method throws an <code>InvalidAccessError</code> exception when the input
5817+
array to <code>set</code> contains more than the limited number of values.
5818+
See the description of <a
5819+
href="#multi-valued-feature-value-definitions">multi-valued feature value
5820+
definitions</a> for details on the maximum number of values allowed for a
5821+
given type of <a href="#featurevalueblock"><i
5822+
title="feature_value_block">feature value block</i></a>.
58015823

58025824
<h2 class=no-num id=platform-props-to-css>Appendix A: Mapping platform font
58035825
properties to CSS properties</h2>
@@ -5896,12 +5918,17 @@ <h3 class=no-num id=recent-changes> Changes from the <a
58965918
href="#at-font-feature-values-rule"><code>@font-feature-values</code></a>
58975919
rules
58985920

5899-
<li>Tightened definition of synthetic oblique
5900-
59015921
<li>Revised definition of ‘<a href="#descdef-unicode-range"><code
59025922
class=property>unicode-range</code></a>’ descriptor
59035923

59045924
<li>Detailed font matching of composite faces
5925+
5926+
<li>Revised object model interface of CSSFontFeatureValuesRule
5927+
5928+
<li>Detailed effect of ‘<a href="#propdef-font-size-adjust"><code
5929+
class=property>font-size-adjust</code></a>’ on relative unit sizes
5930+
5931+
<li>Reference the potentially CORS-enabled fetch method defined in HTML5
59055932
</ul>
59065933

59075934
<h2 class=no-num id=acknowledgments>Acknowledgments</h2>

0 commit comments

Comments
 (0)