This is a wild guess but it worked for me with Core Text on the iPad a long time ago. One or several of these can probably work for you.
• CGContextSetAllowsAntialiasing • CGContextSetAllowsFontSmoothing • CGContextSetShouldSmoothFonts • CGContextSetAllowsFontSubpixelPositioning • CGContextSetShouldSubpixelPositionFonts • CGContextSetAllowsFontSubpixelQuantization • CGContextSetShouldSubpixelQuantizeFonts -ev On Apr 27, 2011, at 12:45, Simone Manganelli wrote: > I'm adding some Core Animation to my existing project, and I'm encountering > some differences in the font rendering compared to non-Core Animation code. > Here's the code used to draw my strings: > >> NSShadow *selectedShadow = [[NSShadow alloc] init]; >> [selectedShadow setShadowOffset:NSMakeSize(0,-1)]; >> [selectedShadow setShadowColor:[NSColor colorWithCalibratedWhite:0.0 >> alpha:0.33]]; >> [selectedShadow autorelease]; >> >> NSMutableParagraphStyle *leftAlignedEllipsisStyle = >> [[NSMutableParagraphStyle alloc] init]; >> [leftAlignedEllipsisStyle setAlignment:NSLeftTextAlignment]; >> [leftAlignedEllipsisStyle setLineBreakMode:NSLineBreakByWordWrapping]; >> [leftAlignedEllipsisStyle autorelease]; >> >> NSDictionary *selectedAttributes = [NSDictionary >> dictionaryWithObjectsAndKeys: >> [NSFont systemFontOfSize:11.0], >> NSFontAttributeName, >> [NSColor whiteColor], >> NSForegroundColorAttributeName, >> selectedShadow, NSShadowAttributeName, >> leftAlignedEllipsisStyle, >> NSParagraphStyleAttributeName, >> nil]; >> >> [someString drawWithRect:textRect >> options:NSStringDrawingTruncatesLastVisibleLine | >> NSStringDrawingUsesLineFragmentOrigin >> attributes:selectedAttributes]; > > Here's the difference: > http://homepage.mac.com/simx/images/antialiasing-diff.png > > On the left is text rendered in my existing project using the above code via > the drawRect: method. On the right is text rendered into a CALayer using the > drawLayer:inContext: method. > > I'm aware of the fact that Core Animation disables sub-pixel rendering for > text when drawing to transparent backgrounds, so I've intentionally designed > my CALayers so that they have opaque backgrounds. Sub-pixel rendering is > definitely active now that I've drawn an opaque color to the layer. This > doesn't seem to be the issue, especially because the Core Animation text > appears *heavier* than the normal Quartz text, whereas it usually appears > more wispy when sub-pixel rendering is off. > > Nor does this seem to be an issue with half-pixels. The selection bubble is > rendering crisply (from image assets), which indicates that the layer is > positioned correctly. And the text itself isn't blurred, so the text is also > positioned correctly. > > This almost looks as if a heavier kind of antialiasing is active on the text. > I recall that Mac OS X had four different types of antialiasing you could > choose in the Appearance preference pane, but this preference is gone in more > recent versions. Could I be hitting that and somehow using some different > form of antialiasing? > > Any help would be greatly appreciated. > > -- Simone > _______________________________________________ > > 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/ev%40monoceroi.com > > This email sent to e...@monoceroi.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