webkit2gtk3/SOURCES/harfbuzz-1.7.5.patch
2025-04-18 11:42:30 +00:00

49 lines
2.7 KiB
Diff

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<hb_face_t> createHarfBuzzFace(SkTypeface& typeface)
HbUniquePtr<hb_blob_t> blob(hb_blob_create(reinterpret_cast<const char*>(memory), size, HB_MEMORY_MODE_READONLY, stream.release(), [](void* data) {
delete reinterpret_cast<SkStreamAsset*>(data);
}));
- auto faceCount = hb_face_count(blob.get());
- if (faceCount && static_cast<unsigned>(index) < faceCount)
- return HbUniquePtr<hb_face_t>(hb_face_create(blob.get(), index));
+ HbUniquePtr<hb_face_t> result(hb_face_create(blob.get(), index));
+ HbUniquePtr<hb_face_t> 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<hb_font_t> hbFont(hb_font_create(hbFace.get()));
+ hb_ot_font_set_funcs(hbFont.get());
if (int axisCount = typeface.getVariationDesignPosition(nullptr, 0)) {
Vector<SkFontArguments::VariationPosition::Coordinate> 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) {