Domanda

how could I check programmatically whether a NSFont contains a unicode character like '°'?

È stato utile?

Soluzione

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");
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top