Contents

Pixel comparison

Tools

Pixel comparison

The AMS sample paper testmath.tex, typeset twice from one run of LuaTeX: as a pageless PDF, and in the browser by ReflowTEX, with its column exactly as wide as the PDFโ€™s. Both are drawn at 4 pixels per point, and the two pictures are matched line by line. Where each glyph is, the render tests compare without pixels; Accuracy describes both.

The browser is photographed with its text in TEXโ€™s black rather than the siteโ€™s dark grey, and without the smoothing macOS adds to thicken letters, so that it draws glyphs the way a PDF renderer does. Then LuaTeX typeset the paper again with its column 85pt wider, and the same browser page, built from the 345pt run, was set at 430pt: there every paragraph is broken in the browser for a width the page was never compiled at.

In the pictures below, white means the two agree and red marks pixels that differ, the more they differ the darker, on a scale that keeps a pixel partly off paler than one wholly off, so a glyph that is not where it should be stands out in full red. The pink along edges is rasterisation: the PDF renderer and the browser smooth the edges of glyphs differently, and the PDF renderer puts each glyph on a whole pixel row. The bar above the picture has a cell for every 500pt of the paper, red where rows are out of place rather than just drawn differently. Switch between PDF and Browser to see the two at the same place.

Drawn finer shows the same comparison with both the PDF and the browser drawn at 16 pixels per point and averaged down to 4, the same way on both sides. That takes out the PDF rendererโ€™s snapping of each glyph to a pixel row, and fewer pixels differ strongly. But at that scale the browser draws its glyphs a little differently again, so more rows differ slightly; the table has both.

345 pt column430 pt column
Glyphs in the PDF41,56641,562
โ€ฆ found in the browser, same line, within 0.7 pt41,56641,562
Text lines with no glyph more than 0.1 pt out sideways2,565 of 2,5652,491 of 2,491
Largest error of any glyph found, across0.09 pt0.10 pt
Largest error of any glyph found, down0.01 pt0.01 pt
Height of the document, PDF / browser19,816.3 / 19,816.0 pt18,931.3 / 18,931.0 pt
Pixel rows compared (4 px per point)79,26575,725
โ€ฆ identical, up to 1 % of pixels76,08273,379
โ€ฆ differing in place (rasterisation)3,2292,376
โ€ฆ the same ink moved sideways00
โ€ฆ with no counterpart on the other side44
Pixels differing by more than half0.051 %0.043 %
Both drawn 4 times finer, then averaged down to 4 px per point
Pixel rows identical, up to 1 % of pixels74,85672,113
โ€ฆ differing in place (rasterisation)4,4593,672
โ€ฆ the same ink moved sideways00
โ€ฆ with no counterpart on the other side56
Pixels differing by more than half0.041 %0.026 %

the samerows differ in place (drawing)rows out of place