Commit a5dc917c authored by darin's avatar darin
Browse files

Reviewed by Kevin Decker.

        - fix <rdar://problem/5264923> Safari frequently "stalls" beneath
          +[NSFont fontWithName:size:] while loading a web page (searching on disk for the font)

        * platform/mac/WebFontCache.mm:
        (+[WebFontCache internalFontWithFamily:traits:size:]): Renamed from fontWithFamily.
        Took out the auto-activation code.
        (+[WebFontCache fontWithFamily:traits:size:]): Added. Calls internalFontWithFamily,
        then calls NSFont to trigger activation if that returned nil, then calls
        internalFontWithFamily again.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@23514 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 89c5d677
2007-06-13 Darin Adler <darin@apple.com>
Reviewed by Kevin Decker.
- fix <rdar://problem/5264923> Safari frequently "stalls" beneath
+[NSFont fontWithName:size:] while loading a web page (searching on disk for the font)
* platform/mac/WebFontCache.mm:
(+[WebFontCache internalFontWithFamily:traits:size:]): Renamed from fontWithFamily.
Took out the auto-activation code.
(+[WebFontCache fontWithFamily:traits:size:]): Added. Calls internalFontWithFamily,
then calls NSFont to trigger activation if that returned nil, then calls
internalFontWithFamily again.
2007-06-13 Anders Carlsson <andersca@apple.com>
 
Reviewed by Geoff.
/*
* Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
* Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -110,16 +110,10 @@ static BOOL betterChoice(NSFontTraitMask desiredTraits, int desiredWeight,
// Family name is somewhat of a misnomer here. We first attempt to find an exact match
// comparing the desiredFamily to the PostScript name of the installed fonts. If that fails
// we then do a search based on the family names of the installed fonts.
+ (NSFont *)fontWithFamily:(NSString *)desiredFamily traits:(NSFontTraitMask)desiredTraits size:(float)size
+ (NSFont *)internalFontWithFamily:(NSString *)desiredFamily traits:(NSFontTraitMask)desiredTraits size:(float)size
{
NSFontManager *fontManager = [NSFontManager sharedFontManager];
#ifndef BUILDING_ON_TIGER
// Auto activate the font before looking for it. <rdar://problem/4564955>
// Ignore the result because we want to use our own algorithm to actually find the font.
[NSFont fontWithName:desiredFamily size:size];
#endif
// Look for an exact match first.
NSEnumerator *availableFonts = [[fontManager availableFonts] objectEnumerator];
NSString *availableFont;
......@@ -217,4 +211,19 @@ static BOOL betterChoice(NSFontTraitMask desiredTraits, int desiredWeight,
return font;
}
+ (NSFont *)fontWithFamily:(NSString *)desiredFamily traits:(NSFontTraitMask)desiredTraits size:(float)size
{
#ifndef BUILDING_ON_TIGER
NSFont *font = [self internalFontWithFamily:desiredFamily traits:desiredTraits size:size];
if (font)
return font;
// Auto activate the font before looking for it a second time.
// Ignore the result because we want to use our own algorithm to actually find the font.
[NSFont fontWithName:desiredFamily size:size];
#endif
return [self internalFontWithFamily:desiredFamily traits:desiredTraits size:size];
}
@end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment