OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/common/font_loader_mac.h" | 5 #include "chrome/common/font_loader_mac.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/mac_util.h" | 13 #include "base/mac_util.h" |
14 #include "base/scoped_cftyperef.h" | |
15 #include "base/sys_string_conversions.h" | 14 #include "base/sys_string_conversions.h" |
16 | 15 |
17 // static | 16 // static |
18 bool FontLoader::LoadFontIntoBuffer(NSFont* font_to_encode, | 17 bool FontLoader::LoadFontIntoBuffer(NSFont* font_to_encode, |
19 base::SharedMemory* font_data, | 18 base::SharedMemory* font_data, |
20 uint32* font_data_size) { | 19 uint32* font_data_size) { |
21 CHECK(font_data && font_data_size); | 20 CHECK(font_data && font_data_size); |
22 *font_data_size = 0; | 21 *font_data_size = 0; |
23 | 22 |
24 // Used only for logging. | 23 // Used only for logging. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // This is the value used by WebKit when activating remote fonts. | 106 // This is the value used by WebKit when activating remote fonts. |
108 const ATSFontContext kFontContextPrivate = 3; | 107 const ATSFontContext kFontContextPrivate = 3; |
109 OSStatus err = ATSFontActivateFromMemory(shm.memory(), font_data_size, | 108 OSStatus err = ATSFontActivateFromMemory(shm.memory(), font_data_size, |
110 kFontContextPrivate, kATSFontFormatUnspecified, NULL, | 109 kFontContextPrivate, kATSFontFormatUnspecified, NULL, |
111 kATSOptionFlagsDefault, font_container); | 110 kATSOptionFlagsDefault, font_container); |
112 if (err != noErr || !font_container) | 111 if (err != noErr || !font_container) |
113 return false; | 112 return false; |
114 | 113 |
115 return true; | 114 return true; |
116 } | 115 } |
OLD | NEW |