On 27.06.2010, at 22:12, Dave Fernandes wrote:
> I'm trying to render text in System font in an NSImage as shown below. The 
> NSImage is displayed *unscaled* in an NSImageView. However, the text does not 
> look as good as when rendered in an NSView. Is there any way to get crisp 
> clean text in an NSImage?

Try drawing the text offset by 0.5 points. Fuzzy drawing like that usually 
means that, at some point, you're drawing "between pixels". Since the 
mathematical coordinate system actually passes each pixel at the upper left, to 
get a line that lies on a pixel, you generally have to draw offset by 0.5 pt to 
hit a pixel straight on. OTOH, I think drawing an NSImage usually needs to be 
done at a 0,0 coordinate (because the upper left of an NSImage is also at a 
full logical coordinate and everything has already been drawn offset twice).

If it's not your drawing code, you may have a view whose coordinates are not on 
a x.0 boundary, which can cause all sorts of weird things like that because it 
indirectly causes drawing like that. You can see that in the NIB by looking at 
the numbers in the inspector. Keep in mind that the coordinates of a superview 
could be wrong in this case as well.

-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.masters-of-the-void.com



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to