| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 The Android Open Source Project | 3 * Copyright 2011 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkAdvancedTypefaceMetrics.h" | 10 #include "SkAdvancedTypefaceMetrics.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 SkAdvancedTypefaceMetrics* SkTypeface::getAdvancedTypefaceMetrics( | 99 SkAdvancedTypefaceMetrics* SkTypeface::getAdvancedTypefaceMetrics( |
| 100 SkAdvancedTypefaceMetrics::PerGlyphInfo info, | 100 SkAdvancedTypefaceMetrics::PerGlyphInfo info, |
| 101 const uint32_t* glyphIDs, | 101 const uint32_t* glyphIDs, |
| 102 uint32_t glyphIDsCount) const { | 102 uint32_t glyphIDsCount) const { |
| 103 return this->onGetAdvancedTypefaceMetrics(info, glyphIDs, glyphIDsCount); | 103 return this->onGetAdvancedTypefaceMetrics(info, glyphIDs, glyphIDsCount); |
| 104 } | 104 } |
| 105 | 105 |
| 106 /////////////////////////////////////////////////////////////////////////////// | 106 /////////////////////////////////////////////////////////////////////////////// |
| 107 | 107 |
| 108 int SkTypeface::countTables() const { | 108 int SkTypeface::countTables() const { |
| 109 return SkFontHost::CountTables(fUniqueID); | 109 return this->onGetTableTags(NULL); |
| 110 } | 110 } |
| 111 | 111 |
| 112 int SkTypeface::getTableTags(SkFontTableTag tags[]) const { | 112 int SkTypeface::getTableTags(SkFontTableTag tags[]) const { |
| 113 return SkFontHost::GetTableTags(fUniqueID, tags); | 113 return this->onGetTableTags(tags); |
| 114 } | 114 } |
| 115 | 115 |
| 116 size_t SkTypeface::getTableSize(SkFontTableTag tag) const { | 116 size_t SkTypeface::getTableSize(SkFontTableTag tag) const { |
| 117 return SkFontHost::GetTableSize(fUniqueID, tag); | 117 return this->onGetTableData(tag, 0, ~0U, NULL); |
| 118 } | 118 } |
| 119 | 119 |
| 120 size_t SkTypeface::getTableData(SkFontTableTag tag, size_t offset, size_t length
, | 120 size_t SkTypeface::getTableData(SkFontTableTag tag, size_t offset, size_t length
, |
| 121 void* data) const { | 121 void* data) const { |
| 122 return SkFontHost::GetTableData(fUniqueID, tag, offset, length, data); | 122 return this->onGetTableData(tag, offset, length, data); |
| 123 } | 123 } |
| 124 | 124 |
| 125 SkStream* SkTypeface::openStream(int* ttcIndex) const { | 125 SkStream* SkTypeface::openStream(int* ttcIndex) const { |
| 126 int ttcIndexStorage; | 126 int ttcIndexStorage; |
| 127 if (NULL == ttcIndex) { | 127 if (NULL == ttcIndex) { |
| 128 // So our subclasses don't need to check for null param | 128 // So our subclasses don't need to check for null param |
| 129 ttcIndex = &ttcIndexStorage; | 129 ttcIndex = &ttcIndexStorage; |
| 130 } | 130 } |
| 131 return this->onOpenStream(ttcIndex); | 131 return this->onOpenStream(ttcIndex); |
| 132 } | 132 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 157 | 157 |
| 158 SkStream* SkTypeface::onOpenStream(int* ttcIndex) const { | 158 SkStream* SkTypeface::onOpenStream(int* ttcIndex) const { |
| 159 if (ttcIndex) { | 159 if (ttcIndex) { |
| 160 int32_t ndx = 0; | 160 int32_t ndx = 0; |
| 161 (void)SkFontHost::GetFileName(fUniqueID, NULL, 0, &ndx); | 161 (void)SkFontHost::GetFileName(fUniqueID, NULL, 0, &ndx); |
| 162 *ttcIndex = (int)ndx; | 162 *ttcIndex = (int)ndx; |
| 163 } | 163 } |
| 164 return SkFontHost::OpenStream(fUniqueID); | 164 return SkFontHost::OpenStream(fUniqueID); |
| 165 } | 165 } |
| 166 | 166 |
| 167 int SkTypeface::onGetTableTags(SkFontTableTag tags[]) const { return 0; } | |
| 168 size_t SkTypeface::onGetTableData(SkFontTableTag, size_t offset, | |
| 169 size_t length, void* data) const { return 0; } | |
| 170 void SkTypeface::onGetFontDescriptor(SkFontDescriptor* desc) const { | 167 void SkTypeface::onGetFontDescriptor(SkFontDescriptor* desc) const { |
| 171 desc->setStyle(this->style()); | 168 desc->setStyle(this->style()); |
| 172 } | 169 } |
| 173 | 170 |
| 171 #include "SkFontStream.h" |
| 172 #include "SkStream.h" |
| 173 |
| 174 int SkTypeface::onGetTableTags(SkFontTableTag tags[]) const { |
| 175 int ttcIndex; |
| 176 SkAutoTUnref<SkStream> stream(this->openStream(&ttcIndex)); |
| 177 return stream.get() ? SkFontStream::GetTableTags(stream, ttcIndex, tags) : 0
; |
| 178 } |
| 179 |
| 180 size_t SkTypeface::onGetTableData(SkFontTableTag tag, size_t offset, |
| 181 size_t length, void* data) const { |
| 182 int ttcIndex; |
| 183 SkAutoTUnref<SkStream> stream(this->openStream(&ttcIndex)); |
| 184 return stream.get() |
| 185 ? SkFontStream::GetTableData(stream, ttcIndex, tag, offset, length, data
) |
| 186 : 0; |
| 187 } |
| 188 |
| OLD | NEW |