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-4] Clarify maximum number of <feature-value-names> in character-variant() #9311

Closed
cdoublev opened this issue Sep 5, 2023 · 10 comments

Comments

@cdoublev
Copy link
Collaborator

cdoublev commented Sep 5, 2023

There it says 2:

The character-variant() property value allows two values and styleset() allows an unlimited number.

https://drafts.csswg.org/css-fonts-4/#multi-value-features

But in other places, it says unlimited.

character-variant(<feature-value-name>#): Enables display of specific character variants [...]

https://drafts.csswg.org/css-fonts-4/#character-variant

Example 66:

p {
  font-variant: discretionary-ligatures
    character-variant(leo-B, leo-M, leo-N, leo-T, leo-U);
}

https://drafts.csswg.org/css-fonts-4/#ex-byzantine-variants

Chrome/FF (at least) accept an unlimited number.

@cdoublev cdoublev added the css-fonts-4 Current Work label Sep 5, 2023
@svgeesus
Copy link
Contributor

I don't understand where "allows two values" comes from, it seems clearly wrong.

@svgeesus
Copy link
Contributor

Aha, I think this is a mixing up of character-variant property and @character-variant:

When two values are listed, the first value indicates the feature used and the second the value passed for that feature. If more than two values are assigned to a given name, a syntax error occurs and the entire feature value definition is ignored.

So the fix is "The @character-variant font feature value allows either one or two values"

@svgeesus
Copy link
Contributor

Looks like this was my mistake when the text was moved from Fonts 3 (which did not use bikeshed) to Fonts 4.

@cdoublev
Copy link
Collaborator Author

cdoublev commented Sep 22, 2023

The text in CSS Fonts 3 was the same. I do not know how to access the old CVS repo to further investigate the initial intent, but I also think that declaration values in @character-variant should match <integer>{2}; the number of arguments in character-variant() is unlimited (there is no character-variant property, Bikeshed outputs character-variant() from 'character-variant').

@svgeesus
Copy link
Contributor

character-variant is a value of the font-variant-alternates property.

I'm about to push an edit which hopefully clears things up.

svgeesus added a commit that referenced this issue Sep 22, 2023
@svgeesus
Copy link
Contributor

@cdoublev please take a look

@cdoublev
Copy link
Collaborator Author

Looks good to me, thank you! So it should be character-variant(<feature-value-name>#{2})?

I was waiting for Tab and Simon answers on how to represent font feature value rules in a production. But now w3c/webref can scrap these rule definitions, I think. In this #9114 (comment), I suggested using definition tables, but I am not sure how it could work with these rules. I will keep an eye on this issue.

@cdoublev
Copy link
Collaborator Author

So it should be character-variant(#{2})?

Nevermind! Time to sleep.

@cdoublev
Copy link
Collaborator Author

cdoublev commented Oct 11, 2023

I am sorry because I should have take a look at your changes earlier in the day, and this sentence seems confusing to me:

The character-variant() property value and the @character-variant descriptor allow two values, which enables a feature (from the first value) and sets it to a given (second) value.

character-variant() definitely allows more than two values.

I think it should be something like this:

The character-variant() property value enables the features defined by the @character-variant descriptor declarations whose names are specified as its arguments. @character-variant declaration values allow two values, which enables a feature (from the first value) and sets it to a given (second) value.

@svgeesus svgeesus reopened this Oct 11, 2023
@cdoublev
Copy link
Collaborator Author

cdoublev commented Feb 5, 2024

I also would like to clarify the expected output when declaring a feature for @character-variant with more than two values. Should it be valid but ignored? Or invalid and discarded?

edit:

Never mind, I did not see this further above:

A syntax error within a font feature value declaration makes the declaration invalid and ignored, but does not invalidate the font feature value block it occurs in.

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

No branches or pull requests

2 participants