NSUnderlineStyleAttributeName

NSUnderlineStyleAttributeName

我正在尝试在自定义NSView(NSButton attributedString)的属性字符串下方找到一行,并且正在使用NSUnderlineStyleAttributeName

    [self addAttribute:NSUnderlineStyleAttributeName value:@(NSUnderlineStyleSingle) range:range];


非视网膜屏幕上的结果如下:


这条线很粗(2像素),我尝试了NSUnderlineStyleAttributeName的所有各种组合,并尝试将Y轴偏移0.25f或0.50f,但这不能解决问题,它只是像“预期的”一样模糊

有什么想法吗?我不想在代码中划清界限,我正在寻找带有属性字符串的解决方案。

最佳答案

这似乎与所使用的字体有关,因为其他具有NSUnderlineStyleSingle属性的字体不会表现出相同的行为。

例如:


Avenir Next
Lato (the font in use)

07-24 14:18