From d2a8ef647b2dff477b0cff43a43812ae7b948b35 Mon Sep 17 00:00:00 2001 From: Tom spot Callaway Date: Mon, 20 Sep 2021 13:41:41 -0400 Subject: [PATCH] fix against harfbuzz v3, thanks to Jan Beich @ FreeBSD --- chromium-93.0.4577.82-harfbuzz3.patch | 97 +++++++++++++++++++++++++++ chromium.spec | 11 ++- 2 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 chromium-93.0.4577.82-harfbuzz3.patch diff --git a/chromium-93.0.4577.82-harfbuzz3.patch b/chromium-93.0.4577.82-harfbuzz3.patch new file mode 100644 index 00000000..1ed23fea --- /dev/null +++ b/chromium-93.0.4577.82-harfbuzz3.patch @@ -0,0 +1,97 @@ +diff -up chromium-93.0.4577.82/components/paint_preview/common/subset_font.cc.hbfix chromium-93.0.4577.82/components/paint_preview/common/subset_font.cc +--- chromium-93.0.4577.82/components/paint_preview/common/subset_font.cc.hbfix 2021-09-20 11:37:58.633517817 -0400 ++++ chromium-93.0.4577.82/components/paint_preview/common/subset_font.cc 2021-09-20 11:40:12.111235467 -0400 +@@ -72,9 +72,11 @@ sk_sp SubsetFont(SkTypeface* typ + hb_set_t* glyphs = + hb_subset_input_glyph_set(input.get()); // Owned by |input|. + usage.ForEach(base::BindRepeating(&AddGlyphs, base::Unretained(glyphs))); +- hb_subset_input_set_retain_gids(input.get(), true); ++ hb_subset_input_set_flags(input.get(), HB_SUBSET_FLAGS_RETAIN_GIDS); + +- HbScoped subset_face(hb_subset(face.get(), input.get())); ++ HbScoped subset_face(hb_subset_or_fail(face.get(), input.get())); ++ if (!subset_face) ++ return nullptr; + HbScoped subset_blob(hb_face_reference_blob(subset_face.get())); + if (!subset_blob) + return nullptr; +diff -up chromium-93.0.4577.82/third_party/skia/gn/skia.gni.hbfix chromium-93.0.4577.82/third_party/skia/gn/skia.gni +--- chromium-93.0.4577.82/third_party/skia/gn/skia.gni.hbfix 2021-09-20 11:41:20.078600944 -0400 ++++ chromium-93.0.4577.82/third_party/skia/gn/skia.gni 2021-09-20 11:42:29.851976086 -0400 +@@ -33,8 +33,6 @@ declare_args() { + skia_include_multiframe_procs = false + skia_lex = false + skia_libgifcodec_path = "third_party/externals/libgifcodec" +- skia_pdf_subset_harfbuzz = +- false # TODO: set skia_pdf_subset_harfbuzz to skia_use_harfbuzz. + skia_qt_path = getenv("QT_PATH") + skia_skqp_global_error_tolerance = 0 + skia_tools_require_resources = false +@@ -99,6 +97,10 @@ declare_args() { + } + + declare_args() { ++ skia_pdf_subset_harfbuzz = skia_use_harfbuzz ++} ++ ++declare_args() { + skia_compile_sksl_tests = skia_compile_processors + skia_enable_fontmgr_android = skia_use_expat && skia_use_freetype + skia_enable_fontmgr_custom_directory = skia_use_freetype && !is_fuchsia +diff -up chromium-93.0.4577.82/third_party/skia/src/pdf/SkPDFSubsetFont.cpp.hbfix chromium-93.0.4577.82/third_party/skia/src/pdf/SkPDFSubsetFont.cpp +--- chromium-93.0.4577.82/third_party/skia/src/pdf/SkPDFSubsetFont.cpp.hbfix 2021-09-20 13:34:57.861369449 -0400 ++++ chromium-93.0.4577.82/third_party/skia/src/pdf/SkPDFSubsetFont.cpp 2021-09-20 13:38:28.063504311 -0400 +@@ -49,6 +49,37 @@ static sk_sp to_data(HBBlob blob + blob.release()); + } + ++template using void_t = void; ++template ++struct SkPDFHarfBuzzSubset { ++ // This is the HarfBuzz 3.0 interface. ++ // hb_subset_flags_t does not exist in 2.0. It isn't dependent on T, so inline the value of ++ // HB_SUBSET_FLAGS_RETAIN_GIDS until 2.0 is no longer supported. ++ static HBFace Make(T input, hb_face_t* face) { ++ // TODO: When possible, check if a font is 'tricky' with FT_IS_TRICKY. ++ // If it isn't known if a font is 'tricky', retain the hints. ++ hb_subset_input_set_flags(input, 2/*HB_SUBSET_FLAGS_RETAIN_GIDS*/); ++ return HBFace(hb_subset_or_fail(face, input)); ++ } ++}; ++template ++struct SkPDFHarfBuzzSubset(), std::declval())), ++ decltype(hb_subset_input_set_drop_hints(std::declval(), std::declval())), ++ decltype(hb_subset(std::declval(), std::declval())) ++ >> ++{ ++ // This is the HarfBuzz 2.0 (non-public) interface, used if it exists. ++ // This code should be removed as soon as all users are migrated to the newer API. ++ static HBFace Make(T input, hb_face_t* face) { ++ hb_subset_input_set_retain_gids(input, true); ++ // TODO: When possible, check if a font is 'tricky' with FT_IS_TRICKY. ++ // If it isn't known if a font is 'tricky', retain the hints. ++ hb_subset_input_set_drop_hints(input, false); ++ return HBFace(hb_subset(face, input)); ++ } ++}; ++ + static sk_sp subset_harfbuzz(sk_sp fontData, + const SkPDFGlyphUse& glyphUsage, + int ttcIndex) { +@@ -71,11 +102,10 @@ static sk_sp subset_harfbuzz(sk_ + hb_set_t* glyphs = hb_subset_input_glyph_set(input.get()); + glyphUsage.getSetValues([&glyphs](unsigned gid) { hb_set_add(glyphs, gid);}); + +- hb_subset_input_set_retain_gids(input.get(), true); +- // TODO: When possible, check if a font is 'tricky' with FT_IS_TRICKY. +- // If it isn't known if a font is 'tricky', retain the hints. +- hb_subset_input_set_drop_hints(input.get(), false); +- HBFace subset(hb_subset(face.get(), input.get())); ++ HBFace subset = SkPDFHarfBuzzSubset::Make(input.get(), face.get()); ++ if (!subset) { ++ return nullptr; ++ } + HBBlob result(hb_face_reference_blob(subset.get())); + return to_data(std::move(result)); + } diff --git a/chromium.spec b/chromium.spec index 4c3d565d..43dceefc 100644 --- a/chromium.spec +++ b/chromium.spec @@ -225,7 +225,7 @@ Name: chromium%{chromium_channel}%{nsuffix} Name: chromium%{chromium_channel} %endif Version: %{majorversion}.0.4577.82 -Release: 1%{?dist} +Release: 2%{?dist} %if %{?freeworld} %if %{?shared} # chromium-libs-media-freeworld @@ -349,6 +349,9 @@ Patch93: chromium-93.0.4577.63-vector-fix.patch Patch94: chromium-93.0.4577.63-remoting-nodestructor-fix.patch # include full UrlResponseHead header Patch95: chromium-93.0.4577.63-mojo-header-fix.patch +# Fix against HarfBuzz v3 +# Thanks to Jan Beich @ FreeBSD +Patch96: chromium-93.0.4577.82-harfbuzz3.patch # Use lstdc++ on EPEL7 only @@ -1031,6 +1034,9 @@ udev. %patch93 -p1 -b .vector-fix %patch94 -p1 -b .remoting-nodestructor-fix %patch95 -p1 -b .mojo-header-fix +%if 0%{?fedora} >= 36 +%patch96 -p1 -b .hbfix +%endif # Fedora branded user agent %if 0%{?fedora} @@ -2115,6 +2121,9 @@ getent group chrome-remote-desktop >/dev/null || groupadd -r chrome-remote-deskt %changelog +* Mon Sep 20 2021 Tom Callaway - 93.0.4577.82-2 +- add fix for harfbuzz v3 (thanks to Jan Beich @ FreeBSD) + * Thu Sep 16 2021 Tom Callaway - 93.0.4577.82-1 - update to 93.0.4577.82