Re: [css-fonts] Simplify the syntax definitions of @font-face and @font-feature-values

On Thu, May 23, 2013 at 8:23 PM, John Daggett <jdaggett@mozilla.com> wrote:
> Tab Atkins wrote:
>> The two at-rules in the Fonts spec can be specified in a much
>> simpler and easier-to-read manner, now that I've defined rules for
>> rule grammars.
>
> I think what you've omitted here is that based on the new Syntax spec,
> these rules could be simplified.  I'd really rather not do that at
> this stage, since it means a dependency on the Syntax spec which is
> unstable.  Elika posted similar comments to the list [1].
>
> I definitely agree that it would be nice to get rid of the parser
> gobbledygook from out specs (e.g. "F f|\\0{0,4}(46|66)(\r\n|[ \t\r\n\f])?")
> but until Syntax is stable and there is consensus around whatever
> changes it entails, I think we need to wait for higher levels for
> these sorts of changes.

It depends on Syntax as much as property grammars depend on Values -
not really at all, the given spec is just a convenient place to put
the definitions.

That said, if you'd like to shelve the suggestion until the F2F,
that's fine too.

> I also think if you toss the grammar bits in the @font-feature-values
> rule case you have to add more description to specify what's valid in
> a <declaration-list>. The grammar serves as a much more precise
> description I think.
>
>> The grammar for @font-face is:
>>
>> @font-face { <declaration-list> }
>>
>> The valid declarations inside a @font-face rule are the descriptors
>> defined in this specification to apply to @font-face.
>
> How does this avoid the fact that with !important has no role within
> @font-face rules?  That's the reason the spec currently defines
> <descriptor-declaration>.  In the context of descriptors it just
> becomes a term that invalidates the declaration?

Defined in the description of the grammar in Syntax - !important is
never valid in descriptors.  (If this ever changes, I can just update
the rules to say that !important is invalid in descriptors by
default.)

>> The grammar for @font-feature-values is:
>>
>> @font-feature-values <'font-family'># { <rule-list> }
>>
>> The valid rules inside a @font-feature-values are <font-feature-rule>s:
>>
>> <font-feature-rule> = [@stylistic | @styleset | ...] { <declaration-list> }
>>
>> The declarations inside a <font-feature-rule> are descriptors.  Any
>> descriptor name is valid.
>
> Revision 2:
>
>> > @font-feature-values <'font-family'># { <rule-list> }
>>
>> Sorry, mistake from an earlier edit.  I meant:
>>
>> @font-feature-values <'font-family'> { <rule-list> }
>
> No, this doesn't work because generics can't be included and those
> would be included in <'font-family'>.

I don't see any such restriction in the spec - the token grammar just
uses font_family_list, and the paragraph following says it "uses the
same syntax as that used for the ‘font-family’ property".

In any case, that's a trivial fix (and the reason for the edit that
caused the initial screwup) - just use <family-name># instead of
<'font-family'>.

~TJ

Received on Friday, 24 May 2013 03:41:21 UTC