| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2006, 2007, 2008, Google Inc. All rights reserved. | 2 * Copyright (c) 2006, 2007, 2008, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "core/platform/graphics/FontPlatformData.h" | 32 #include "core/platform/graphics/FontPlatformData.h" |
| 33 | 33 |
| 34 #include "SkEndian.h" | 34 #include "SkEndian.h" |
| 35 #include "SkTypeface.h" | 35 #include "SkTypeface.h" |
| 36 #include "core/platform/SharedBuffer.h" |
| 36 #include "core/platform/graphics/FontCache.h" | 37 #include "core/platform/graphics/FontCache.h" |
| 37 | 38 |
| 38 namespace WebCore { | 39 namespace WebCore { |
| 39 | 40 |
| 40 #if ENABLE(OPENTYPE_VERTICAL) | 41 #if ENABLE(OPENTYPE_VERTICAL) |
| 41 PassRefPtr<OpenTypeVerticalData> FontPlatformData::verticalData() const | 42 PassRefPtr<OpenTypeVerticalData> FontPlatformData::verticalData() const |
| 42 { | 43 { |
| 43 return fontCache()->getVerticalData(typeface()->uniqueID(), *this); | 44 return fontCache()->getVerticalData(typeface()->uniqueID(), *this); |
| 44 } | 45 } |
| 45 | 46 |
| 46 PassRefPtr<SharedBuffer> FontPlatformData::openTypeTable(uint32_t table) const | 47 PassRefPtr<SharedBuffer> FontPlatformData::openTypeTable(uint32_t table) const |
| 47 { | 48 { |
| 48 RefPtr<SharedBuffer> buffer; | 49 RefPtr<SharedBuffer> buffer; |
| 49 | 50 |
| 50 SkFontTableTag tag = SkEndianSwap32(table); | 51 SkFontTableTag tag = SkEndianSwap32(table); |
| 51 const size_t tableSize = m_typeface->getTableSize(tag); | 52 const size_t tableSize = m_typeface->getTableSize(tag); |
| 52 if (tableSize) { | 53 if (tableSize) { |
| 53 Vector<char> tableBuffer(tableSize); | 54 Vector<char> tableBuffer(tableSize); |
| 54 m_typeface->getTableData(tag, 0, tableSize, &tableBuffer[0]); | 55 m_typeface->getTableData(tag, 0, tableSize, &tableBuffer[0]); |
| 55 buffer = SharedBuffer::adoptVector(tableBuffer); | 56 buffer = SharedBuffer::adoptVector(tableBuffer); |
| 56 } | 57 } |
| 57 return buffer.release(); | 58 return buffer.release(); |
| 58 } | 59 } |
| 59 #endif | 60 #endif |
| 60 | 61 |
| 61 } // namespace WebCore | 62 } // namespace WebCore |
| OLD | NEW |