OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2009 The Android Open Source Project | 3 * Copyright 2009 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 "SkHarfBuzzFont.h" | 10 #include "SkHarfBuzzFont.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 getFontMetric, | 159 getFontMetric, |
160 }; | 160 }; |
161 | 161 |
162 const HB_FontClass& SkHarfBuzzFont::GetFontClass() { | 162 const HB_FontClass& SkHarfBuzzFont::GetFontClass() { |
163 return gSkHarfBuzzFontClass; | 163 return gSkHarfBuzzFontClass; |
164 } | 164 } |
165 | 165 |
166 HB_Error SkHarfBuzzFont::GetFontTableFunc(void* voidface, const HB_Tag tag, | 166 HB_Error SkHarfBuzzFont::GetFontTableFunc(void* voidface, const HB_Tag tag, |
167 HB_Byte* buffer, HB_UInt* len) { | 167 HB_Byte* buffer, HB_UInt* len) { |
168 SkHarfBuzzFont* font = reinterpret_cast<SkHarfBuzzFont*>(voidface); | 168 SkHarfBuzzFont* font = reinterpret_cast<SkHarfBuzzFont*>(voidface); |
169 uint32_t uniqueID = SkTypeface::UniqueID(font->getTypeface()); | 169 SkTypeface* typeface = font->getTypeface(); |
170 | 170 |
171 const size_t tableSize = SkFontHost::GetTableSize(uniqueID, tag); | 171 const size_t tableSize = typeface->getTableSize(tag); |
172 if (!tableSize) { | 172 if (!tableSize) { |
173 return HB_Err_Invalid_Argument; | 173 return HB_Err_Invalid_Argument; |
174 } | 174 } |
175 // If Harfbuzz specified a NULL buffer then it's asking for the size. | 175 // If Harfbuzz specified a NULL buffer then it's asking for the size. |
176 if (!buffer) { | 176 if (!buffer) { |
177 *len = tableSize; | 177 *len = tableSize; |
178 return HB_Err_Ok; | 178 return HB_Err_Ok; |
179 } | 179 } |
180 | 180 |
181 if (*len < tableSize) { | 181 if (*len < tableSize) { |
182 // is this right, or should we just copy less than the full table? | 182 // is this right, or should we just copy less than the full table? |
183 return HB_Err_Invalid_Argument; | 183 return HB_Err_Invalid_Argument; |
184 } | 184 } |
185 SkFontHost::GetTableData(uniqueID, tag, 0, tableSize, buffer); | 185 typeface->getTableData(tag, 0, tableSize, buffer); |
186 return HB_Err_Ok; | 186 return HB_Err_Ok; |
187 } | 187 } |
| 188 |
OLD | NEW |