mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Ignore bad characters that may not be parsable i.e. emoticons, etc
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@40226 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
1ada7d514d
commit
b6991cdc0c
1 changed files with 11 additions and 5 deletions
|
@ -1524,11 +1524,17 @@ static NSMutableDictionary *cachedCSets = nil;
|
|||
- (NSFontDescriptor*)_substituteFontDescriptorFor: (unichar)uchar
|
||||
{
|
||||
NSString *chars = [NSString stringWithCharacters: &uchar length: 1];
|
||||
NSCharacterSet *requiredCharacterSet = [NSCharacterSet characterSetWithCharactersInString: chars];
|
||||
NSDictionary *fontAttributes = [NSDictionary dictionaryWithObjectsAndKeys: requiredCharacterSet, NSFontCharacterSetAttribute, nil];
|
||||
NSSet *mandatoryKeys = [NSSet setWithObjects: NSFontCharacterSetAttribute, nil];
|
||||
NSFontDescriptor *fd = [NSFontDescriptor fontDescriptorWithFontAttributes: fontAttributes];
|
||||
return [fd matchingFontDescriptorWithMandatoryKeys: mandatoryKeys];
|
||||
|
||||
// Emoticons can be pasted that won't be parsed properly...
|
||||
if (chars != nil)
|
||||
{
|
||||
NSCharacterSet *requiredCharacterSet = [NSCharacterSet characterSetWithCharactersInString: chars];
|
||||
NSDictionary *fontAttributes = [NSDictionary dictionaryWithObjectsAndKeys: requiredCharacterSet, NSFontCharacterSetAttribute, nil];
|
||||
NSSet *mandatoryKeys = [NSSet setWithObjects: NSFontCharacterSetAttribute, nil];
|
||||
NSFontDescriptor *fd = [NSFontDescriptor fontDescriptorWithFontAttributes: fontAttributes];
|
||||
return [fd matchingFontDescriptorWithMandatoryKeys: mandatoryKeys];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSFont*)_substituteFontFor: (unichar)uchar font: (NSFont*)baseFont
|
||||
|
|
Loading…
Reference in a new issue