This project is read-only.

SpriteFont positioning problems.

Sep 20, 2011 at 12:51 AM
Edited Sep 20, 2011 at 1:04 AM

This is the News Gothic font from the XNA font pack, Bold, 18 point (meaning 18 specified in the XML), alignment is set to UpperEnd, and Native hinting (Windows 7 32 bit). It does approximately the same thing with AutoHinter selected.

The Y-coord for the red text is the top light blue guide (a hard-coded coordinate from when I was using the XNA SpriteFonts). You can see that the red letter "A" starts 7 pixels below that. What is causing this?

Interestingly, if I switch it to Baseline alignment, it seems to work exactly as expected. Unfortunately that isn't going to work for my needs, I have to render very large multi-line blocks of text and using a top-left origin is far more convenient.

(Ignore the white text; it was rendered by a routine to vertically centered it using the top blue line -- like most of the text in my program, which tended to hide the problem since it's then incorrectly positioned by only 3 pixels instead of 7.)