title: How to apply bold and italics to an NSMutableAttributedString range?
body: <p>I've been trying to apply combinations of NSFontAttributes to NSMutableAttributedString's lately and I simply can't find a thorough explanation on how to do it without removing other attributes. </p>
  
  <p>I've searched a bunch, and found this <a href="https://stackoverflow.com/questions/26023027/how-to-apply-both-bold-and-italic-font-to-an-nsattributedstring">question</a> pertaining to how to do it with HTML, and then this <a href="https://stackoverflow.com/questions/15294179/select-bold-and-italicized-text-from-textfield">question</a> about how to <em>find</em> where text has been bolded or italicized, but nothing on how to actually do it.</p>
  
  <p>Currently, I try to format stings as follows:</p>
  
  <p><strong>Italics:</strong> 
  <code>[mutableAttributedString addAttribute: NSFontAttributeName value:[fontAttributes valueForKey:CXItalicsFontAttributeName] range:r];</code></p>
  
  <p><strong>Bold:</strong> <code>[mutableAttributedString addAttribute:NSFontAttributeName value:[fontAttributes valueForKey:CXBoldFontAttributeName] range:r];</code></p>
  
  <p>Where the constants <code>CXItalicsFontAttributeName</code> and <code>CXBoldAttributeName</code> extract the following two values from a dictionary respectfully:</p>
  
  <pre><code>UIFont *italicsFont = [UIFont fontWithName:@"Avenir-BookOblique" size:14.0f];
  UIFont *boldFont = [UIFont fontWithName:@"Avenir-Heavy" size:14.0f];
  </code></pre>
  
  <p>I know this mustn't be the right way to go about formatting, as the NSAttributedString <a href="https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/AttributedStrings/Articles/standardAttributes.html" rel="noreferrer">standard attributes</a> don't include a ItalicsFontAttribute or BoldFontAttribute, but I can't find the properly way to do this. Can anyone assist me? </p>