NSString drawInRect:withAttributes: clips descenders
NSString drawInRect:withAttributes: clips descenders
- Subject: NSString drawInRect:withAttributes: clips descenders
- From: Brant Sears <email@hidden>
- Date: Wed, 3 May 2006 13:55:48 -0400
Hi. I'm trying to use the method drawInRect: withAttributes: method
of NSString to draw a single character at a time into an NSImage. The
problem that I am having is that descenders are being clipped. So,
for example, the character j is being chopped where it descends below
the baseline. This affects other descenders like p, q, y, etc.
What can I do to fix this? It seems like this call sets the baseline
at the very bottom of the NSRect that is specified in the method.
The method that I am using is as follows:
NSFont * myFont = [NSFont fontWithName:@"Monaco" size:10];
NSDictionary * attsDict = [NSDictionary dictionaryWithObjectsAndKeys:
[NSColor whiteColor], NSForegroundColorAttributeName,
myFont, NSFontAttributeName,
[NSNumber numberWithInt:NSNoUnderlineStyle],
NSUnderlineStyleAttributeName,
nil ];
[charStr drawInRect: charRect withAttributes:attsDict];
The context in which I am doing this is that the NSImage has already
been locked into focus and had its background filled with black. Is
there an attribute I can use to raise the baseline? Also, I have to
have this work on 10.2 and up. A 10.4 only solution can be used, but
I would still need some other solution for 10.2/10.3.
Thanks!
Brant Sears
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden