Skip to content

Commit 0a507bd

Browse files
committed
[css-fonts-4] Merge font-variant-caps from CSS Fonts 3 w3c#1653
1 parent 2da3f9c commit 0a507bd

File tree

8 files changed

+155
-0
lines changed

8 files changed

+155
-0
lines changed

css-fonts-4/Overview.bs

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3846,6 +3846,161 @@ and use the standard defaults for subscripts.
38463846
<h3 id="font-variant-caps-prop">
38473847
Capitalization: the 'font-variant-caps' property</h3>
38483848

3849+
3850+
<pre class="propdef">
3851+
Name: font-variant-caps
3852+
3853+
Value: normal | small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps
3854+
Initial: normal
3855+
Applies to: all elements
3856+
Inherited: yes
3857+
Percentages: n/a
3858+
Computed value: as specified
3859+
Animation type: discrete
3860+
</pre>
3861+
3862+
3863+
<p>This property allows
3864+
the selection of alternate glyphs
3865+
used for small or petite capitals or for titling.
3866+
These glyphs are specifically designed
3867+
to blend well with the surrounding normal glyphs,
3868+
to maintain the weight and readability
3869+
which suffers when text is simply resized
3870+
to fit this purpose.</p>
3871+
3872+
<p>Individual values have the following meanings:</p>
3873+
3874+
<dl dfn-for="font-variant-caps" dfn-type="value">
3875+
<dt><dfn id="font-variant-caps-normal-value" title="normal!!font-variant-caps">normal</dfn>
3876+
<dd>None of the features listed below are enabled.</dd>
3877+
3878+
<dt><dfn>small-caps</dfn>
3879+
<dd>Enables display of small capitals
3880+
(OpenType feature: <span class="tag">smcp</span>).
3881+
Small-caps glyphs typically use the form of uppercase letters
3882+
but are reduced to the size of lowercase letters.</dd>
3883+
3884+
<div class="featex"><img alt="small-caps example" src="images/smcp.png"></div>
3885+
3886+
<dt><dfn>all-small-caps</dfn>
3887+
<dd>Enables display of small capitals for both upper and lowercase letters
3888+
(OpenType features: <span class="tag">c2sc, smcp</span>).</dd>
3889+
3890+
<dt><dfn>petite-caps</dfn>
3891+
<dd>Enables display of petite capitals
3892+
(OpenType feature: <span class="tag">pcap</span>).</dd>
3893+
3894+
<dt><dfn>all-petite-caps</dfn>
3895+
<dd>Enables display of petite capitals for both upper and lowercase letters
3896+
(OpenType features: <span class="tag">c2pc, pcap</span>).</dd>
3897+
3898+
<dt><dfn>unicase</dfn>
3899+
<dd>Enables display of mixture of small capitals for uppercase letters
3900+
with normal lowercase letters
3901+
(OpenType feature: <span class="tag">unic</span>).</dd>
3902+
3903+
<dt><dfn>titling-caps</dfn>
3904+
<dd>Enables display of titling capitals
3905+
(OpenType feature: <span class="tag">titl</span>).
3906+
Uppercase letter glyphs are often designed for use with lowercase letters.
3907+
When used in all uppercase titling sequences
3908+
they can appear too strong.
3909+
Titling capitals are designed specifically for this situation.</dd>
3910+
</dl>
3911+
3912+
<p>The availability of these glyphs
3913+
is based on whether a given feature is defined or not
3914+
in the feature list of the font.
3915+
User agents can optionally decide this
3916+
on a per-script basis
3917+
but should explicitly not decide this
3918+
on a per-character basis.</p>
3919+
3920+
<p>Some fonts may only support a subset
3921+
or none
3922+
of the features
3923+
described for this property.
3924+
For backwards compatibility with CSS 2.1,
3925+
if 'small-caps' or 'all-small-caps' is specified
3926+
but small-caps glyphs are not available for a given font,
3927+
user agents should simulate a small-caps font,
3928+
for example by taking a normal font
3929+
and replacing the glyphs for lowercase letters
3930+
with scaled versions of the glyphs
3931+
for uppercase characters
3932+
(replacing the glyphs for both upper and lowercase letters
3933+
in the case of 'all-small-caps').</p>
3934+
3935+
<div class="figure" style="padding: 0; margin: auto;"><img class="hires" width=512 alt="synthetic vs. real small-caps" src="images/synthetic-vs-real-small-caps.png"><p class="caption">Synthetic vs. real small-caps</p></div>
3936+
3937+
<p>The 'font-feature-settings' property
3938+
also affects the decision of
3939+
whether or not to use a simulated small-caps font
3940+
(unlike CSS Fonts 3).<p>
3941+
3942+
<div class="example">
3943+
<pre>#example1 { font-variant-caps: small-caps; }
3944+
#example2 { font-variant-caps: small-caps; font-feature-settings: 'smcp' 0; }</pre>
3945+
For fonts which don't support small caps, both #example1 and #example2
3946+
should be rendered with synthesized small caps. However, for fonts which
3947+
do support small caps, #example1 should be rendered with native small
3948+
caps, while #example2 should be rendered without any small-caps (native
3949+
or synthesized).
3950+
</div>
3951+
3952+
<p>To match the surrounding text,
3953+
a font may provide alternate glyphs
3954+
for caseless characters
3955+
when these features are enabled
3956+
but when a user agent simulates small capitals,
3957+
it must not attempt to simulate alternates
3958+
for codepoints which are considered caseless.</p>
3959+
3960+
<div class="figure" style="padding: 0; margin: auto;"><img class="hires" width=418 alt="caseless characters with small-caps, all-small-caps enabled" src="images/small-capitals-variations.png"><p class="caption">Caseless characters with small-caps, all-small-caps enabled</p></div>
3961+
3962+
<p>If either 'petite-caps' or 'all-petite-caps' is specified
3963+
for a font that doesn't support these features,
3964+
the property behaves as if
3965+
'small-caps' or 'all-small-caps', respectively,
3966+
had been specified.
3967+
If 'unicase' is specified
3968+
for a font that doesn't support that feature,
3969+
the property behaves as if 'small-caps' was applied
3970+
only to lowercased uppercase letters.
3971+
If 'titling-caps' is specified
3972+
with a font that does not support this feature,
3973+
this property has no visible effect.
3974+
When simulated small capital glyphs are used,
3975+
for scripts that lack uppercase and lowercase letters,
3976+
'small-caps', 'all-small-caps', 'petite-caps',
3977+
'all-petite-caps' and 'unicase'
3978+
have no visible effect.</p>
3979+
3980+
<p>When casing transforms are used
3981+
to simulate small capitals,
3982+
the casing transformations must match
3983+
those used for the <span class="property">'text-transform'</span> property.</p>
3984+
3985+
<p>As a last resort,
3986+
unscaled uppercase letter glyphs
3987+
in a normal font
3988+
may replace glyphs in a small-caps font
3989+
so that the text appears
3990+
in all uppercase letters.</p>
3991+
3992+
<div class="figure" style="padding: 0; margin: auto;"><img class="hires" width=596 alt="using all-small-caps in acronym-laden text" src="images/acronym-laden-text.png"><p class="caption">Using small capitals to improve readability in acronym-laden text</p></div>
3993+
3994+
<div class="example">
3995+
<p>Quotes rendered italicised, with small-caps on the first line:</p>
3996+
3997+
<pre>blockquote { font-style: italic; }
3998+
blockquote:first-line { font-variant: small-caps; }
3999+
4000+
&lt;blockquote><a href="https://lists.w3.org/Archives/Public/www-style/2009Dec/0036.html" style="text-decoration: none; border: none;">I'll be honor-bound to slap them like a haddock.</a>&lt;/blockquote>
4001+
</div>
4002+
4003+
38494004
<h3 id="font-variant-numeric-prop">
38504005
Numerical formatting: the 'font-variant-numeric' property</h3>
38514006

84.9 KB
Loading
55.2 KB
Loading
49.2 KB
Loading
35.7 KB
Loading

css-fonts-4/images/smcp.png

2.61 KB
Loading
21.4 KB
Loading
15.5 KB
Loading

0 commit comments

Comments
 (0)