E84D [css3-fonts] font matching editorial fixups and better definition of … · w3c/csswg-drafts@5d5e3b4 · GitHub
Skip to content

Commit 5d5e3b4

Browse files
author
John Daggett
committed
[css3-fonts] font matching editorial fixups and better definition of unicode-range matching
1 parent 2baa313 commit 5d5e3b4

1 file changed

Lines changed: 93 additions & 51 deletions

File tree

css-fonts/Fonts.html

Lines changed: 93 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2702,7 +2702,7 @@ <h3 id=unicode-range-desc><span class=secno>4.5 </span>Character range: the
27022702
<p>The associated font might not contain glyphs for the entire set of
27032703
codepoints defined by the ‘<a href="#descdef-unicode-range"><code
27042704
class=property>unicode-range</code></a>’ descriptor. When the font is
2705-
used the effective <a href="#character-map"><em>character map</em></a> is
2705+
used, the <dfn id=effective-character-map>effective character map</dfn> is
27062706
the intersection of the codepoints defined by ‘<a
27072707
href="#descdef-unicode-range"><code
27082708
class=property>unicode-range</code></a>’ with the font's <a
@@ -3103,24 +3103,18 @@ <h3 id=font-family-casing><span class=secno>5.1 </span>Case sensitivity of
31033103

31043104
<p>As part of the font matching algorithm outlined below, user agents must
31053105
match font family names used in style rules with actual font family names
3106-
contained in fonts available in a given environment or defined via <a
3107-
href="#at-font-face-rule"><code>@font-face</code></a> rules. User agents
3108-
must match these names case insensitively, using the "Default Caseless
3109-
Matching" algorithm outlined in the Unicode specification <a
3110-
href="#UNICODE6" rel=biblioentry>[UNICODE6]<!--{{!UNICODE6}}--></a>. This
3111-
algorithm is detailed in section 3.13 entitled "Default Case Algorithms".
3112-
Specifically, the algorithm must be applied without normalizing the
3113-
strings involved and without applying any language-specific tailorings.
3114-
The case folding method specified by this algorithm uses the case mappings
3115-
with status field ‘<code class=property>C</code>’ or ‘<code
3116-
class=property>F</code>’ in the CaseFolding.txt file of the Unicode
3117-
Character Database.
3118-
3119-
<p class=note> Implementors should take care to verify that a given
3120-
caseless string comparison implementation uses this precise algorithm and
3121-
not assume that a given platform string matching routine follows it, as
3122-
many of these have locale-specific behavior or use some level of string
3123-
normalization.
3106+
contained in fonts available in a given environment or with font family
3107+
names defined in <a href="#at-font-face-rule"><code>@font-face</code></a>
3108+
rules. User agents must match these names case insensitively, using the
3109+
"Default Caseless Matching" algorithm outlined in the Unicode
3110+
specification <a href="#UNICODE6"
3111+
rel=biblioentry>[UNICODE6]<!--{{!UNICODE6}}--></a>. This algorithm is
3112+
detailed in section 3.13 entitled "Default Case Algorithms". Specifically,
3113+
the algorithm must be applied without normalizing the strings involved and
3114+
without applying any language-specific tailorings. The case folding method
3115+
specified by this algorithm uses the case mappings with status field
3116+
<code class=property>C</code>’ or ‘<code class=property>F</code>
3117+
in the CaseFolding.txt file of the Unicode Character Database.
31243118

31253119
<p class=note> For authors this means that font family names are matched
31263120
case insensitively, whether those names exist in a platform font or in the
@@ -3133,13 +3127,21 @@ <h3 id=font-family-casing><span class=secno>5.1 </span>Case sensitivity of
31333127
looks identical but which uses the precomposed lowercase a-ring character
31343128
(U+00E5) instead of the combining sequence.
31353129

3130+
<p class=note> Implementors should take care to verify that a given
3131+
caseless string comparison implementation uses this precise algorithm and
3132+
not assume that a given platform string matching routine follows it, as
3133+
many of these have locale-specific behavior or use some level of string
3134+
normalization.
3135+
31363136
<h3 id=font-style-matching><span class=secno>5.2 </span>Matching font
31373137
styles</h3>
31383138

3139-
<p>The procedure for choosing fonts consists of iterating over the font
3140-
families determined by the font-family property, selecting a font face
3139+
<p>The procedure for choosing a font for a given character in a run of text
3140+
consists of iterating over the font families named by the <a
3141+
href="#propdef-font-family" title="font-family!!property"><code
3142+
class=property>font-family</code></a> property, selecting a font face
31413143
with the appropriate style based on other font properties and then
3142-
determining whether a glyph exists for a given character. This is done
3144+
determining whether a glyph exists for the given character. This is done
31433145
using the <dfn id=character-map>character map</dfn> of the font, data
31443146
which maps characters to the default glyph for that character. Codepoint
31453147
sequences consisting of a base character followed by a sequence of
@@ -3152,24 +3154,24 @@ <h3 id=font-style-matching><span class=secno>5.2 </span>Matching font
31523154

