Frage

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.

War es hilfreich?

Lösung

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

Ex:

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top