问题
I'm trying to render using CoreText (appkit version) on a (semi-) transparent background, and as a result the edges aren't smooth.
Searching the web suggests that there's no solution to this problem, however I don't believe it because of one simple observation: if I create a CATextLayer containing the same string then the font is lovely and smooth.
I've tried setting the various 'allowed' settings to true and then working through the 16 possibilities that they offer. Some are better than others, this is what I have so far:
CGContextSetAllowsAntialiasing(context, YES);
CGContextSetAllowsFontSmoothing(context, YES);
CGContextSetAllowsFontSubpixelPositioning(context, YES);
CGContextSetAllowsFontSubpixelQuantization(context, YES);
CGContextSetShouldAntialias(context, YES);
CGContextSetShouldSmoothFonts(context, NO);
CGContextSetShouldSubpixelPositionFonts(context, YES);
CGContextSetShouldSubpixelQuantizeFonts(context, YES);
Can someone please tell me how to get the same results that CATextLayer achieves?
来源:https://stackoverflow.com/questions/14442498/coretext-font-smoothing-on-a-transparent-background