diff --git a/Source/WebCore/platform/graphics/skia/SkiaHarfBuzzFont.cpp b/Source/WebCore/platform/graphics/skia/SkiaHarfBuzzFont.cpp index 8bc21b21976c..68654f602c92 100644 --- a/Source/WebCore/platform/graphics/skia/SkiaHarfBuzzFont.cpp +++ b/Source/WebCore/platform/graphics/skia/SkiaHarfBuzzFont.cpp @@ -101,9 +101,10 @@ static HbUniquePtr createHarfBuzzFace(SkTypeface& typeface) HbUniquePtr blob(hb_blob_create(reinterpret_cast(memory), size, HB_MEMORY_MODE_READONLY, stream.release(), [](void* data) { delete reinterpret_cast(data); })); - auto faceCount = hb_face_count(blob.get()); - if (faceCount && static_cast(index) < faceCount) - return HbUniquePtr(hb_face_create(blob.get(), index)); + HbUniquePtr result(hb_face_create(blob.get(), index)); + HbUniquePtr empty(hb_face_get_empty()); + if (result.get() != empty.get()) + return result; } } @@ -126,6 +127,7 @@ SkiaHarfBuzzFont::SkiaHarfBuzzFont(SkTypeface& typeface) { auto hbFace = createHarfBuzzFace(typeface); HbUniquePtr hbFont(hb_font_create(hbFace.get())); + hb_ot_font_set_funcs(hbFont.get()); if (int axisCount = typeface.getVariationDesignPosition(nullptr, 0)) { Vector axisValues(axisCount); diff --git a/Source/ThirdParty/skia/modules/skshaper/src/SkShaper_harfbuzz.cpp b/Source/ThirdParty/skia/modules/skshaper/src/SkShaper_harfbuzz.cpp index 065385774422..498994ff7aa7 100644 --- a/Source/ThirdParty/skia/modules/skshaper/src/SkShaper_harfbuzz.cpp +++ b/Source/ThirdParty/skia/modules/skshaper/src/SkShaper_harfbuzz.cpp @@ -277,13 +277,10 @@ HBFace create_hb_face(const SkTypeface& typeface) { // hb_face_create always succeeds. Check that the format is minimally recognized first. // hb_face_create_for_tables may still create a working hb_face. // See https://github.com/harfbuzz/harfbuzz/issues/248 . - unsigned int num_hb_faces = hb_face_count(blob.get()); - if (0 < num_hb_faces && (unsigned)index < num_hb_faces) { - face.reset(hb_face_create(blob.get(), (unsigned)index)); - // Check the number of glyphs as a basic sanitization step. - if (face && hb_face_get_glyph_count(face.get()) == 0) { - face.reset(); - } + face.reset(hb_face_create(blob.get(), (unsigned)index)); + // Check the number of glyphs as a basic sanitization step. + if (face && hb_face_get_glyph_count(face.get()) == 0) { + face.reset(); } } if (!face) {