Font rendering weirdness with Courier New

Greg Ewing <[email protected]>
Newsgroups gmane.comp.python.pyobjc.devel
Message-ID <[email protected]>
When I draw text in PyGUI using Courier New, it comes
out too far down by about half the height of the lower
case letters.

The problem only seems to affect this particular font;
all the other fonts I've tried are positioned correctly.

This is the code I'm using to get the baseline of the
text positioned at (x, y):

   h = ns_font.defaultLineHeightForFont()
   d = -ns_font.descender()
   ns_point = NSPoint(x, y - h + d)
   ns_string.drawAtPoint_withAttributes_(ns_point, ns_attrs)

Am I doing anything wrong here? I've checked the values
that Cocoa is getting for defaultLineHeightForFont and
descender, and they seem to be correct, but the text comes
out in the wrong place when using that font.

-- 
Greg

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.