Honouring font preferences in browsers

In an attempt to fit more on a page and believing everybody has the Verdana font (which looks big), many not-so-professional designers start their style sheets with something like 'font-size: 90%' or even smaller sizes. This means they want the size to be smaller than what the user wants.

Their argument is that they don't ignore the user, they help him, because many users don't know how to make the font size of their browser smaller…

But many people do know how to select their own font preferences and as people become more familiar with the Web and its tools, more and more people expect their preferences to be taken into account.

So here is a proposal for a mechanism that gives users the possibility to get the font size they prefer, even if the designer has explicitly set a different size and without loosing the relative variations in size that a designer has put in a page.

Font size re-mapping

The idea is that the browser re-maps all the font sizes that are used in a document to the range that the user prefers. Currently, browsers only re-map font sizes that are below the user's minimum, but in this mechanism all font sizes would shift up (or down) so that the smallest one on the page is equal to the user's minimum font size.

Maybe this should not be a simple linear shift, but a non-linear re-mapping, in which the smallest font is mapped to the user's minimum size and the “median” font to the user's preferred (medium) size.

There is, however, a small problem: what font sizes are used in a document is only known when the whole document has been read. But browsers typically start displaying as soon as the first lines of the document arrive. This means browsers have to start with a guess about the range of font sizes in the document and they may have to revise that guess when the rest of the page has been read.

A first guess might be that the font size of the BODY element is the median one and the smallest font is 70% of that.

Pixel-perfect designs

Designers may have chosen their font sizes to match the images in a page. Images are still mostly in raster formats (JPEG, PNG) and are, to save bandwidth, only provided in the smallest size that still looks good, i.e., one image pixel equals one screen pixel (or CSS's 'px', actually).

Hopefully better compression of photographs and higher bandwidths will allow photographs to be provided in slightly higher resolutions, so that the browser can adapt the size within a certain range. And hopefully many images will be provided in vector formats, mainly SVG.

But browsers that implement a font re-mapping mechanism should probably have a button to disable the re-mapping on individual pages, in case the designer has relied too much on text and images being lined up.

Bert Bos <bert at phonk.net>
Created: 21 July 2005