Why doesn’t Mail size fonts correctly?

Like many mail clients, Apple’s Mail app purports to provide a rich text and graphics environment in its messages. You’d like to think that setting font size is part of that, but if you have used different sizes in messages, you may have noticed that they don’t work properly.

The bug is easy to reproduce: in a new message, set a series of lines to use different font sizes (in any font, that is immaterial), such as 13, 15, and 17 points. In the draft message, these will be shown scaled correctly. Send yourself that message, and when you read it in Mail, some of its fonts will be scaled differently from those shown in the draft.


Above, the same message is rendered in Mail 10.3, on the left in the main message viewer, and on the right when a draft being edited.


These messages use HTML format. If you open the message as sent in Safari 10.1.2, as shown above, the lines are rendered in the correct sizes.


Looking at the HTML source generated by Mail reveals part of the problem: two different elements are used to set font size in the message.
<font size="3" class="">
style="font-size: 15px;"

These use two different methods for determining font size: an HTML ‘scale’ from 1-7, where 3 is ‘normal’, and a length, which is here given in pixels. Although pixels and points are not really interchangeable, at a display resolution of 72 dpi, they are effectively the same, as a point is 1/72nd of an inch.

It happens that in Mail’s main window, the HTML scale is being rendered differently from its draft editor and Safari.

There is also a more fundamental problem here, as the <font> element in HTML has been declared “obsolete”, and usage notes read:
Do not use this element! Though once normalized in HTML 3.2, it was deprecated in HTML 4.01, at the same time as all elements related to styling only, then obsoleted in HTML5. Current advice is to use CSS Fonts, as in the other element specifying the size in pixels.

So the current version of Apple’s Mail app actually has multiple issues here.

First, it shouldn’t be generating code using the obsolete <font> element. Continuing to do so ignores the very real danger that a recipient’s mail client may now perfectly correctly ignore that element, and not set the font size correctly. Apple cannot claim that this is being done for backward compatibility, because in some font sizes Mail uses CSS Fonts, which are current, standard in HTML5, and recommended.

Next, Mail shouldn’t be mixing the two different schemes for setting font size, particularly as the old HTML 1-7 method only relates to itself, and not to absolute font sizes. To mix them is asking for this sort of rendering issue.

Finally, Mail should be rendering its main message and draft editor windows using the same engine, preferably in common with Safari. The evidence here is that Mail is using two different rendering methods, one of which handles font size better than the other.

From what seems to be a simple bug emerges evidence of several quite significant issues in Mail’s internals. On this glimpse, it looks quite a mess.

Thanks to Bart Hanson for alerting me to this curious bug.