• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
CGContextShowTextAtPoint doesn't show text
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: CGContextShowTextAtPoint doesn't show text
      • From: Graham Cox <email@hidden>
    • Re: CGContextShowTextAtPoint doesn't show text
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: NSCoding to/from JSON?
  • Next by Date: Re: Frameworks (ConnectionKit)
  • Previous by thread: Re: Lingering windows
  • Next by thread: Re: CGContextShowTextAtPoint doesn't show text
  • Index(es):
    • Date
    • Thread