Reputation: 3939
I have a custom font and it doesn't include bold face. I have no problem using it in web and Android since they use faux bold but, I don't know how can I make it bold in iOS. I want to know if there is a way to make faux bold in iOS or any tool to create a bold font face from normal one using techniques that browsers use.
Upvotes: 0
Views: 413
Reputation: 283
You could use NSAttributedString
to stroke text and make them bold.
Try this code below:
NSString *string = @"Hello World";
NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:string];
NSDictionary *attributes = @{
NSStrokeWidthAttributeName: @-5.0, //value for making bold, higher negative number bolder text
NSStrokeColorAttributeName:[UIColor blackColor],
NSForegroundColorAttributeName:[UIColor blackColor],
NSFontAttributeName:[UIFont fontWithName:@"Your font name" size:20]
};
[attrString addAttributes:attributes range:NSMakeRange(0, string.length)];
Hope this help.
Upvotes: 3