+2005-03-07 Richard Williamson <rjw@apple.com>
+
+ More bullet proofing for <rdar://problem/4038304> CrashTracer: ....9 crashes at com.apple.WebKit: -[WebTextRenderer initWithFont:usingPrinterFont:] + 840
+
+ Protect against removal of Times and Times New Roman from
+ system. If these fonts are removed attempt to get system font
+ instead of FATAL_ALWAYS.
+
+ Reviewed by John.
+
+ * WebCoreSupport.subproj/WebTextRenderer.m:
+ (-[WebTextRenderer initWithFont:usingPrinterFont:]):
+
=== Safari-403 ===
2005-03-06 Darin Adler <darin@apple.com>
font = [(p ? [f printerFont] : [f screenFont]) retain];
usingPrinterFont = p;
+ bool failedSetup = false;
if (![self _setupFont]){
// Ack! Something very bad happened, like a corrupt font. Try
// looking for an alternate 'base' font for this renderer.
font = [(p ? [af printerFont] : [af screenFont]) retain];
if (![self _setupFont]){
// We tried, Times, Times New Roman, and the system font. No joy. We have to give up.
- FATAL_ALWAYS ("%@ unable to initialize with font %@ at %@", self, initialFont, filePath);
+ ERROR ("%@ unable to initialize with font %@ at %@", self, initialFont, filePath);
+ failedSetup = true;
}
}
else {
// We tried the requested font and the syste, font. No joy. We have to give up.
- FATAL_ALWAYS ("%@ unable to initialize with font %@ at %@", self, initialFont, filePath);
+ ERROR ("%@ unable to initialize with font %@ at %@", self, initialFont, filePath);
+ failedSetup = true;
}
}
filePath);
}
+ // If all else fails try to setup using the system font. This is probably because
+ // Times and Times New Roman are both unavailable.
+ if (failedSetup) {
+ f = [NSFont systemFontOfSize:[f pointSize]];
+ ERROR ("%@ failed to setup font, using system font %s", self, f);
+ font = [(p ? [f printerFont] : [f screenFont]) retain];
+ [self _setupFont];
+ }
+
// We emulate the appkit metrics by applying rounding as is done
// in the appkit.
CGFontRef cgFont = [font _backingCGSFont];