Skip to content

[css-fonts-4] [varfont] Applying a variation with font-variant-settings should actually clamp the applied value to the range the font supports #517

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

Closed
litherum opened this issue Sep 21, 2016 · 10 comments
Labels
css-fonts-4 Current Work

Comments

@litherum
Copy link
Contributor

For variation fonts, if you say something like: font-weight: 814; but the font file only supports weights of 400-700, then we should clamp 814 to that range and end up applying a weight of 700 instead.

@litherum litherum changed the title [css-fonts-4] Applying a variation should actually clamp the applied value to the range the font supports [css-fonts-4] [varfont] Applying a variation should actually clamp the applied value to the range the font supports Sep 21, 2016
@litherum litherum added the css-fonts-4 Current Work label Sep 21, 2016
@litherum
Copy link
Contributor Author

This clamping should not occur for the low-level font-variant-settings property.

@Crissov
Copy link
Contributor

Crissov commented Oct 6, 2016

We could also clamp only <percentage> values and always take <number> literally.

@litherum
Copy link
Contributor Author

2bf006e specifies how to do the clamping for font-weight, font-stretch, and font-style. Specifically, the clamping of those properties interact with font selection.

For font-optical-sizing, there is nothing to clamp because the values are just "none" and "auto".

As per #517 (comment), this clamping shouldn't occur for font-variation-settings.

Therefore, this should be done.

@behdad
Copy link

behdad commented Nov 7, 2016

For variation fonts, if you say something like: font-weight: 814; but the font file only supports weights of 400-700, then we should clamp 814 to that range and end up applying a weight of 700 instead.

The clamping happens in rendering software anyway. However, what needs CSS support is IMO, if @font-face declares a range narrower than what the font supports, then browser should clamp to the @font-face range indeed, even though the font supports wider.

@litherum
Copy link
Contributor Author

litherum commented Nov 8, 2016

The clamping does not happen in CoreText.

The values in @font-face are only designed to be used for font selection, ad therefore should not affect which variation values get applied.

@behdad
Copy link

behdad commented Nov 8, 2016

The values in @font-face are only designed to be used for font selection, ad therefore should not affect which variation values get applied.

"which variation values get applied" is font selection! Same way that unicode-range limits a font, @font-face ranges must limit the font IMO.

@svgeesus
Copy link
Contributor

Yes, this would be consistent with what we do with unicode-range for example - if the descriptors have a narrower range than what the font actually supports, then we enforce those restrictions. Because the stylesheet designer had some reason to do so (not liking glyphs in a particular unicode range / not liking the bolder weights so preventing them from being used).

@litherum litherum reopened this Nov 23, 2016
@litherum litherum changed the title [css-fonts-4] [varfont] Applying a variation should actually clamp the applied value to the range the font supports [css-fonts-4] [varfont] Applying a variation with font-variant-settings should actually clamp the applied value to the range the font supports Dec 1, 2016
@litherum
Copy link
Contributor Author

litherum commented Dec 1, 2016

It's fairly clear that everyone else wants clamping. I'll change the spec to do that.

@litherum
Copy link
Contributor Author

litherum commented Dec 1, 2016

I migrated @behdad's issue to #782

litherum pushed a commit that referenced this issue Dec 1, 2016
@litherum
Copy link
Contributor Author

litherum commented Dec 1, 2016

52b802a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-fonts-4 Current Work
Projects
None yet
Development

No branches or pull requests

4 participants