I'm applying small caps to lower case letters, but it appears that it also includes all digits. This is also true when I apply it only to uppercase letters.
Is there any way to exclude digits from the effect of small caps (like the label for wind speed/direction in the stock Weather app), or do I need to resort to an attributed string for that effect?
Currently I'm just applying a font to all label content:
extension UIFont {
func smallCaps() -> UIFont {
let settings: [[UIFontDescriptor.FeatureKey : Int]] = [
[
.featureIdentifier : kLowerCaseType,
.typeIdentifier : kLowerCaseSmallCapsSelector
]
]
let attributes: [UIFontDescriptor.AttributeName : Any] = [.featureSettings: settings]
return UIFont(descriptor: self.fontDescriptor.addingAttributes(attributes), size: self.pointSize)
}
}
I tried using kNumberCaseType
and kUpperCaseNumbersSelector
in the same vein as the above code, but I guessed wrong. According to the documentation it turned out not to be what I was looking for.