| 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 #include "content/common/mac/font_loader.h" | 5 #include "content/common/mac/font_loader.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_util.h" | 10 #include "base/file_util.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 CTFontCopyAttribute(ct_font_to_encode, kCTFontURLAttribute)))); | 117 CTFontCopyAttribute(ct_font_to_encode, kCTFontURLAttribute)))); |
| 118 if (![font_url isFileURL]) { | 118 if (![font_url isFileURL]) { |
| 119 DLOG(ERROR) << "Failed to find font file for " << font_name; | 119 DLOG(ERROR) << "Failed to find font file for " << font_name; |
| 120 return; | 120 return; |
| 121 } | 121 } |
| 122 | 122 |
| 123 base::FilePath font_path = base::mac::NSStringToFilePath([font_url path]); | 123 base::FilePath font_path = base::mac::NSStringToFilePath([font_url path]); |
| 124 | 124 |
| 125 // Load file into shared memory buffer. | 125 // Load file into shared memory buffer. |
| 126 int64 font_file_size_64 = -1; | 126 int64 font_file_size_64 = -1; |
| 127 if (!file_util::GetFileSize(font_path, &font_file_size_64)) { | 127 if (!base::GetFileSize(font_path, &font_file_size_64)) { |
| 128 DLOG(ERROR) << "Couldn't get font file size for " << font_path.value(); | 128 DLOG(ERROR) << "Couldn't get font file size for " << font_path.value(); |
| 129 return; | 129 return; |
| 130 } | 130 } |
| 131 | 131 |
| 132 if (font_file_size_64 <= 0 || font_file_size_64 >= kint32max) { | 132 if (font_file_size_64 <= 0 || font_file_size_64 >= kint32max) { |
| 133 DLOG(ERROR) << "Bad size for font file " << font_path.value(); | 133 DLOG(ERROR) << "Bad size for font file " << font_path.value(); |
| 134 return; | 134 return; |
| 135 } | 135 } |
| 136 | 136 |
| 137 int32 font_file_size_32 = static_cast<int32>(font_file_size_64); | 137 int32 font_file_size_32 = static_cast<int32>(font_file_size_64); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 if (!provider) | 173 if (!provider) |
| 174 return false; | 174 return false; |
| 175 | 175 |
| 176 *out = CGFontCreateWithDataProvider(provider.get()); | 176 *out = CGFontCreateWithDataProvider(provider.get()); |
| 177 | 177 |
| 178 if (*out == NULL) | 178 if (*out == NULL) |
| 179 return false; | 179 return false; |
| 180 | 180 |
| 181 return true; | 181 return true; |
| 182 } | 182 } |
| OLD | NEW |