diff options
Diffstat (limited to 'chromium/content/renderer/pepper/pepper_truetype_font_linux.cc')
-rw-r--r-- | chromium/content/renderer/pepper/pepper_truetype_font_linux.cc | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/chromium/content/renderer/pepper/pepper_truetype_font_linux.cc b/chromium/content/renderer/pepper/pepper_truetype_font_linux.cc index 53abf132057..c54a5148a1a 100644 --- a/chromium/content/renderer/pepper/pepper_truetype_font_linux.cc +++ b/chromium/content/renderer/pepper/pepper_truetype_font_linux.cc @@ -4,12 +4,13 @@ #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" -#include "base/safe_numerics.h" +#include "base/numerics/safe_conversions.h" #include "base/sys_byteorder.h" #include "content/public/common/child_process_sandbox_support_linux.h" #include "content/renderer/pepper/pepper_truetype_font.h" #include "ppapi/c/dev/ppb_truetype_font_dev.h" #include "ppapi/c/pp_errors.h" +#include "ppapi/c/trusted/ppb_browser_font_trusted.h" namespace content { @@ -23,13 +24,14 @@ class PepperTrueTypeFontLinux : public PepperTrueTypeFont { // PepperTrueTypeFont overrides. virtual bool IsValid() OVERRIDE; - virtual int32_t Describe( - ppapi::proxy::SerializedTrueTypeFontDesc* desc) OVERRIDE; + virtual int32_t Describe(ppapi::proxy::SerializedTrueTypeFontDesc* desc) + OVERRIDE; virtual int32_t GetTableTags(std::vector<uint32_t>* tags) OVERRIDE; virtual int32_t GetTable(uint32_t table_tag, int32_t offset, int32_t max_data_length, std::string* data) OVERRIDE; + private: // Save creation parameters here and use these to implement Describe. // TODO(bbudge) Modify content API to return results of font matching and @@ -41,8 +43,8 @@ class PepperTrueTypeFontLinux : public PepperTrueTypeFont { }; PepperTrueTypeFontLinux::PepperTrueTypeFontLinux( - const ppapi::proxy::SerializedTrueTypeFontDesc& desc) : - desc_(desc) { + const ppapi::proxy::SerializedTrueTypeFontDesc& desc) + : desc_(desc) { // If no face is provided, convert family to the platform defaults. These // names should be mapped by FontConfig to an appropriate default font. if (desc_.family.empty()) { @@ -65,22 +67,19 @@ PepperTrueTypeFontLinux::PepperTrueTypeFontLinux( } } - fd_ = MatchFontWithFallback( - desc_.family.c_str(), - desc_.weight >= PP_TRUETYPEFONTWEIGHT_BOLD, - desc_.style & PP_TRUETYPEFONTSTYLE_ITALIC, - desc_.charset); + fd_ = MatchFontWithFallback(desc_.family.c_str(), + desc_.weight >= PP_TRUETYPEFONTWEIGHT_BOLD, + desc_.style & PP_TRUETYPEFONTSTYLE_ITALIC, + desc_.charset, + PP_BROWSERFONT_TRUSTED_FAMILY_DEFAULT); } -PepperTrueTypeFontLinux::~PepperTrueTypeFontLinux() { -} +PepperTrueTypeFontLinux::~PepperTrueTypeFontLinux() {} -bool PepperTrueTypeFontLinux::IsValid() { - return fd_ != -1; -} +bool PepperTrueTypeFontLinux::IsValid() { return fd_ != -1; } int32_t PepperTrueTypeFontLinux::Describe( - ppapi::proxy::SerializedTrueTypeFontDesc* desc) { + ppapi::proxy::SerializedTrueTypeFontDesc* desc) { *desc = desc_; return PP_OK; } @@ -118,7 +117,7 @@ int32_t PepperTrueTypeFontLinux::GetTableTags(std::vector<uint32_t>* tags) { uint8_t* entry = table_entries.get() + i * kTableEntrySize; uint32_t tag = static_cast<uint32_t>(entry[0]) << 24 | static_cast<uint32_t>(entry[1]) << 16 | - static_cast<uint32_t>(entry[2]) << 8 | + static_cast<uint32_t>(entry[2]) << 8 | static_cast<uint32_t>(entry[3]); (*tags)[i] = tag; } @@ -139,12 +138,14 @@ int32_t PepperTrueTypeFontLinux::GetTable(uint32_t table_tag, // Only retrieve as much as the caller requested. table_size = std::min(table_size, static_cast<size_t>(max_data_length)); data->resize(table_size); - if (!GetFontTable(fd_, table_tag, offset, + if (!GetFontTable(fd_, + table_tag, + offset, reinterpret_cast<uint8_t*>(&(*data)[0]), &table_size)) return PP_ERROR_FAILED; - return base::checked_numeric_cast<int32_t>(table_size); + return base::checked_cast<int32_t>(table_size); } } // namespace @@ -156,4 +157,3 @@ PepperTrueTypeFont* PepperTrueTypeFont::Create( } } // namespace content - |