From 8abafc22138e51a1402d4a8a8adc458f6bff9933 Mon Sep 17 00:00:00 2001 From: "thakis@chromium.org" Date: Mon, 27 Aug 2012 05:28:41 +0000 Subject: mac 10.8: Switch test_shell_mac from ATS to CoreText font registration BUG=139138 Review URL: https://chromiumcodereview.appspot.com/10867081 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153452 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/tools/test_shell/test_shell_mac.mm | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'webkit') diff --git a/webkit/tools/test_shell/test_shell_mac.mm b/webkit/tools/test_shell/test_shell_mac.mm index 258834b..ccfaa67 100644 --- a/webkit/tools/test_shell/test_shell_mac.mm +++ b/webkit/tools/test_shell/test_shell_mac.mm @@ -223,25 +223,15 @@ void TestShell::InitializeTestShell(bool layout_test_mode, ResetWebPreferences(); // Load the Ahem font, which is used by layout tests. - const char* ahem_path_c; NSString* ahem_path = [[base::mac::FrameworkBundle() resourcePath] stringByAppendingPathComponent:@"AHEM____.TTF"]; - ahem_path_c = [ahem_path fileSystemRepresentation]; - FSRef ahem_fsref; - if (!base::mac::FSRefFromPath(ahem_path_c, &ahem_fsref)) { - DLOG(FATAL) << "FSRefFromPath " << ahem_path_c; - } else { - // The last argument is an ATSFontContainerRef that can be passed to - // ATSFontDeactivate to unload the font. Since the font is only loaded - // for this process, and it's always wanted, don't keep track of it. - if (ATSFontActivateFromFileReference(&ahem_fsref, - kATSFontContextLocal, - kATSFontFormatUnspecified, - NULL, - kATSOptionFlagsDefault, - NULL) != noErr) { - DLOG(FATAL) << "ATSFontActivateFromFileReference " << ahem_path_c; - } + NSURL* ahem_path_url = [NSURL fileURLWithPath:ahem_path]; + CFErrorRef error; + if (!CTFontManagerRegisterFontsForURL((CFURLRef)ahem_path_url, + kCTFontManagerScopeProcess, &error)) { + DLOG(FATAL) << "CTFontManagerRegisterFontsForURL " + << [ahem_path fileSystemRepresentation] + << [[(NSError*)error description] UTF8String]; } // Add /plugins to the plugin path so we can load -- cgit v1.1