Re: [css-fonts] font-size: smaller/larger (with pretty graphs!)

Hi Simon,

> As far as I can tell, the spec for these keywords has no normative
> requirements. The relevant paragraphs has sentences with "For
> example", "the user agent is free to", "the user agent may".

Yup. This is stuff that was in CSS 2.1 and prior. The definition of
larger/smaller is ultimately tied to the "sizes" defined for the
deprecated HTML <font> tag (e.g. '<font size=3>'). Using
larger/smaller bumps one up or down in the chart of absolute values
correlated with the HTML <font> tag size values.

> When implementing these keywords in Servo, I graphed their respective 
> computed value against the inherited font-size. Results are here:
> 
> https://github.com/servo/servo/issues/3423#issuecomment-56321664
> 
> It turns out that five browser engines have five different behaviors. 
> Yay interop!

Yay, interop of the HTML <font> tag! Different browsers have in the
past defined the size values (e.g. 'xx-small', 'large', 'x-large')
differently, hence the problems you see.

I ran into problems with this writing the fallback support for
subscript/superscript glyphs, since most user agents use 'font-size: smaller'
for the sub/sup elements.

https://bugzilla.mozilla.org/show_bug.cgi?id=1029307#c17

The problem is that 'smaller' doesn't end up being a fixed ratio but
varies with the initial font size. The smaller the font size the
larger the 'smaller' ratio works out.

> I don’t think this is worth doing anything about (except maybe have the 
> spec explicitly say "this is undefined" and move everything else into a 
> note.) I just though y’all might be interested.

It is what it is I think. Saying it's not defined is not really
right either. It's got "suggestions" and browsers have implemented
something along those lines.

For servo I would suggest doing what is simple. :) For roughly
approximating 'font-size: smaller', I used:

http://mxr.mozilla.org/mozilla-central/source/gfx/thebes/gfxFont.cpp#3380

Regards,

John

Received on Thursday, 25 September 2014 01:18:21 UTC