如果粗体字体文件不可用,是否可以增加字体的粗体度? [英] Is it possible to increase the boldness of the font if the bold font file is not available?

查看:52
本文介绍了如果粗体字体文件不可用,是否可以增加字体的粗体度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iOS应用中使用自定义字体.我已经为常规变体添加了字体文件.但是,我没有粗体字体文件.

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?

推荐答案

您可以将 NSAttributedString 与否的 strokeWidth 属性一起使用:

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))

这篇关于如果粗体字体文件不可用,是否可以增加字体的粗体度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