[ad_1]
CATextLayer and UILabel use totally different fonts by default. You may see this by printing their font properties:
print(txtLayer.font!)
print(b.font!)
This prints these for me:
<UICTFont: 0x7fe3718061d0> font-family: "Helvetica"; font-weight: regular; font-style: regular; font-size: 36.00pt
<UICTFont: 0x7fe371909400> font-family: ".SFUI-Common"; font-weight: regular; font-style: regular; font-size: 17.00pt
For those who set them each to the identical font, and to the identical dimension in order that it is much more apparent, you will see that the textual content they show look precisely the identical.
let view = UIView(body: CGRect(x: 0, y: 0, width: 500, peak: 500))
let txtLayer = CATextLayer()
txtLayer.body = CGRect(x: 10, y: 10, width: 150, peak: 100)
txtLayer.foregroundColor = UIColor.crimson.cgColor
txtLayer.string = ",,"
txtLayer.contentsScale = UIScreen.foremost.scale
txtLayer.font = UIFont.systemFont(ofSize: 50) as CTFont
txtLayer.fontSize = 50
view.layer.addSublayer(txtLayer)
let b = UILabel(body: CGRect(x: 10, y: 140, width: 150, peak: 100))
b.textual content = ",,"
b.textColor = UIColor.crimson
b.font = .systemFont(ofSize: 50)
view.addSubview(b)
[ad_2]

