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/child/browser_font_resource_trusted.h" | 5 #include "content/child/browser_font_resource_trusted.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 } | 270 } |
271 | 271 |
272 PP_Bool BrowserFontResource_Trusted::Describe( | 272 PP_Bool BrowserFontResource_Trusted::Describe( |
273 PP_BrowserFont_Trusted_Description* description, | 273 PP_BrowserFont_Trusted_Description* description, |
274 PP_BrowserFont_Trusted_Metrics* metrics) { | 274 PP_BrowserFont_Trusted_Metrics* metrics) { |
275 if (description->face.type != PP_VARTYPE_UNDEFINED) | 275 if (description->face.type != PP_VARTYPE_UNDEFINED) |
276 return PP_FALSE; | 276 return PP_FALSE; |
277 | 277 |
278 // While converting the other way in PPFontDescToWebFontDesc we validated | 278 // While converting the other way in PPFontDescToWebFontDesc we validated |
279 // that the enums can be casted. | 279 // that the enums can be casted. |
280 WebFontDescription web_desc = font_->fontDescription(); | 280 WebFontDescription web_desc = font_->getFontDescription(); |
281 description->face = StringVar::StringToPPVar(base::UTF16ToUTF8( | 281 description->face = StringVar::StringToPPVar(base::UTF16ToUTF8( |
282 base::StringPiece16(web_desc.family))); | 282 base::StringPiece16(web_desc.family))); |
283 description->family = | 283 description->family = |
284 static_cast<PP_BrowserFont_Trusted_Family>(web_desc.genericFamily); | 284 static_cast<PP_BrowserFont_Trusted_Family>(web_desc.genericFamily); |
285 description->size = static_cast<uint32_t>(web_desc.size); | 285 description->size = static_cast<uint32_t>(web_desc.size); |
286 description->weight = static_cast<PP_BrowserFont_Trusted_Weight>( | 286 description->weight = static_cast<PP_BrowserFont_Trusted_Weight>( |
287 web_desc.weight); | 287 web_desc.weight); |
288 description->italic = web_desc.italic ? PP_TRUE : PP_FALSE; | 288 description->italic = web_desc.italic ? PP_TRUE : PP_FALSE; |
289 description->small_caps = web_desc.smallCaps ? PP_TRUE : PP_FALSE; | 289 description->small_caps = web_desc.smallCaps ? PP_TRUE : PP_FALSE; |
290 description->letter_spacing = static_cast<int32_t>(web_desc.letterSpacing); | 290 description->letter_spacing = static_cast<int32_t>(web_desc.letterSpacing); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 | 444 |
445 // Advance to the next run. Note that we avoid doing this for the last run | 445 // Advance to the next run. Note that we avoid doing this for the last run |
446 // since it's unnecessary, measuring text is slow, and most of the time | 446 // since it's unnecessary, measuring text is slow, and most of the time |
447 // there will be only one run anyway. | 447 // there will be only one run anyway. |
448 if (i != runs.num_runs() - 1) | 448 if (i != runs.num_runs() - 1) |
449 web_position.x += font_->calculateWidth(run); | 449 web_position.x += font_->calculateWidth(run); |
450 } | 450 } |
451 } | 451 } |
452 | 452 |
453 } // namespace content | 453 } // namespace content |
OLD | NEW |