문제

I am trying to get a line below the attributed string on my custom NSView (NSButton attributedString) and I am using the NSUnderlineStyleAttributeName

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

And the result on the non-retina screen is like: Underline is too thick

This line is very thick (2 pixels), I tried all various combinations of NSUnderlineStyleAttributeName, plus tried to offset the Y axis by 0.25f or 0.50f but this doesn't solve the problem, it makes it just blurry as "expected"

So any ideas? I don't want to draw the line my self in code, I am looking for a solution with attributed strings.

도움이 되었습니까?

해결책

This appears to be an issue with the typeface being used, as others with the NSUnderlineStyleSingle attribute don't exhibit the same behavior.

Ex:

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top