Hi, I have the problem if I use super/subscript within an attributed string, then it doesn't seems to work with CATextLayer, and I don't know why.
I tried NSSuperscriptAttributeName and NSBaselineOffsetAttributeName string = [[NSMutableAttributedString alloc] init]; [string beginEditing]; [string replaceCharactersInRange:NSMakeRange(0,0) withString:@"CO2"]; [string addAttribute:NSFontAttributeName value:[NSFont controlContentFontOfSize:12] range:NSMakeRange(0,3)]; [string addAttribute:NSForegroundColorAttributeName value:[NSColor blackColor] range:NSMakeRange(0,3)]; [string addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInt:NSUnderlineStyleSingle] range:NSMakeRange(0,2)]; // first case [string addAttribute:NSSuperscriptAttributeName value:[NSNumber numberWithInt:-1] range:NSMakeRange(2,1)]; // second case //[string addAttribute:NSBaselineOffsetAttributeName value:[NSNumber numberWithInt:-5] range:NSMakeRange(2,1)]; // third case //[string subscriptRange:NSMakeRange(2, 1)]; [string endEditing]; It works perfectly with drawAtPoint: - (void)drawRect:(NSRect)rect { [string drawAtPoint:NSMakePoint(10, 20)]; } But not with a CATextLayer - (void)awakeFromNib { self.wantsLayer = YES; layer = [CATextLayer layer]; layer.string = string; layer.bounds = CGRectMake(0, 0, layer.preferredFrameSize.width, layer.preferredFrameSize.height); layer.position = CGPointMake(10, 150); layer.borderWidth = 1; layer.anchorPoint = CGPointMake(0,0); [self.layer addSublayer:layer]; } Does anyone know how to solve it or have an explanation why it doesn't work? Thank you, Stephan Michels. _______________________________________________ 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 [EMAIL PROTECTED]