Re: Reftests and Subpixel layout

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.

Regards,

John Daggett

[1] Uneven line height bug in Firefox
https://bugzilla.mozilla.org/show_bug.cgi?id=442139
https://bug442139.bugzilla.mozilla.org/attachment.cgi?id=457497

[2] Font metrics problem on Linux in Firefox
https://bugzilla.mozilla.org/show_bug.cgi?id=604836

Received on Saturday, 17 March 2012 03:57:22 UTC