W3C home > Mailing lists > Public > public-css-testsuite@w3.org > March 2012

Re: Reftests and Subpixel layout

From: John Daggett <jdaggett@mozilla.com>
Date: Fri, 16 Mar 2012 20:56:53 -0700 (PDT)
To: fantasai <fantasai.lists@inkedblade.net>
Cc: public-css-testsuite@w3.org, "L. David Baron" <dbaron@dbaron.org>, Jet Villegas <jet@mozilla.com>
Message-ID: <425416492.12763988.1331956613945.JavaMail.root@zimbra1.shared.sjc1.mozilla.com>
fantasai wrote:

> GĂ©rard's been running into a number of issues affecting the creation of
> reftests due to the fact that Firefox does subpixel-precision layout and
> the font APIs on Linux only return pixel-precision data. The workaround
> for this seems to be to use fonts at sizes where it is known their metrics
> land on whole-pixel sizes.
> Many of our self-describing tests suffer from this problem. Their pass/
> fail results can be determined accurately, but creating a pixel-perfect
> reference is difficult or impossible without altering the original test.
> Similar issues probably exist anywhere there is inconsistent pixel-rounding.
> For example, Firefox rounds border widths with different rules than it
> rounds box heights, making a reftest comparison between a solid border
> and a solid-color fixed-height block meaningless if their sizes involve
> fractional pixels.
> Which brings us to a suggestion from Jet: to require tests, insofar as
> possible, to align their layout to the px grid, so that they can be
> reliably associated to a reference.

I'm not quite sure which of the tests this is referring to but I know
some of the problems are not completely related to subpixel placement
and relate to differences in how font/line metrics are calculated and
the rounding involved.  There are bugs in Firefox that I know of
related to this [1], [2].  Requiring tests to "align their layout to the px
grid" is neither practical or desirable.

Tests that involve text need to be aware of subpixel placement and not
make assumptions that assume integer pixel placement in the inline
direction.  One of the advantages of reftests is that they give you a
framework to do just that in combination with fonts for which the
metrics are known.


John Daggett

[1] Uneven line height bug in Firefox

[2] Font metrics problem on Linux in Firefox
Received on Saturday, 17 March 2012 03:57:22 UTC

This archive was generated by hypermail 2.4.0 : Friday, 20 January 2023 19:58:18 UTC