0

I am using a custom font in an iOS app. I have added the font file for the regular variant. However, I do not have the bold font file.

Is it possible to increase the boldness of a font without having the bold font file?

  • 1
    Try using an `NSAttributesString` with a negative `strokeWidth` attribute. – Yonat Apr 22 '20 at 16:09
  • @Yonat Your suggestion solved my problem. If you add a answer, I will accept it as the solution. –  Apr 26 '20 at 04:13

1 Answers1

0

You can use an NSAttributedString with a negative strokeWidth attribute:

let range = NSRange(location:  0, length: attributedString.length
attributedString.addAttribute(.strokeWidth, value: NSNumber(value: -3.0), range: range))
Yonat
  • 4,382
  • 2
  • 28
  • 37