31533155
<ol id=fontmatchingalg>
31543156
<li>Using the computed font property values for a given element, the user
3155-
agent starts with the first family name in the fontlist specified by the
3156-
<a href="#propdef-font-family" title="font-family!!property"><code
3157+
agent starts with the first family name specified by the <a
3158+
href="#propdef-font-family" title="font-family!!property"><code
31573159
class=property>font-family</code></a> property.
31583160

3159-
<li>If the family name is unquoted and is a generic family name, the user
3160-
agent looks up the appropriate font family name to be used. User agents
3161-
may choose the generic font family to use based on the language of the
3162-
containing element or the Unicode range of the character.
3161+
<li>If the family name is a generic family keyword, the user agent looks
3162+
up the appropriate font family name to be used. User agents may choose
3163+
the generic font family to use based on the language of the containing
3164+
element or the Unicode range of the character.
31633165

31643166
<li>For other family names, the user agent attempts to find the family
31653167
name among fonts defined via <a
31663168
href="#at-font-face-rule"><code>@font-face</code></a> rules and then
3167-
among available system fonts, matching names with a case-insensitive
3168-
comparison as outlined <a href="#font-family-casing">in the section
3169-
above</a>. On systems containing fonts with multiple localized font
3170-
family names, user agents must match any of these names independent of
3171-
the underlying system locale or platform API used. If the font resources
3172-
defined for a given face in an <a
3169+
among available system fonts, matching names with a <a
3170+
href="#font-family-casing">case-insensitive comparison</a> as outlined in
3171+
the section above. On systems containing fonts with multiple localized
3172+
font family names, user agents must match any of these names independent
3173+
of the underlying system locale or platform API used. If the font
3174+
resources defined for a given face in an <a
31733175
href="#at-font-face-rule"><code>@font-face</code></a> rule are either not
31743176
available or contain invalid font data, then the face should be treated
31753177
as not present in the family. If no faces are present for a family
@@ -3179,7 +3181,12 @@ <h3 id=font-style-matching><span class=secno>5.2 </span>Matching font
31793181

31803182
<li>If a font family match occurs, the user agent assembles the set of
31813183
font faces in that family and then narrows the set to a single face using
3182-
other font properties in the order given below:
3184+
other font properties in the order given below. A group of faces defined
3185+
via <a href="#at-font-face-rule"><code>@font-face</code></a> rules with
3186+
identical font descriptor values but differing ‘<a
3187+
href="#descdef-unicode-range"><code
3188+
class=property>unicode-range</code></a>’ values are considered to be a
3189+
single <dfn id=composite-face>composite face</dfn> for this step:
31833190
<ol id=fontstylematchingalg>
31843191
<li><a href="#propdef-font-stretch"
31853192
title="font-stretch!!property"><code
@@ -3216,16 +3223,20 @@ <h3 id=font-style-matching><span class=secno>5.2 </span>Matching font
32163223
then oblique faces, then italic faces. Faces with other style values
32173224
are excluded from the matching set. User agents are permitted to
32183225
distinguish between italic and oblique faces within platform font
3219-
families but this is not required, they may treat all italic or oblique
3220-
faces as italic faces. Howe 1808 ver, within font families defined via <a
3221-
href="#at-font-face-rule"><code>@font-face</code></a> rules, italic and
3222-
oblique faces must be distinguished using the value of the <a
3226+
families but this is not required, so all italic or oblique faces may
3227+
be treated as italic faces. However, within font families defined via
3228+
<a href="#at-font-face-rule"><code>@font-face</code></a> rules, italic
3229+
and oblique faces must be distinguished using the value of the <a
32233230
href="#descdef-font-style" title="font-style!!descriptor"><code
3224-
class=property>font-style</code></a> descriptor.
3231+
class=property>font-style</code></a> descriptor. For families that
3232+
lack any italic or oblique faces, users agents may create artificial
3233+
oblique faces, if this is permitted by the value of the ‘<a
3234+
href="#propdef-font-synthesis"><code
3235+
class=property>font-synthesis</code></a>’ property.
32253236

