Open xhan opened 13 years ago
Chameleon does not use subpixel smoothing when rendering text because it is implemented with CALayers (as is the real UIKit on iOS). Since each major part of a typical UIKit/Chameleon control is drawn into their own layers, there is no way to access the color information behind the text that's necessary to smooth the text in the way AppKit does. If you flatten your views manually by drawing everything (text, etc.) in drawRect:, you can turn on smoothing and have it work but then you're stuck not having any transparent backgrounds on your views and it changes how you do things pretty significantly.
On Sep 25, 2011, at 10:24 AM, xu han wrote:
by using same font and fontSize
LucidaGrande 14
Render effect on AppKit(using NSTextField) Render effect on Chameleon(tested with UILabel, UINSCellControl with NSTextFieldCell) Let's zoom in (top one is rendered in AppKit)Reply to this email directly or view it on GitHub: https://github.com/BigZaphod/Chameleon/issues/67
Subpixel antialiasing, as you mentioned, can be enabled any time you're drawing into an opaque background. Since everything eventually composites onto an opaque background, the easiest way to enable subpixel antialiasing is to avoid drawing and caching individual layers (or, at least, non-opaque layers).
This approach may or may not be possible with CALayer
and the rendering employed in Chameleon, but we have some code in a Core Animation imitation framework that successfully employs this technique. It could be useful as a reference: https://github.com/joshaber/MoreAnimation/blob/master/Framework/MoreAnimation/MoreAnimation/Classes/MALayer.m#L835
Still not find a solution on how to enable Subpixel antialiasing on transparent context. next step I will try CGContextSetBlendMode to seem if it helps.
but I just noticed that TWUI has Sub-pixel text rendering enabled. not sure how they did it.
TWUI can not get sub-pixel AA on transparent context too..
Found a quick-dirty solution so far, by adding a stroke around text with width 0.1.
This makes text feel more clean and a bit border.
@ jspahrsummers even if I would do it more efficiently but I think you'll optimize your calls you are totally right
@xhan does something like pixel grid means something to you?
by using same font and fontSize
LucidaGrande 14
Render effect on AppKit(using NSTextField) Render effect on Chameleon(tested with UILabel, UINSCellControl with NSTextFieldCell) Let's zoom in (top one is rendered in AppKit)