Exercise 3 solution: matching two fonts by x-height ==================================================== The task: show the same sentence in Georgia and Arial at the same font-size, see that Arial looks bigger, then bring Georgia into line using the x-height numbers from the chapter. The arithmetic (from the numbers the chapter's script printed, in font units out of 2048): Arial x-height 1062 -> 1062 / 2048 = 0.519 of the em Georgia x-height 986 -> 986 / 2048 = 0.481 of the em Georgia's size to match Arial's x-height at 18px: 18 * (1062 / 986) = 19.39 -> about 19.4px Method 1: do the sum by hand
Arial at 18px: the quick brown fox jumps over the lazy dog.
Georgia at 18px: the quick brown fox jumps over the lazy dog.
Georgia at 19.4px: the quick brown fox jumps over the lazy dog.
Method 2: let the browser do the sum with font-size-adjust .georgia-auto { font-family: Georgia, serif; font-size-adjust: 0.519; } font-size-adjust: 0.519 asks the browser to scale the font so that its x-height is 0.519 of the font-size, which is Arial's ratio. (Browser support: check before relying on it, and look it up on MDN. It was missing from some browsers for years.) What you should see ------------------- * The first two lines: both are "18px" yet the Arial lowercase letters are visibly taller. * The third and fourth lines: the lowercase letters now sit at about the same height as Arial's. The capitals and the whole line get a little larger too, which is the price of matching by x-height. * The practical lesson: "font-size: 18px" is not a promise about how big text looks, only about the size of the em square. Font size alone cannot compare two typefaces.