How to work around poor text rendering in text backed by a CALayer

前端 未结 4 1901
感动是毒
感动是毒 2021-01-31 23:16

I have some variable text in an NSTextField that renders on a CALayer background view. As a CALayer does not support sub-pixel aliasing fo

4条回答
  •  别跟我提以往
    2021-01-31 23:35

    What are the X, Y positions of the Text once it gets it's variable string filled in? I had a similar problem for a UILabel which was caused by the fact that the XY position of the text were floats. (it was trying to center variable data and the XY vals were half pixels)

    I truncated the values and it fixed the blurry text.

提交回复
热议问题