11

I my App. at many places I have used System Bold Font, which has became standard in my App.

If I use Attributed String by default font which appears is "Helvetica Neue". In all Fonts, I searched for System Bold Font, but could not find it.

So, how can I set System bold font when using Attributed String?

enter image description here

NNikN
  • 3,720
  • 6
  • 44
  • 86
  • 1
    I could not find a way in interface builder, however programmatically I use kCTFontEmphasizedSystemFontType for creating a CTFontRef to put in attributes dictionary for NSAttributedString. How are you assigning attributed text property of label in code? – Bamsworld Jan 07 '14 at 03:46
  • @Bamsworld I did it from Interface Builder. You are right, now I will have to use NSFontAttribute as one of the NSAttributedString with value "[UIFont boldSystemFontOfSize:size]". – NNikN Jan 07 '14 at 04:18

1 Answers1

4

You can make it work by code. I had to face exactly same problem while assigning a attributed string to UILabel. i solved it by code. See the code bellow:

    NSString *s = @"Why so serious?";
    NSMutableAttributedString *str=[[NSMutableAttributedString alloc] initWithString:s];
    NSInteger _stringLength=[s length];
    UIColor *_red=[UIColor redColor];
    [str addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:25] range:NSMakeRange(0, _stringLength)];
    [str addAttribute:NSStrokeColorAttributeName value:_red range:NSMakeRange(0, _stringLength)];
    [str addAttribute:NSStrokeWidthAttributeName value:[NSNumber numberWithFloat:-3.0] range:NSMakeRange(0, _stringLength)];
    self.aLabel.attributedText = str;

Hope this helps. :)

Rashad
  • 11,057
  • 4
  • 45
  • 73