32263237
<li><a href="#propdef-font-weight"
32273238
title="font-weight!!property"><code
3228-
class=property>font-weight</code></a> is matched next, it will
3239+
class=property>font-weight</code></a> is matched next, so it will
32293240
always reduce the matching set to a single font face. If bolder/lighter
32303241
relative weights are used, the effective weight is calculated based on
32313242
the inherited weight value, as described in the definition of the <a
@@ -3261,23 +3272,46 @@ <h3 id=font-style-matching><span class=secno>5.2 </span>Matching font
32613272
the one that is specified.
32623273
</ol>
32633274

3275+
<li>
3276+
<p>If the matched face is defined via <a
3277+
href="#at-font-face-rule"><code>@font-face</code></a> rules, user agents
3278+
must use the procedure below to select a single font:
3279+
3280+
<ol>
3281+
<li>If the font resource has not been loaded and the range of characters
3282+
defined by the ‘<a href="#descdef-unicode-range"><code
3283+
class=property>unicode-range</code></a>’ descriptor value includes
3284+
the character in question, load the font.
3285+
3286+
<li>After downloading, if the <a
3287+
href="#effective-character-map"><em>effective character map</em></a>
3288+
supports the character in question, select that font.
3289+
</ol>
3290+
3291+
<p>When the matched face is a <a href="#composite-face"><em>composite
3292+
face</em></a>, user agents must use the procedure above on each of the
3293+
faces in the <a href="#composite-face"><em>composite face</em></a> in
3294+
reverse order of <a
3295+
href="#at-font-face-rule"><code>@font-face</code></a> rule definition.</p>
3296+
3297+
<p>While the download occurs, user agents may either wait until the font
3298+
is downloaded or render once with substituted font metrics and render
3299+
again once the font is downloaded.</p>
3300+
32643301
<li>
32653302
<p>If no matching face exists or the matched face does not contain a
32663303
glyph for the character to be rendered, the next family name is selected
3267-
and the previous two steps repeated. Glyphs from other faces in the
3304+
and the previous three steps repeated. Glyphs from other faces in the
32683305
family are not considered. The only exception is that user agents may
3269-
optionally substitute a synthetic version of the <a
3306+
optionally substitute a synthetically obliqued version of the <a
32703307
href="#default-face"><em>default face</em></a> if that face supports a
3271-
given glyph (e.g. a synthetic italic version of the regular face may be
3272-
used if the italic face doesn't support glyphs for Arabic).</p>
3308+
given glyph and synthesis of these faces is permitted by the value of
3309+
the ‘<a href="#propdef-font-synthesis"><code
3310+
class=property>font-synthesis</code></a>’ property. For example, a
3311+
synthetic italic version of the regular face may be used if the italic
3312+
face doesn't support glyphs for Arabic.</p>
32733313
<!-- resolution on the above: http://lists.w3.org/Archives/Public/www-style/2012Nov/0292.html -->
32743314

3275-
<p>If the matched font is defined via an <a
3276-
href="#at-font-face-rule"><code>@font-face</code></a> rule and needs to
3277-
be downloaded, the font resource is downloaded. While the download
3278-
occurs, the user agent can either wait until the font is downloaded or
3279-
render once with substituted font metrics and render again once the font
3280-
is downloaded.</p>
32813315

32823316
<li>If there are no more font families to be evaluated and no matching
32833317
face has been found, then the user agent performs a <dfn
@@ -5841,6 +5875,8 @@ <h3 class=no-num id=recent-changes> Changes from the <a
58415875

58425876
<li>Revised definition of ‘<a href="#descdef-unicode-range"><code
58435877
class=property>unicode-range</code></a>’ descriptor
5878+
5879+
<li>Detailed font matching of composite faces
58445880
</ul>
58455881

58465882
<h2 class=no-num id=acknowledgments>Acknowledgments</h2>
@@ -6374,6 +6410,9 @@ <h2 class=no-num id=index>Index</h2>
63746410
<li>common-ligatures, <a href="#common-ligatures"
63756411
title=common-ligatures><strong>6.4</strong></a>
63766412

6413+
<li>composite face, <a href="#composite-face" title="composite
6414+
face"><strong>5.2</strong></a>
6415+
63776416
<li>condensed, <a href="#condensed"
63786417
title=condensed><strong>3.3</strong></a>
63796418

@@ -6401,6 +6440,9 @@ <h2 class=no-num id=index>Index</h2>
64016440
<li>discretionary-ligatures, <a href="#discretionary-ligatures"
64026441
title=discretionary-ligatures><strong>6.4</strong></a>
64036442

6443+
<li>effective character map, <a href="#effective-character-map"
6444+
title="effective character map"><strong>4.5</strong></a>
6445+
64046446
<li>expanded, <a href="#expanded" title=expanded><strong>3.3</strong></a>
64056447

64066448
<li>extra-condensed, <a href="#extra-condensed"

0 commit comments

Comments
 (0)