From d2017cd8ab51b24dcd3bda6fb90fec686b9a86ad Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Tue, 23 Sep 2025 15:48:27 -0500 Subject: [PATCH] Build against harfbuzz 1.7.5 --- .../skia/modules/skshaper/src/SkShaper_harfbuzz.cpp | 11 ++++------- .../platform/graphics/skia/SkiaHarfBuzzFont.cpp | 8 +++++--- Source/cmake/OptionsGTK.cmake | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Source/ThirdParty/skia/modules/skshaper/src/SkShaper_harfbuzz.cpp b/Source/ThirdParty/skia/modules/skshaper/src/SkShaper_harfbuzz.cpp index 67c475c0bb54..14a644865348 100644 --- a/Source/ThirdParty/skia/modules/skshaper/src/SkShaper_harfbuzz.cpp +++ b/Source/ThirdParty/skia/modules/skshaper/src/SkShaper_harfbuzz.cpp @@ -275,13 +275,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) { diff --git a/Source/WebCore/platform/graphics/skia/SkiaHarfBuzzFont.cpp b/Source/WebCore/platform/graphics/skia/SkiaHarfBuzzFont.cpp index 37930ac270ae..90f66d8b63bb 100644 --- a/Source/WebCore/platform/graphics/skia/SkiaHarfBuzzFont.cpp +++ b/Source/WebCore/platform/graphics/skia/SkiaHarfBuzzFont.cpp @@ -104,9 +104,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; } } @@ -130,6 +131,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({ }); axisCount > 0) { Vector axisValues(axisCount); diff --git a/Source/cmake/OptionsGTK.cmake b/Source/cmake/OptionsGTK.cmake index eea6eb87ad4b..6d5f17debcc7 100644 --- a/Source/cmake/OptionsGTK.cmake +++ b/Source/cmake/OptionsGTK.cmake @@ -13,7 +13,7 @@ find_package(Cairo 1.14.0 REQUIRED) find_package(LibGcrypt 1.7.0 REQUIRED) find_package(Soup3 3.0.0 REQUIRED) find_package(Tasn1 REQUIRED) -find_package(HarfBuzz 2.7.4 REQUIRED COMPONENTS ICU) +find_package(HarfBuzz 1.7.5 REQUIRED COMPONENTS ICU) find_package(ICU 70.1 REQUIRED COMPONENTS data i18n uc) find_package(JPEG REQUIRED) find_package(Epoxy 1.5.4 REQUIRED) -- 2.53.0