Skip to content

Commit

Permalink
[css-fonts-4] Add font-presentation property
Browse files Browse the repository at this point in the history
  • Loading branch information
litherum committed Mar 9, 2017
1 parent 67aca47 commit d99abee
Showing 1 changed file with 54 additions and 8 deletions.
62 changes: 54 additions & 8 deletions css-fonts-4/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1788,19 +1788,65 @@ at least as dark as its predecessor. Only values between 1 - 999 are valid, and

Using CSS Variables is explicitly expected to be valid in the value of this descriptor. Using CSS Variables is disallowed in the key of this descriptor. CSS Variables are resolved in the context of the element to which the 'font-palette' property applies. This means that using 'font-palette' with the same value on two different elements may result in different used palettes because the value of variables inside the '@font-palette-values' rule may apply differently in the context of those two elements.

<h2 id="platform-props-to-css" class="no-num">Appendix A: Mapping platform font properties to CSS properties</h2>
<h3 id="font-presentation-desc">Selecting the text presentation style: The 'font-presentation' property</h3>

Issue: Import from level 3
<pre class="propdef">
Name: font-presentation
Value: auto | text | emoji
Initial: auto
Applies to: all elements
Inherited: yes
Percentages: N/a
Computed value: As specified
Media: visual
Animatable: No (see below)
</pre>

ISSUE: <a href="https://github.com/w3c/csswg-drafts/issues/1092">Bikeshed the name.</a>

This property allows web authors to select whether emoji presentation or text presentation is used for certain emoji code points. Traditionally, these presentation styles were selected by appending Variation Selector 15 (U+FE0E) or Variation Selector 16 (U+FE0F) to certain code points. However, 'font-presentation' allows web authors to set a default presentation style which can replace the variation selectors.

Only the code points <a href="http://www.unicode.org/emoji/charts/emoji-variants.html">listed</a> by Unicode as contributing to a Unicode Presentation Sequence are affected by this property. Within this CSS specification, these characters are referred to as <span id="presentation-participating-code-points">Presentation Participating Code Points</span>. This property has no effect on any other characters.

This property is expected to affect font fallback; however, the exact nature of the interaction of font fallback with 'font-presentation' is explicitly unspecified. However, a variation selector must be included in a previous cluster as defined by the <a href="#cluster-matching">cluster matching</a> section above. Therefore, the presence of a variation selector is treated as ancillary data to inform the font fallback routine. A natural result of this behavior is that a variation selector must not be rendered in a different font than the previous character.

Even when 'font-presentation' is used, the presence of Variation Selector 15 (U+FE0E) or Variation Selector 16 (U+FE0F) in the contents of an element override the rendering specified in 'font-presentation'. Therefore, 'font-presentation' sets a default presentation which the text being rendered can opt out of.

Note: Different platforms have different conventions about how to handle emoji presentation sequences. A cross-platform UA may wish to follow the conventions of each inividual platform, or it may wish to use the same approach on all platforms. When tasked with a request for an emoji style rendering, a UA may wish to disregard fonts which do not include color tables. A different UA may wish instead to use the same mechanical cluster fallback algorithm that it would use for any arbitrary cluster.

<h2 id="emoji-fallback">Font fallback for emoji codepoints</h2>
Variation selectors other than FE0E VARIATION SELECTOR-15 and U+FE0F VARIATION SELECTOR-16 must not have any affect on font selection. If one of these variation selectors is present, but unsupported by the font previously selected, the variation selector is ignored.

<p>Many codepoints supported by emoji fonts overlap with codepoints supported
by existing fonts. In fallback situations where it's not clear whether to use
an emoji font or not, UTR51 defines a the default behavior for a given codepoint.</p>
<dl dfn-for=font-presentation dfn-type=value>
<dt><dfn>auto</dfn></dt>
<dd>
User Agents may choose to draw a <a href="#presentation-participating-code-points">Presentation Participating Code Point</a> in either emoji style or text style. User Agents may wish to follow the <a href="http://www.unicode.org/reports/tr51/proposed.html#Presentation_Style">guidance</a> of the Unicode Consortium when performing this decision. User agents also may wish to follow platform conventions when performing this decision.
</dd>

<p class="note">Authors can explicitly control emoji or text display using selectors.</p>
<dt><dfn>text</dfn></dt>
<dd>
Code points are rendered as if U+FE0E VARIATION SELECTOR-15 was appended to every <a href="#presentation-participating-code-points">Presentation Participating Code Point</a>.
</dd>

<p class="example">Example of author control over emoji/text styles</p>
<dt><dfn>emoji</dfn></dt>
<dd>
Code points are rendered as if U+FE0F VARIATION SELECTOR-16 was appended to every <a href="#presentation-participating-code-points">Presentation Participating Code Point</a>.
</dd>
</dl>

<div class="example">
To show the emoji form of U+1F6CB COUCH AND LAMP, let CustomEmoji.ttf obey the User Agent's notion of supporting the emoji form of this character, and use the following:
<pre>@font-face {
font-family: "Custom Emoji";
src: url("CustomEmoji.ttf") format("truetype");
}
...
&lt;div style="font-family: 'Custom Emoji'; font-presentation: emoji;"&gt;&amp;#x1F6CB;&lt;/div&gt;
</pre>
</div>

<h2 id="platform-props-to-css" class="no-num">Appendix A: Mapping platform font properties to CSS properties</h2>

Issue: Import from level 3

<h2 id="acknowledgments">Acknowledgments</h2>

Expand Down

0 comments on commit d99abee

Please sign in to comment.