[Pyobjc-dev] Font rendering weirdness with Courier New
Brought to you by:
ronaldoussoren
From: Greg E. <gre...@ca...> - 2011-06-26 07:55:20
|
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 |