OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/mac/scoped_cftyperef.h" | 9 #include "base/mac/scoped_cftyperef.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 if (!FontLoader::CGFontRefFromBuffer(shmem_handle, font_data_length_, | 73 if (!FontLoader::CGFontRefFromBuffer(shmem_handle, font_data_length_, |
74 &cg_font_ref)) { | 74 &cg_font_ref)) { |
75 LOG(ERROR) << "Call to CreateCGFontFromBuffer() failed"; | 75 LOG(ERROR) << "Call to CreateCGFontFromBuffer() failed"; |
76 return false; | 76 return false; |
77 } | 77 } |
78 | 78 |
79 if (!cg_font_ref) { | 79 if (!cg_font_ref) { |
80 LOG(ERROR) << "Got NULL CGFontRef"; | 80 LOG(ERROR) << "Got NULL CGFontRef"; |
81 return false; | 81 return false; |
82 } | 82 } |
83 base::mac::ScopedCFTypeRef<CGFontRef> cgfont(cg_font_ref); | 83 base::ScopedCFTypeRef<CGFontRef> cgfont(cg_font_ref); |
84 | 84 |
85 CTFontRef ct_font_ref = | 85 CTFontRef ct_font_ref = |
86 CTFontCreateWithGraphicsFont(cgfont.get(), 16.0, NULL, NULL); | 86 CTFontCreateWithGraphicsFont(cgfont.get(), 16.0, NULL, NULL); |
87 base::mac::ScopedCFTypeRef<CTFontRef> ctfont(ct_font_ref); | 87 base::ScopedCFTypeRef<CTFontRef> ctfont(ct_font_ref); |
88 | 88 |
89 if (!ct_font_ref) { | 89 if (!ct_font_ref) { |
90 LOG(ERROR) << "CTFontCreateWithGraphicsFont() failed"; | 90 LOG(ERROR) << "CTFontCreateWithGraphicsFont() failed"; |
91 return false; | 91 return false; |
92 } | 92 } |
93 | 93 |
94 // Do something with the font to make sure it's loaded. | 94 // Do something with the font to make sure it's loaded. |
95 CGFloat cap_height = CTFontGetCapHeight(ct_font_ref); | 95 CGFloat cap_height = CTFontGetCapHeight(ct_font_ref); |
96 | 96 |
97 if (cap_height <= 0.0) { | 97 if (cap_height <= 0.0) { |
(...skipping 21 matching lines...) Expand all Loading... |
119 static_cast<const char *>(result.font_data.memory()), | 119 static_cast<const char *>(result.font_data.memory()), |
120 result.font_data_size); | 120 result.font_data_size); |
121 | 121 |
122 ASSERT_TRUE(RunTestInSandbox(SANDBOX_TYPE_RENDERER, | 122 ASSERT_TRUE(RunTestInSandbox(SANDBOX_TYPE_RENDERER, |
123 "FontLoadingTestCase", temp_file_path.value().c_str())); | 123 "FontLoadingTestCase", temp_file_path.value().c_str())); |
124 temp_file_closer.reset(); | 124 temp_file_closer.reset(); |
125 ASSERT_TRUE(file_util::Delete(temp_file_path, false)); | 125 ASSERT_TRUE(file_util::Delete(temp_file_path, false)); |
126 } | 126 } |
127 | 127 |
128 } // namespace content | 128 } // namespace content |
OLD | NEW |