Small text set down anywhere is grey. Here it finds the pixel grid by itself: the rasterizer says how each pixel changes as the outline moves, and the outline moves to make the picture less grey.
RasterizeExact.the outline as the font has it the outline where the knots have taken it; and along the top and down the left, how far each pixel line's knot has slid.
Rendering: about 130 lines of Nile, none of them the page’s own, and 280 of TypeScript: the lines, the warp, what to want (the grey, the blurred picture, the even spacing) and the step. The page’s interface isn’t counted.
A font’s outlines know nothing of pixels. Set at 13 px wherever the line happens to fall, a stem a pixel and a third wide lands across two columns and is drawn as two columns of grey; the baseline lands part way down a row. Fonts carry hints to put this right, small programs written glyph by glyph that move stems and baselines onto the grid, and renderers that do without them look for stems themselves. This page has neither. It has the rasterizer, and the rasterizer’s derivative.
RasterizeExact is the rasterizer the other pages can draw
with, and nothing in it was written for this. umgeni compiles it a second
time, in your browser, as its own derivative: every number becomes the
number and how it changes along each of a set of directions. The
directions here are the knots of a warp. Each line of the paragraph has a
knot on every pixel line, across and down; each may slide along its axis,
and a point of an outline moves with the two knots it lies between. So
each pixel comes back with how its coverage would change as each knot
slid.
A line has some four hundred knots, and a letter lies among twenty or so. So each letter is rasterized by itself, with a direction for each knot it lies among and no others, and the letters’ pictures are added: they do not cover one another, so the sum is the line’s picture exactly, and each letter’s slopes go to the knots they belong to. Every letter of a line answers to the same knots down, which is why a line keeps one baseline.
The rest is a few lines of arithmetic in TypeScript. A pixel’s grey is c (1 − c) for coverage c: nothing when it is wholly inked or wholly clear. The sum is brought down, with two things held: the picture blurred a pixel each way is to stay what it was, and neighbouring knots are to slide together. Stems come to rest on pixel lines and the baseline on a row, because that is where the grey is least, and nobody has said what a stem or a baseline is.
What holds the letters matters as much as what moves them. Let go of both and the paragraph is sharper still and no longer says anything: arches and bowls close up into slabs, which are the sharpest things there are. Either hold alone keeps it readable. And the page shows what this cannot do. A diagonal or a curve has grey however it is placed, so letters made of them gain little. Thin strokes are drawn lighter when they come to rest a pixel wide. A hinter that knows what a stem is can keep every stem the same width, and every line’s letters the same height; this knows only the picture, a line at a time.