Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 99cdc6a3 authored by Fabrice Di Meglio's avatar Fabrice Di Meglio
Browse files

Fix TextLayoutCache issue when loading Font tables (DO NOT MERGE)

- disable GSUB / GPOS table loading

Change-Id: I2ae058c9d926242586f90dc2a98302ff886f1fe1
parent 40cb30c2
Loading
Loading
Loading
Loading
+1 −16
Original line number Diff line number Diff line
@@ -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;
}

}  // namespace android
+3 −3
Original line number Diff line number Diff line
@@ -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