Add shadow (recessed text effect) to Cocoa label without degrading text rendering quality

后端 未结 2 781
无人共我
无人共我 2021-02-01 07:57

I\'d like to create statusbar with text effect like in Safari or iTunes, i.e. recessed text.

\"example\"

However,

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-01 08:48

    It's a cheap old trick: You draw the text in white at an offset and then draw the black text on top of it.

    There is a hook for shadows in the text-drawing system, NSAttributedString's NSShadowAttributeName. But testing this out, it appears to kill the subpixel antialiasing as well.

提交回复
热议问题