Best text rendering settings?
Best text rendering settings?
- Subject: Best text rendering settings?
- From: Gideon King <email@hidden>
- Date: Fri, 4 Feb 2011 23:15:46 +1000
Hi, I have a layer I want to draw some text on (10.6 target). To actually draw the text, I am creating the NSGraphicsContext using the graphics port, and using drawBackgroundForGlyphRange... and drawGlyphsForGlyphRange... to draw the text.
The output never looks as good as plain old text in a text view.
I started playing with some of the settings in the CGContext to see if I could make it better. Specifically, I tried:
CGContextSetAllowsAntialiasing
CGContextSetShouldAntialias
CGContextSetAllowsFontSmoothing
CGContextSetShouldSmoothFonts
CGContextSetAllowsFontSubpixelPositioning
CGContextSetShouldSubpixelPositionFonts
CGContextSetAllowsFontSubpixelQuantization
CGContextSetShouldSubpixelQuantizeFonts
CGContextSetInterpolationQuality
...with various combinations of values, and both with screen fonts and without, but the best I got it was the same as what I got without changing any of the settings.
I have my layer aligned between device pixels, and all the rest of the drawing on the layer looks crisp. I have tried aligning the point that it is drawn both on and between device pixels.
Is there anything I can do to improve the rendering of the text on my layer? Is there some magic combination of the above factors or something else, that will improve the rendering? Is the issue because I'm switching to the NSGraphicsContext (and if so, how would I do the equivalent drawing using core functions)?
The documentation doesn't give very thorough explanations of what each option does and when you may want to use it, and doesn't tell you whether it is on or off by default, so I feel as if I'm flying blind to some extent. I did see a previous thread which did give a bit more information on some of the options, but not enough to solve this issue.
It looks "ok", but definitely not as good as the rendering of a text view.
TIA
Gideon
_______________________________________________
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