MV
Но спасибо и на том)
Size: a a a
MV
А
SM
SM
DK
SM
A
A
A
И
A
A
И
И
И
A
A
И
И
extension UIFont {
func monospaceNumberFeatures() -> UIFont {
let fontFeatures: [[UIFontDescriptor.FeatureKey: Int]] = [
[.featureIdentifier: kNumberSpacingType, .typeIdentifier: kMonospacedNumbersSelector],
[.featureIdentifier: kNumberCaseType, .typeIdentifier: kUpperCaseNumbersSelector]
]
fontDescriptor.addingAttributes([UIFontDescriptor.AttributeName.featureSettings: fontFeatures])
return UIFont(descriptor: fontDescriptor, size: pointSize)
}
}
extension UIFont {
var monospacedDigitFont: UIFont {
let newFontDescriptor = fontDescriptor.monospacedDigitFontDescriptor
return UIFont(descriptor: newFontDescriptor, size: 0)
}
}
private extension UIFontDescriptor {
var monospacedDigitFontDescriptor: UIFontDescriptor {
let fontDescriptorFeatureSettings = [[UIFontDescriptor.FeatureKey.featureIdentifier: kNumberSpacingType,
UIFontDescriptor.FeatureKey.typeIdentifier: kMonospacedNumbersSelector]]
let fontDescriptorAttributes = [UIFontDescriptor.AttributeName.featureSettings: fontDescriptorFeatureSettings]
let fontDescriptor = self.addingAttributes(fontDescriptorAttributes)
return fontDescriptor
}
}