Skip to content

Commit 1e99421

Browse files
Fabrice Di MeglioAndroid (Google) Code Review
authored andcommitted
Merge "Fix TextLayoutCache issue when loading Font tables (DO NOT MERGE)" into ics-mr1
2 parents 6db79c3 + 99cdc6a commit 1e99421

File tree

2 files changed

+4
-19
lines changed

2 files changed

+4
-19
lines changed

core/jni/android/graphics/HarfbuzzSkia.cpp

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -211,22 +211,7 @@ const HB_FontClass harfbuzzSkiaClass = {
211211

212212
HB_Error harfbuzzSkiaGetTable(void* voidface, const HB_Tag tag, HB_Byte* buffer, HB_UInt* len)
213213
{
214-
FontData* data = reinterpret_cast<FontData*>(voidface);
215-
SkTypeface* typeface = data->typeFace;
216-
217-
const size_t tableSize = SkFontHost::GetTableSize(typeface->uniqueID(), tag);
218-
if (!tableSize)
219-
return HB_Err_Invalid_Argument;
220-
// If Harfbuzz specified a NULL buffer then it's asking for the size of the table.
221-
if (!buffer) {
222-
*len = tableSize;
223-
return HB_Err_Ok;
224-
}
225-
226-
if (*len < tableSize)
227-
return HB_Err_Invalid_Argument;
228-
SkFontHost::GetTableData(typeface->uniqueID(), tag, 0, tableSize, buffer);
229-
return HB_Err_Ok;
214+
return HB_Err_Invalid_Argument;
230215
}
231216

232217
} // namespace android

core/jni/android/graphics/TextLayoutCache.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,6 @@ void TextLayoutCacheValue::initShaperItem(HB_ShaperItem& shaperItem, HB_FontRec*
346346
font->x_scale = 1;
347347
font->y_scale = 1;
348348

349-
shaperItem.font = font;
350-
shaperItem.face = HB_NewFace(shaperItem.font, harfbuzzSkiaGetTable);
351-
352349
// Reset kerning
353350
shaperItem.kerning_applied = false;
354351

@@ -360,8 +357,11 @@ void TextLayoutCacheValue::initShaperItem(HB_ShaperItem& shaperItem, HB_FontRec*
360357
fontData->flags = paint->getFlags();
361358
fontData->hinting = paint->getHinting();
362359

360+
shaperItem.font = font;
363361
shaperItem.font->userData = fontData;
364362

363+
shaperItem.face = HB_NewFace(NULL, harfbuzzSkiaGetTable);
364+
365365
// We cannot know, ahead of time, how many glyphs a given script run
366366
// will produce. We take a guess that script runs will not produce more
367367
// than twice as many glyphs as there are code points plus a bit of

0 commit comments

Comments
 (0)