m = 1

(March 1, 2008)

Disoriented Canadian moose after drinking two Belgian beers Luc Devroye
School of Computer Science
McGill University
Montreal, Canada H3A 2K6
lucdevroye@gmail.com
http://cg.scs.carleton.ca/~luc/index.html
http://cg.scs.carleton.ca/~luc/fonts.html



UPM

UPM stands for units per eM. These are whole numbers that generally describe the size of the coordinate space in which a font is designed. For example, with a UPM of 1000, each contour point of a font is roughly in an imaginary box of 1000 by 1000. The UPM defines a grid, so the higher the UPM, the finer the grid. The grid size for a UPM of 1000 is 1000x1000, or one million. Think of it as the ``megapixels'' in a font. Font specifications differ for various font formats, and most font specifications allow points to occur outside the UPM box (but not far outside).

  •    PostScript fonts (type 1, type 3) have a coordinate space of the user's choice. Type 3 is quite unrestricted, while type 1 works as follows: the designer can choose an UPM value that is comfortable, 1000 being the traditional limit, with more and more people opting recently for higher quality UPM values (I often use 6,000, Tim Ahrens admits to using 3,000, Mikhail Kovalev has used 16,000, David Berlow claims that the Linotype library was built using about 8,000, and the Bitstream library on 4,320, and I myself have successfully tested 80,000). The true character is then scaled back, via a FontMatrix, to the unit box of width and height one. Small exceedances are tolerated (a glyph can stick out by up to one in any direction). The FontMatrix for a UPM of 1000 would be [ 0.001 0 0 0.001 0 0], or [ 1 1000 div 0 0 1 1000 div 0 0 ], the "div" indicating division by 1000. A UPM of 69069---to take a juicy number off the shelf---could be used by setting the FontMatrix equal to [ 1 69069 div 0 0 1 69069 div 0 0 ]. Within that unit box, the tallest character typically reaches to about 75% of the height (or 0.75 in absolute value). However, some font editors, printers, and applications can impose limits beyond those specified by the founding fathers.

  •    Truetype fonts have a UPM that is typically (but not necessarily) a power of 2, often 2048, and by law less than 16,384 (see the OpenType and TrueType specs). Truetype fonts with an UPM of 2048 cause conversion headaches because 2048 is not quite twice 1000, the old standard for type 1 fonts. See the discussion here.

  •    OpenType fonts come in two genetic variations, type 1 based, and truetype-based. The clueless OpenType developers have made a royal mess of things by not insisting on a unified format, and by limiting the UPM to 16,384. Some argue that 16,384 is enough: just as with megapixels in photographs, humans will never be satisfied. In 2040, we will look back at those primitive low-tech anemic UPM days. In October 2008, Thomas Phinney (Adobe, Seattle) states: Having a UPM other than 1000 [in a CFF-style OpenType font], and creating a PDF with non-Adobe tools, may result in the CFF font getting scaled incorrectly in Adobe Reader/Acrobat. [Translated: Adobe Acrobat is not following the PDF specs---I wonder why...]

  •    Internal formats: Deep within the guts of editors such as FontForge, FontLab and Fontographer, and indeed all major font editors, proprietary font formats live dark lives but often secretly enjoy a large UPM value. That opens up interesting possibilities, as companies could release fonts with various grades of roughness depending upon the price charged. No one has gone this route yet, as far as I know.

Conversions

It is often said that truetype fonts can be losslessly converted into type 1 fonts. That can only be so if the UPM of the type 1 font is equal to or a multiple of that of the truetype font. With a conversion from truetype's 2048 to PostScript's 1000, a rounding loss is unavoidable. Furthermore, since new outline points inherent in the conversion have coordinates that need to be divided by three or two without leaving a remainder, the rule for lossless conversion is that the PostScript UPM divided by the truetype UPM should be a multiple of six. So, truetype's 2048 should become PostScript's 6 x 2048 = 12,288, or a multiple of that. And truetype's 16,384 should become PostScript's 98,304.

The conversion from type 1 (cubic Bezier) to truetype (quadratic Bezier) on the other hand involves a loss, regardless of the UPM value. It is probably correct to say that not a single conversion in history has been lossless.

m = 1

Is it possible to design fonts with an "em" or UPM equal to one? That would mean that all vertices and all control points would have to be chosen from four points, [ 0 0 ], [ 0 1 ], [ 1 1 ] and [ 1 0 ], the four vertices of the unit square. Well, why don't we find out?

On a snowy Montreal winter day, it took just a few hours to design some type one fonts with a FontMatrix equal to an astonishing [ 1 0 0 1 0 0 ]. Clearly, this had to be done by coding the process, because font editors generally give up: all control points and end points basically coincide, and mouseclicking is futile.

There is a lot of beautiful amoebic life within the severe limitations imposed on the design. Just consider that there are 256 (4 to the power 4) possible Bezier curves based on those four corner points of the square, and that these can be joined together in many ways. It is quite impossible to show all the glyphs that can be obtained. Because of the winding rule and the nonlinearity of the Bezier curves, it is not easy to count the number of different glyphs obtainable, but it is clearly well over a billion.

So, I took a more modest aim, and generated two sets of 256 glyphs at random, and called the experimental fonts UMP1a and UMP1b, with one having more Bezier components per glyph than the other. All little giflets on this page are drawn from these two fonts.

Code

Here is a part of the code for one glyph, to show that we are just working within that unit box.

/FontBBox [ 0 0 1 1  ] readonly def
/FontMatrix [ 1 0 0 1 0 0 ] def
...
/Barack-054  { 0 1 hsbw
0 0 rmoveto
1 0 -1 1 1 -1  rrcurveto
-1 1 0 -1 1 1  rrcurveto
-1 0 0 -1 0 0  rrcurveto
closepath
 endchar } ND
 ...

The font UMP1b

The character palettes

The full character palettes: UMP1a, UMP1b. The name: why UMP and not UPM? Download the type 1 fonts: UMP1a and UMP1b.