Re: [css3-fonts][cssom] proposal for revised definition of CSSFontFaceRule

Sebastian Zartner wrote:

> For the sake of differentiating the @font-face descriptors from the
> style rule properties are not the same and to avoid unnecessary
> typing I suggest to remove "font" from the descriptor names. So
> instead of "font-family", "font-style", "font-weight",
> "font-stretch", "font-variant" and "font-feature-settings" we'll
> just have "family", "style", "weight", "stretch", "variant" and
> "feature-settings" inside @font-face.

This is inconsistent with general usage -- the descriptors are named
"font-weight", "font-family", "font-style", etc. so the properties 
should follow the existing pattern for style rules, i.e. "fontWeight",
"fontFamily", "fontStyle", etc.  I think that consistency far outweighs
the advantage of saving the typing of the 'font' prefix on these.

> Small initials! I.e. it should be getDescriptorValue() and setDescriptorValue().

Thanks, others pointed that out also.

> Also where's the "style" attribute? From the examples below all
> descriptor attributes should be put in there. This raises the
> question if we really need a "style" attribute (of type
> CSSFontFaceDeclaration in accordance to CSSStyleRule ->
> CSSStyleDeclaration) or if all descriptors should be put directly
> into the CSSFontFaceRule as shown above.

I'm proposing using a different interface here from the existing one,
in effect dumping the old interface that used a 'style' property, the
odd hybrid CSSStyleDeclaration/CSS2Properties amalgamation funkiness. 
We could put all the descriptors into a struct and but I'm not sure I
see the advantage of that.  The examples would explicitly *not* work
unless some form of .style.xxx aliasing was implemented.

> Because "font" in a CSSFontFaceRule != "font" in a CSSStyleRule, the
> correct behavior is to ignore it.

Right, this example is simply showing the dangers of using the
CSSStyleDeclaration as the container for font-face rule descriptors.

> > Example 2: What should the code below do?
> >
> >     rule.style.fontFamily = "test1, test2";
> Same reason as above, so ignore it. Will be even clearer that it's
> not the same as a CSSStyleRule "fontFamily" when it's renamed to
> "family".

This *isn't* the same as example 1, it's trickier because the property
*is* a font-face descriptor but the parsing rules are different for
the descriptor compared to the property.

The other examples would simplify to direct access to CSSFontFaceRule
members or to getDescriptorValue/setDescriptorValue calls.

Cheers,

John

Received on Friday, 14 September 2012 01:52:15 UTC