10.2. Tools for Downloading Fonts from the Web

In the previous section, we described the CSS declaration src: url("...");, which requests the downloading of a font from the Web. We even furnished a list of font formats provided in the CSS specification. But what does this declaration actually do?

Well, the situation is not golden. Several factors are responsible: first, and we shall never say it enough in this book, fonts are usually subject to copyright and cannot be made available to the public. Thus (a) the format in which the font is downloaded must be an encrypted and secure format so that extraction of its data will be impossible, and (b) the file downloaded must serve no purpose other than the rendering of the web page in question. That is all quite possible, through the use of unpublished font formats (unlike OpenType, PostScript Type 1, etc.) and by locking the downloaded file to a given URL: even if the file is recovered and moved to another location, it will be useless.

But the technical difficulties do not stop there. A browser usually resorts to graphical routines in the operating system to render the contents of its windows. That means that the fonts used for rendering text also come from the operating system. But here we are proposing to obtain a file from the Web—a file that only the browser will know how to decrypt—and use its contents as a font, just like the fonts on the system. That approach amounts to short-circuiting the operating system. At the same time, ...

Get Fonts & Encodings now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.