Faking Subpixel Antialiasing on Text with Core Animation

前端 未结 5 1153
半阙折子戏
半阙折子戏 2020-12-08 02:58

For anyone working on a project with Core Animation layer-backed views, it\'s unfortunately obvious that subpixel antialiasing (text smoothing) is disabled for text not rend

5条回答
  •  天涯浪人
    2020-12-08 03:20

    As a simple hack, if text anti-aliasing is working (but not subpixel), you can fake it by rendering to a view that is 3x as wide, then scaling down. This is nonportable as I know of no way to query the element order on your display, but it should work.

    E.g.,

    RGB RGB RGB -> RGB
    |    |    |    |||  
    |    |    +----++^
    |    +---------+^
    +--------------^
    

提交回复
热议问题