Mac 上的核心动画和抗锯齿字体
我正在尝试创建一个由核心动画层支持的视图。但是,当我启用该图层时,我的标签开始看起来有点锯齿状。我附上了差异演示:
我知道这很微妙,但它让我发疯(尤其是对于较小的字体)。有什么方法可以让核心动画图层标签消除锯齿吗?
I'm trying to create a view that is backed by a Core Animation layer. However, when I enable the layer, my labels start to look slightly jagged. I've attached a demonstration of difference:
I know it is subtle, but it is driving me crazy (especially for smaller fonts). Any way I can get the Core Animation layer labels to be anti-aliased?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
挑剔:核心动画层是抗锯齿的,但质量较低——它不使用子像素抗锯齿。其原因是子像素抗锯齿需要每通道混合,而通过硬件合成无法廉价地完成这一任务。
此处链接的示例演示了各种解决方法这个问题。
Nitpick: the Core Animation layer is anti-aliased, but at a lower quality – it doesn’t use sub-pixel anti-aliasing. The reason for this is that sub-pixel anti-aliasing requires per-channel blending, which can’t be done cheaply with hardware compositing.
The example linked from here demonstrates various ways of working around this problem.