Re: mutable attributed string - underline clearing bold
Re: mutable attributed string - underline clearing bold
- Subject: Re: mutable attributed string - underline clearing bold
- From: email@hidden
- Date: Sun, 25 Sep 2016 03:15:11 +1300
Ignore the noise.
Just clicked : Use addattribute:… message.
Doh! Programming early in the morning is bad.
> On 25/09/2016, at 1:57 AM, tridiak <email@hidden> wrote:
>
> I have a mutable attributed string where a range is set to bold.
> textFont is valid.
>
> NSFont* bFont=[fontManager fontWithFamily:textFont.familyName traits:NSBoldFontMask weight:0 size:textFont.pointSize];
> [mas setAttributes:@{NSFontAttributeName:bFont} range:rge];
>
> This works.
>
> When a set the attribute underline in a separate call that encompasses part of or all of the bold range, the bold effect is removed and the underline takes it’s place.
>
> NSDictionary* ul=@{NSUnderlineStyleAttributeName:@(NSUnderlineStyleSingle)};
> [mas setAttributes:ul range:rge2];
>
> Why is the bold removed? Underline is not a font trait (unless I am wrong).
> Do I have to set the bold and underline in the same call?
> They are different calls because the ranges can be different.
>
> OS 10.11.6. XCode 7.3.1. SDK latest/10.11
>
> TIA
> Mark
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden