| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Computer, Inc. | 2 * Copyright (C) 2007 Apple Computer, Inc. |
| 3 * Copyright (c) 2007, 2008, 2009, Google Inc. All rights reserved. | 3 * Copyright (c) 2007, 2008, 2009, Google Inc. All rights reserved. |
| 4 * Copyright (C) 2010 Company 100, Inc. | 4 * Copyright (C) 2010 Company 100, Inc. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions are | 7 * modification, are permitted provided that the following conditions are |
| 8 * met: | 8 * met: |
| 9 * | 9 * |
| 10 * * Redistributions of source code must retain the above copyright | 10 * * Redistributions of source code must retain the above copyright |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #include "platform/fonts/FontCache.h" | 37 #include "platform/fonts/FontCache.h" |
| 38 #include "platform/fonts/FontPlatformData.h" | 38 #include "platform/fonts/FontPlatformData.h" |
| 39 #include "platform/fonts/WebFontDecoder.h" | 39 #include "platform/fonts/WebFontDecoder.h" |
| 40 #include "third_party/skia/include/core/SkStream.h" | 40 #include "third_party/skia/include/core/SkStream.h" |
| 41 #include "third_party/skia/include/core/SkTypeface.h" | 41 #include "third_party/skia/include/core/SkTypeface.h" |
| 42 #include "wtf/PtrUtil.h" | 42 #include "wtf/PtrUtil.h" |
| 43 #include <memory> | 43 #include <memory> |
| 44 | 44 |
| 45 namespace blink { | 45 namespace blink { |
| 46 | 46 |
| 47 FontCustomPlatformData::FontCustomPlatformData(PassRefPtr<SkTypeface> typeface) | 47 FontCustomPlatformData::FontCustomPlatformData(sk_sp<SkTypeface> typeface) |
| 48 : m_typeface(typeface) { } | 48 : m_typeface(typeface) { } |
| 49 | 49 |
| 50 FontCustomPlatformData::~FontCustomPlatformData() | 50 FontCustomPlatformData::~FontCustomPlatformData() |
| 51 { | 51 { |
| 52 } | 52 } |
| 53 | 53 |
| 54 FontPlatformData FontCustomPlatformData::fontPlatformData(float size, bool bold,
bool italic, FontOrientation orientation) | 54 FontPlatformData FontCustomPlatformData::fontPlatformData(float size, bool bold,
bool italic, FontOrientation orientation) |
| 55 { | 55 { |
| 56 ASSERT(m_typeface); | 56 ASSERT(m_typeface); |
| 57 return FontPlatformData(m_typeface.get(), "", size, bold && !m_typeface->isB
old(), italic && !m_typeface->isItalic(), orientation); | 57 return FontPlatformData(m_typeface, "", size, bold && !m_typeface->isBold(),
italic && !m_typeface->isItalic(), orientation); |
| 58 } | 58 } |
| 59 | 59 |
| 60 std::unique_ptr<FontCustomPlatformData> FontCustomPlatformData::create(SharedBuf
fer* buffer, String& otsParseMessage) | 60 std::unique_ptr<FontCustomPlatformData> FontCustomPlatformData::create(SharedBuf
fer* buffer, String& otsParseMessage) |
| 61 { | 61 { |
| 62 DCHECK(buffer); | 62 DCHECK(buffer); |
| 63 WebFontDecoder decoder; | 63 WebFontDecoder decoder; |
| 64 RefPtr<SkTypeface> typeface = decoder.decode(buffer); | 64 sk_sp<SkTypeface> typeface = decoder.decode(buffer); |
| 65 if (!typeface) { | 65 if (!typeface) { |
| 66 otsParseMessage = decoder.getErrorString(); | 66 otsParseMessage = decoder.getErrorString(); |
| 67 return nullptr; | 67 return nullptr; |
| 68 } | 68 } |
| 69 return wrapUnique(new FontCustomPlatformData(typeface.release())); | 69 return wrapUnique(new FontCustomPlatformData(std::move(typeface))); |
| 70 } | 70 } |
| 71 | 71 |
| 72 bool FontCustomPlatformData::supportsFormat(const String& format) | 72 bool FontCustomPlatformData::supportsFormat(const String& format) |
| 73 { | 73 { |
| 74 return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "o
pentype") || WebFontDecoder::supportsFormat(format); | 74 return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "o
pentype") || WebFontDecoder::supportsFormat(format); |
| 75 } | 75 } |
| 76 | 76 |
| 77 } // namespace blink | 77 } // namespace blink |
| OLD | NEW |