CGContextShowTextAtPoint doesn't show text
CGContextShowTextAtPoint doesn't show text
- Subject: CGContextShowTextAtPoint doesn't show text
- From: Gabriel Zachmann <email@hidden>
- Date: Tue, 09 Aug 2011 14:43:21 +0200
I am having a problem with rendering text on a CALayer.
AFAIK, it works just fine with all users ... except one, where the text just does not show!
This is my code for printing the text:
@interface TextLayerDelegate : NSObject
{
// ...
}
- (void) drawLayer: (CALayer *) theLayer inContext: (CGContextRef) theContext;
@end
@implementation TextLayerDelegate
- (void) drawLayer: (CALayer *) theLayer inContext: (CGContextRef) ctxt
{
// ...
const char * str = [mesg cStringUsingEncoding: NSMacOSRomanStringEncoding]; // encoding must match with CGContextSelectFont() below
if ( str && strlen(str) )
{
CGContextSetShouldAntialias( ctxt, TRUE );
CGContextSetRGBFillColor( ctxt, 1.0, 1.0, 1.0, 1.0 );
CGContextSelectFont( ctxt, "AndaleMono", 14, kCGEncodingMacRoman ); // "Andale Mono" doesn't work either
CGColorRef blue = CGColorCreateGenericRGB( 0.0, 0.0, 1.0, 1.0 );
CGContextSetShadowWithColor( ctxt, CGSizeMake(0,0), 10, blue );
CGContextShowTextAtPoint( ctxt, theLayer.bounds.origin.x + 7.0, theLayer.bounds.origin.y + 7.0, str, strlen(str) );
CFRelease( blue );
}
}
I have checked that 'str' does actually hold a valid string at the user's instance. (I logged it and had him send me the log file.)
I have also tried different font sizes.
I have also googled around.
All to no avail.
Does anybody have an idea what else might be wrong?
Thanks a lot in advance.
Gab.
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden