mirror of
https://github.com/darlinghq/darling-cocotron.git
synced 2024-11-23 12:09:51 +00:00
RichTextReader is trusting fontWithName:size: to create legitimate fonts which it's not
This commit is contained in:
parent
ae02f989e9
commit
4e1562593c
@ -376,7 +376,14 @@ static inline void flushPreviousString(NSRichTextReader *self) {
|
||||
|
||||
_currentCharset = [[info objectForKey:@"charset"] integerValue];
|
||||
|
||||
// Turns out fontWithName:size: is still returning fonts for font names it doesn't have
|
||||
// For example "Helvetica". This check ensures that we only ask for fonts we have...
|
||||
// Of course this is a general problem... so the full fix is elsewhere...
|
||||
NSArray *availableFonts = [[NSFontManager sharedFontManager] availableFonts];
|
||||
if ([availableFonts containsObject: fontname]) {
|
||||
font=[NSFont fontWithName: fontname size: 12];
|
||||
}
|
||||
|
||||
if (font == nil) {
|
||||
// Try to get some default font for the given family
|
||||
if([family isEqualToString:@"roman"])
|
||||
|
Loading…
Reference in New Issue
Block a user