-
Notifications
You must be signed in to change notification settings - Fork 707
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] Clarify parsing of <font-face-name>
for the src: local(...)
function
#8187
Comments
Wouldn't it be useful to be able to say something like @font-face { (Perhaps as a member of a larger trimmed-system-font family?) |
It might be, but that shouldn't be a (I seem to remember bringing up such a suggestion some years ago, actually, but it didn't get any traction....) |
So that would be better expressed as something like
|
I would be interested in having a basic syntax definition of |
WebKit/WebKit#8396 font-face src local() doesn't invalidate css-wide keywords |
Thanks for the change Chris. Do you think this can be applied to CSS Fonts 5 as well?
|
I added and thus,
<a>CSS-wide keywords</a> such as ''inherit'', and
<<generic-family>> keywords such as ''serif''
are not allowed inside <code>local()</code>. and <div class="invalid example">
For example, this use of <code>local()</code> would be an error:
<pre class="lang-css">
@font-face {
font-family: foo;
src: local(inherit);
}
</pre>
</div> |
Closed by 75e8082 |
The
src
descriptor of an@font-face
rule has a comma-separated list of component values.One type of component value is a local font specified using the
local()
function. The<font-face-name>
argument tolocal()
is:Here, I presume "the unquoted font family name processing conventions" must be referring -- although not linked in the spec -- to the more detailed description of the
<family-name>
syntax found in the context of thefont-family
property.The "unquoted font family name processing conventions" mentioned in the
<font-face-name>
description clearly refer to the construction of a single string name from a sequence of space-separated identifiers, as for examplelocal(Times New Roman Bold)
, to identify the same face aslocal("Times New Roman Bold")
.What's less clear to me is whether these "processing conventions" also encompass the restriction that:
In the context of the
<font-face-name>
argument tolocal()
in an@font-face
rule, it would not be meaningful to use a CSS generic-family (because the argument is not a font family at all, it's an individual font face), and so arguably there is no risk of confusion; a component likelocal(serif)
must unambiguously refer to a font face whose actual name is "serif", and not to the (potentially composite and/or language-dependent) font family to which the propertyfont-family: serif
would refer.Still, I think it is unhelpful to permit unquoted generic-family identifiers here; users have enough difficulty with the family/face distinction already. And perhaps the mention of the "family name processing conventions" should be taken to include the rule excluding such keywords.
So in short, my question -- which I do not think the spec clearly addresses -- can be boiled down to whether the rule:
can equivalently (although confusingly) be written as:
or is the latter a parse error, resulting in a rule that lacks any valid source?
Currently, it appears that WebKit and Blink both accept the unquoted generic-family here, while Gecko does not. However, I would suggest that Gecko's behavior is preferable, and should be explicitly spec'd. In the (unlikely) event that a user really does want to refer to a local font face literally named "serif" (for example), they can do this using a quoted string. Accepting the unquoted identifier misleads users into conflating font faces and font families.
cc @svgeesus @drott @litherum
The text was updated successfully, but these errors were encountered: