Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-fonts] Feature resolution and caps synthesis conflicting #259

Closed
tabatkins opened this issue Jul 1, 2016 · 7 comments
Closed

[css-fonts] Feature resolution and caps synthesis conflicting #259

tabatkins opened this issue Jul 1, 2016 · 7 comments
Labels

Comments

@tabatkins
Copy link
Member

On Fri, Jul 1, 2016 at 2:08 AM, Dominik Röttsches [email protected] wrote:

Hi,

consider the following example:

span {
font-variant-caps: all-small-caps;
font-feature-settings: "smcp" 0, "c2sc" 0;
}

https://drafts.csswg.org/css-fonts/#feature-precedence says that at
font-variant-caps should be take into account at precedence level 4,
however, at level 6 it is overriden by font-feature-settings.

The synthesis rules in
https://drafts.csswg.org/css-fonts/#propdef-font-variant-caps describe that
if none of the native features are available, all-small-caps should be
synthesized by upper-casing the text and downscaling the font.

However, what should be the exact definition of availability here, taking
into account the feature resolution?

The feature resolution can be interpreted in two ways:

  1. It means it should deactivate/hide the available features in the font and
    trigger synthesis since the resolved available feature set does not have
    smcp and c2sc, or alternatively,
  2. no synthesis is done since the feature detection has determined that the
    features are available and should be enabled through font-variant-caps, but
    then are deactivated through font-feature-settings.

Opinions? What should happen in this case -

@tabatkins
Copy link
Member Author

I lean toward #1 (it seems to enable more scenarios, and I like the mental model it suggests), but I could be convinced by a consistency argument the other way.

@litherum
Copy link
Contributor

litherum commented Jul 6, 2016

Interpretation number two is correct. Because font-feature-settings overrides the font-variant-caps, the feature is considered off (and therefore no synthesis occurs).

@frivoal
Copy link
Collaborator

frivoal commented Jul 8, 2016

Also, while #1 is more expressive, I am far from convinced that what it can express actually has legitimate use cases. I mean, sure, if you are writing a textbook about typography, and want to illustrate using a font that has smallcaps how comparatively ugly it is when you use synthesized small caps instead of real ones, then maybe you'd want that. But I don't think the ability to demonstrate bad results that nobody should want is a use case we go after. If you want to do that, do it as an illustration / image. This isn't a case where a separation between content and style is valid.

@litherum
Copy link
Contributor

litherum commented Mar 8, 2017

I started investigating this more, and I have to say that I've changed my mind. The low-level property is used when the web author has a priori knowledge of what features the font supports, so browsers shouldn't get in their way by interpreting font-feature-settings to turn off synthesis. Browsers are currently discouraged (disallowed?) from inspecting the 4-character-codes passed to font-feature-settings in order to perform synthesis. Because the concepts of synthesis and font-feature-settings are divorced, in this case, the addition of font-feature-settings shouldn't have any affect on synthesis.

@litherum
Copy link
Contributor

litherum commented Mar 8, 2017

This piece also interacts with the fact that the individual font's character-based feature support (using the OpenType GSUB/GDEF Coverage subtable) must be consulted when deciding whether or not to perform synthesis.

@litherum
Copy link
Contributor

litherum commented Mar 8, 2017

With the following test, Firefox, Safari, and Chrome all agree on the rendering (modulo the implementation of font-synthesis: small-caps;):

<div style="font: 100px 'Avenir Next'; font-variant-caps: small-caps;">Hello, World</div>
<div style="font: 100px 'Avenir Next'; font-variant-caps: small-caps; font-synthesis: none;">Hello, World</div>
<div style="font: 100px 'Avenir Next'; font-variant-caps: small-caps; font-feature-settings: 'smcp' 0;">Hello, World</div>
<div style="font: 100px 'Avenir Next';">Hello, World</div>
<div style="font: 100px 'Times'; font-variant-caps: small-caps;">Hello, World</div>
<div style="font: 100px 'Times'; font-variant-caps: small-caps; font-synthesis: none;">Hello, World</div>
<div style="font: 100px 'Times'; font-variant-caps: small-caps; font-feature-settings: 'smcp' 0;">Hello, World</div>
<div style="font: 100px 'Times';">Hello, World</div>

(Avenir Next supports small caps, but Times doesn't.)

Therefore, option 1 should be in the spec.

@litherum
Copy link
Contributor

litherum commented Mar 8, 2017

Also 388a53d

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants