Check if NSFont contains char
-
01-07-2021 - |
Question
how could I check programmatically whether a NSFont contains a unicode character like '°'?
Solution
Ok, try this:
NSFont *font = [NSFont fontWithName:@"Arial" size:14.0];
NSCharacterSet *set = [font coveredCharacterSet];
if (![set characterIsMember:[@"°" characterAtIndex:0]]) {
NSLog(@"Failed");
} else {
NSLog(@"Success");
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow