In LoadImageFont, you specify a font size, but that size doesn't translate to pixels. Additionally, the width and height of a character in a fixed-width font may be different.
The problem is that you can't call TextWidth and TextHeight before Graphics.
The problem is that you can't call TextWidth and TextHeight before Graphics.