6
votes

I wanted to show some mathematical expressions in a winforms textbox. So I thought the "Cambria Math" font would be a good choice but the text looked strange due the high top and bottom margin of the font. First I thought I made a mistake but according to this question, it's the correct behavior of the font.

Screenshot of the textbox

Why does Cambria Math have these big margin values and how can I display my string correctly in the textbox like Word 2010?

(Note that I know only a little bit about typography ;)

Edit: I had to make the textbox that tall otherwise the caret would be invisible. The font size of the textbox is set to 8.25pt

1
The font looks properly synced with the caret; it looks to me like your textbox is just too tall.Cody Gray
Good point, I forgot to mention that I had to make the textbox that tall, otherwise the caret would not be visible.MBulli

1 Answers

6
votes

Cambria Math uses Microsoft's mathematical OpenType extensions.

Word 2007 and later understand these and display the text with reasonable spacing.

However, notepad and Word 2000 display the text with enormous spacing, just like winforms. I guess the font has this much space by default because some characters (like U+2320, top half integral) are much larger than the alphanumerics.

If you use Cambria Math with a font engine (such as the one used by winforms) that doesn't understand the math extensions, you're going to get the big spacing.

If you're displaying simple expressions you might as well use Cambria.