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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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); |
138 if (!result->font_data.CreateAndMapAnonymous(font_file_size_32)) { | 138 if (!result->font_data.CreateAndMapAnonymous(font_file_size_32)) { |
139 DLOG(ERROR) << "Failed to create shmem area for " << font_name; | 139 DLOG(ERROR) << "Failed to create shmem area for " << font_name; |
140 return; | 140 return; |
141 } | 141 } |
142 | 142 |
143 int32 amt_read = file_util::ReadFile(font_path, | 143 int32 amt_read = base::ReadFile(font_path, |
144 reinterpret_cast<char*>(result->font_data.memory()), | 144 reinterpret_cast<char*>(result->font_data.memory()), |
145 font_file_size_32); | 145 font_file_size_32); |
146 if (amt_read != font_file_size_32) { | 146 if (amt_read != font_file_size_32) { |
147 DLOG(ERROR) << "Failed to read font data for " << font_path.value(); | 147 DLOG(ERROR) << "Failed to read font data for " << font_path.value(); |
148 return; | 148 return; |
149 } | 149 } |
150 | 150 |
151 result->font_data_size = font_file_size_32; | 151 result->font_data_size = font_file_size_32; |
152 result->font_id = GetFontIDForFont(font_path); | 152 result->font_id = GetFontIDForFont(font_path); |
153 } | 153 } |
154 | 154 |
155 // static | 155 // static |
(...skipping 17 matching lines...) Expand all 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 |