Merge "Fix TextLayoutCache issue when loading Font tables (DO NOT MERGE)" into ics-mr1
This commit is contained in:
committed by
Android (Google) Code Review
commit
1e99421196
@@ -211,22 +211,7 @@ const HB_FontClass harfbuzzSkiaClass = {
|
||||
|
||||
HB_Error harfbuzzSkiaGetTable(void* voidface, const HB_Tag tag, HB_Byte* buffer, HB_UInt* len)
|
||||
{
|
||||
FontData* data = reinterpret_cast<FontData*>(voidface);
|
||||
SkTypeface* typeface = data->typeFace;
|
||||
|
||||
const size_t tableSize = SkFontHost::GetTableSize(typeface->uniqueID(), tag);
|
||||
if (!tableSize)
|
||||
return HB_Err_Invalid_Argument;
|
||||
// If Harfbuzz specified a NULL buffer then it's asking for the size of the table.
|
||||
if (!buffer) {
|
||||
*len = tableSize;
|
||||
return HB_Err_Ok;
|
||||
}
|
||||
|
||||
if (*len < tableSize)
|
||||
return HB_Err_Invalid_Argument;
|
||||
SkFontHost::GetTableData(typeface->uniqueID(), tag, 0, tableSize, buffer);
|
||||
return HB_Err_Ok;
|
||||
return HB_Err_Invalid_Argument;
|
||||
}
|
||||
|
||||
} // namespace android
|
||||
|
||||
@@ -346,9 +346,6 @@ void TextLayoutCacheValue::initShaperItem(HB_ShaperItem& shaperItem, HB_FontRec*
|
||||
font->x_scale = 1;
|
||||
font->y_scale = 1;
|
||||
|
||||
shaperItem.font = font;
|
||||
shaperItem.face = HB_NewFace(shaperItem.font, harfbuzzSkiaGetTable);
|
||||
|
||||
// Reset kerning
|
||||
shaperItem.kerning_applied = false;
|
||||
|
||||
@@ -360,8 +357,11 @@ void TextLayoutCacheValue::initShaperItem(HB_ShaperItem& shaperItem, HB_FontRec*
|
||||
fontData->flags = paint->getFlags();
|
||||
fontData->hinting = paint->getHinting();
|
||||
|
||||
shaperItem.font = font;
|
||||
shaperItem.font->userData = fontData;
|
||||
|
||||
shaperItem.face = HB_NewFace(NULL, harfbuzzSkiaGetTable);
|
||||
|
||||
// We cannot know, ahead of time, how many glyphs a given script run
|
||||
// will produce. We take a guess that script runs will not produce more
|
||||
// than twice as many glyphs as there are code points plus a bit of
|
||||
|
||||
Reference in New Issue
Block a user