Monaco FontMetrics

There's been a problem in Terminator when using the Monaco font on Mac OS. Unfortunately, Mac OS doesn't have Lucida Sans Typewriter, the only other monospaced font worth using, so this needed to be fixed.

(Until today, I was unaware that Kris Holmes was involved with both. Hats off to the Hermann Zapf of monospaced fonts!)

I had assumed, based on previous experience with incorrect widths for anti-aliased text in Apple's Java implementation, that the problem was Apple's, not ours. Today I sat down to write a convincing demonstration of the differences between Monaco and Courier's FontMetrics suitable for submission as a bug. What I found was that the reason we were having trouble with Monaco is that it has non-zero leading.

One part of our code, when trying to work out where to put the baseline, assumes that FontMetrics.getHeight is equivalent to getAscent + getDescent, but it's actually equivalent to getAscent + getDescent + getLeading. It's just that, for most fonts, the leading is zero.

If I'd found a page suggesting this the first time I asked Google for "Monaco FontMetrics", I could have had this fixed a long time ago. The fix itself took just seconds, including the time to find the erroneous code!