From 0bec8d241a8784fe52413ff7c5c6d584e8b79fa1 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Sun, 11 Jun 2023 08:19:52 +0200 Subject: [PATCH 1/4] Update harfbuzz to 7.3.0 --- BUILD.gn | 78 +------ DEPS | 2 +- third_party/harfbuzz/BUILD.gn | 273 ++++++++++++++++++++----- third_party/harfbuzz/LICENSE | 29 +++ third_party/harfbuzz/config-override.h | 11 + third_party/harfbuzz/roll-harfbuzz.sh | 99 +++++++++ 6 files changed, 375 insertions(+), 117 deletions(-) create mode 100644 third_party/harfbuzz/LICENSE create mode 100644 third_party/harfbuzz/config-override.h create mode 100755 third_party/harfbuzz/roll-harfbuzz.sh diff --git a/BUILD.gn b/BUILD.gn index 61facb7a1957..6ab80c31f5b4 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -3110,76 +3110,20 @@ skiasharp_build("HarfBuzzSharp") { ] defines = [ - "HAVE_ATEXIT", - "HAVE_CXX11", - "HAVE_GETPAGESIZE", - "HAVE_ISATTY", - "HAVE_MEMORY_H", - "HAVE_MMAP", - "HAVE_MPROTECT", - "HAVE_PTHREAD", - "HAVE_SYS_MMAN_H", - "HAVE_SYS_STAT_H", - "HAVE_SYS_TYPES_H", - "HAVE_SYSCONF", - "HAVE_UNISTD_H" + #"HAVE_FREETYPE", + #"HAVE_ICU", + #"HAVE_ICU_BUILTIN", + "HAVE_OT", + "HAVE_CONFIG_OVERRIDE_H", + "HB_NO_FALLBACK_SHAPE", + ] + + include_dirs = [ + "third_party/harfbuzz" ] _src = "third_party/externals/harfbuzz/src" sources = [ - "$_src/hb-aat-layout.cc", - "$_src/hb-aat-map.cc", - "$_src/hb-blob.cc", - "$_src/hb-buffer-serialize.cc", - "$_src/hb-buffer.cc", - "$_src/hb-common.cc", - "$_src/hb-draw.cc", - "$_src/hb-face.cc", - "$_src/hb-fallback-shape.cc", - "$_src/hb-font.cc", - "$_src/hb-map.cc", - "$_src/hb-number.cc", - "$_src/hb-ot-cff1-table.cc", - "$_src/hb-ot-cff2-table.cc", - "$_src/hb-ot-color.cc", - "$_src/hb-ot-face.cc", - "$_src/hb-ot-font.cc", - "$_src/hb-ot-layout.cc", - "$_src/hb-ot-map.cc", - "$_src/hb-ot-math.cc", - "$_src/hb-ot-meta.cc", - "$_src/hb-ot-metrics.cc", - "$_src/hb-ot-name.cc", - "$_src/hb-ot-shape-complex-arabic.cc", - "$_src/hb-ot-shape-complex-default.cc", - "$_src/hb-ot-shape-complex-hangul.cc", - "$_src/hb-ot-shape-complex-hebrew.cc", - "$_src/hb-ot-shape-complex-indic-table.cc", - "$_src/hb-ot-shape-complex-indic.cc", - "$_src/hb-ot-shape-complex-khmer.cc", - "$_src/hb-ot-shape-complex-myanmar.cc", - "$_src/hb-ot-shape-complex-syllabic.cc", - "$_src/hb-ot-shape-complex-thai.cc", - "$_src/hb-ot-shape-complex-use.cc", - "$_src/hb-ot-shape-complex-vowel-constraints.cc", - "$_src/hb-ot-shape-fallback.cc", - "$_src/hb-ot-shape-normalize.cc", - "$_src/hb-ot-shape.cc", - "$_src/hb-ot-tag.cc", - "$_src/hb-ot-var.cc", - "$_src/hb-set.cc", - "$_src/hb-shape-plan.cc", - "$_src/hb-shape.cc", - "$_src/hb-shaper.cc", - "$_src/hb-static.cc", - "$_src/hb-style.cc", - "$_src/hb-subset-cff-common.cc", - "$_src/hb-subset-cff1.cc", - "$_src/hb-subset-cff2.cc", - "$_src/hb-subset-input.cc", - "$_src/hb-subset-plan.cc", - "$_src/hb-subset.cc", - "$_src/hb-ucd.cc", - "$_src/hb-unicode.cc", + "$_src/harfbuzz-subset.cc", ] } diff --git a/DEPS b/DEPS index 33a9fbcf58d7..d620d1d68a48 100644 --- a/DEPS +++ b/DEPS @@ -21,7 +21,7 @@ deps = { "third_party/externals/egl-registry" : "https://skia.googlesource.com/external/github.com/KhronosGroup/EGL-Registry@a0bca08de07c7d7651047bedc0b653cfaaa4f2ae", "third_party/externals/expat" : "https://chromium.googlesource.com/external/github.com/libexpat/libexpat.git@3bab6c09bbe8bf42d84b81563ddbcf4cca4be838", "third_party/externals/freetype" : "https://skia.googlesource.com/third_party/freetype2.git@40c5681ab92e7db1298273ccf3c816e6a1498260", - "third_party/externals/harfbuzz" : "https://github.com/harfbuzz/harfbuzz.git@63e15eac4f443fa53565d1e4fb9611cdd7814f28", + "third_party/externals/harfbuzz" : "https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git@06158c6be6e243ca4106dd2e5e840b9019874842", "third_party/externals/icu" : "https://chromium.googlesource.com/chromium/deps/icu.git@dbd3825b31041d782c5b504c59dcfb5ac7dda08c", "third_party/externals/imgui" : "https://skia.googlesource.com/external/github.com/ocornut/imgui.git@9418dcb69355558f70de260483424412c5ca2fce", "third_party/externals/libgifcodec" : "https://skia.googlesource.com/libgifcodec@d06d2a6d42baf6c0c91cacc28df2542a911d05fe", diff --git a/third_party/harfbuzz/BUILD.gn b/third_party/harfbuzz/BUILD.gn index eb940ac98fb3..14a93c95939a 100644 --- a/third_party/harfbuzz/BUILD.gn +++ b/third_party/harfbuzz/BUILD.gn @@ -14,6 +14,9 @@ if (skia_use_system_harfbuzz) { system("harfbuzz") { include_dirs = [ "/usr/include/harfbuzz" ] libs = [ "harfbuzz" ] + if (skia_pdf_subset_harfbuzz) { + libs += [ "harfbuzz-subset" ] + } } } else { third_party("harfbuzz") { @@ -23,12 +26,15 @@ if (skia_use_system_harfbuzz) { _src, ] defines = [ - "HAVE_ICU", - "HAVE_ICU_BUILTIN", - "HAVE_INTEL_ATOMIC_PRIMITIVES", + #"HAVE_FREETYPE", + #"HAVE_ICU", + #"HAVE_ICU_BUILTIN", "HAVE_OT", + "HAVE_CONFIG_OVERRIDE_H", + "HB_NO_FALLBACK_SHAPE", + "HB_NO_WIN1256", ] - deps = [ "//third_party/icu" ] + public = [ "$_src/hb-blob.h", "$_src/hb-buffer.h", @@ -36,7 +42,6 @@ if (skia_use_system_harfbuzz) { "$_src/hb-deprecated.h", "$_src/hb-face.h", "$_src/hb-font.h", - "$_src/hb-icu.h", "$_src/hb-map.h", "$_src/hb-ot-font.h", "$_src/hb-ot-layout.h", @@ -52,15 +57,103 @@ if (skia_use_system_harfbuzz) { "$_src/hb-version.h", "$_src/hb.h", ] + sources = [ - "$_src/hb-aat-fdsc-table.hh", + "$_src/OT/Color/CBDT/CBDT.hh", + "$_src/OT/Color/COLR/COLR.hh", + "$_src/OT/Color/COLR/colrv1-closure.hh", + "$_src/OT/Color/CPAL/CPAL.hh", + "$_src/OT/Color/sbix/sbix.hh", + "$_src/OT/Color/svg/svg.hh", + "$_src/OT/Layout/Common/Coverage.hh", + "$_src/OT/Layout/Common/CoverageFormat1.hh", + "$_src/OT/Layout/Common/CoverageFormat2.hh", + "$_src/OT/Layout/Common/RangeRecord.hh", + "$_src/OT/Layout/GDEF/GDEF.hh", + "$_src/OT/Layout/GPOS/Anchor.hh", + "$_src/OT/Layout/GPOS/AnchorFormat1.hh", + "$_src/OT/Layout/GPOS/AnchorFormat2.hh", + "$_src/OT/Layout/GPOS/AnchorFormat3.hh", + "$_src/OT/Layout/GPOS/AnchorMatrix.hh", + "$_src/OT/Layout/GPOS/ChainContextPos.hh", + "$_src/OT/Layout/GPOS/Common.hh", + "$_src/OT/Layout/GPOS/ContextPos.hh", + "$_src/OT/Layout/GPOS/CursivePos.hh", + "$_src/OT/Layout/GPOS/CursivePosFormat1.hh", + "$_src/OT/Layout/GPOS/ExtensionPos.hh", + "$_src/OT/Layout/GPOS/GPOS.hh", + "$_src/OT/Layout/GPOS/LigatureArray.hh", + "$_src/OT/Layout/GPOS/MarkArray.hh", + "$_src/OT/Layout/GPOS/MarkBasePos.hh", + "$_src/OT/Layout/GPOS/MarkBasePosFormat1.hh", + "$_src/OT/Layout/GPOS/MarkLigPos.hh", + "$_src/OT/Layout/GPOS/MarkLigPosFormat1.hh", + "$_src/OT/Layout/GPOS/MarkMarkPos.hh", + "$_src/OT/Layout/GPOS/MarkMarkPosFormat1.hh", + "$_src/OT/Layout/GPOS/MarkRecord.hh", + "$_src/OT/Layout/GPOS/PairPos.hh", + "$_src/OT/Layout/GPOS/PairPosFormat1.hh", + "$_src/OT/Layout/GPOS/PairPosFormat2.hh", + "$_src/OT/Layout/GPOS/PairSet.hh", + "$_src/OT/Layout/GPOS/PairValueRecord.hh", + "$_src/OT/Layout/GPOS/PosLookup.hh", + "$_src/OT/Layout/GPOS/PosLookupSubTable.hh", + "$_src/OT/Layout/GPOS/SinglePos.hh", + "$_src/OT/Layout/GPOS/SinglePosFormat1.hh", + "$_src/OT/Layout/GPOS/SinglePosFormat2.hh", + "$_src/OT/Layout/GPOS/ValueFormat.hh", + "$_src/OT/Layout/GSUB/AlternateSet.hh", + "$_src/OT/Layout/GSUB/AlternateSubst.hh", + "$_src/OT/Layout/GSUB/AlternateSubstFormat1.hh", + "$_src/OT/Layout/GSUB/ChainContextSubst.hh", + "$_src/OT/Layout/GSUB/Common.hh", + "$_src/OT/Layout/GSUB/ContextSubst.hh", + "$_src/OT/Layout/GSUB/ExtensionSubst.hh", + "$_src/OT/Layout/GSUB/GSUB.hh", + "$_src/OT/Layout/GSUB/Ligature.hh", + "$_src/OT/Layout/GSUB/LigatureSet.hh", + "$_src/OT/Layout/GSUB/LigatureSubst.hh", + "$_src/OT/Layout/GSUB/LigatureSubstFormat1.hh", + "$_src/OT/Layout/GSUB/MultipleSubst.hh", + "$_src/OT/Layout/GSUB/MultipleSubstFormat1.hh", + "$_src/OT/Layout/GSUB/ReverseChainSingleSubst.hh", + "$_src/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh", + "$_src/OT/Layout/GSUB/Sequence.hh", + "$_src/OT/Layout/GSUB/SingleSubst.hh", + "$_src/OT/Layout/GSUB/SingleSubstFormat1.hh", + "$_src/OT/Layout/GSUB/SingleSubstFormat2.hh", + "$_src/OT/Layout/GSUB/SubstLookup.hh", + "$_src/OT/Layout/GSUB/SubstLookupSubTable.hh", + "$_src/OT/Layout/types.hh", + "$_src/OT/glyf/CompositeGlyph.hh", + "$_src/OT/glyf/Glyph.hh", + "$_src/OT/glyf/GlyphHeader.hh", + "$_src/OT/glyf/SimpleGlyph.hh", + "$_src/OT/glyf/SubsetGlyph.hh", + "$_src/OT/glyf/VarCompositeGlyph.hh", + "$_src/OT/glyf/composite-iter.hh", + "$_src/OT/glyf/coord-setter.hh", + "$_src/OT/glyf/glyf-helpers.hh", + "$_src/OT/glyf/glyf.hh", + "$_src/OT/glyf/loca.hh", + "$_src/OT/glyf/path-builder.hh", + "$_src/OT/name/name.hh", + "$_src/graph/classdef-graph.hh", + "$_src/graph/coverage-graph.hh", + "$_src/graph/graph.hh", + "$_src/graph/gsubgpos-context.cc", + "$_src/graph/gsubgpos-context.hh", + "$_src/graph/gsubgpos-graph.hh", + "$_src/graph/markbasepos-graph.hh", + "$_src/graph/pairpos-graph.hh", + "$_src/graph/serialize.hh", + "$_src/graph/split-helpers.hh", "$_src/hb-aat-layout-ankr-table.hh", "$_src/hb-aat-layout-bsln-table.hh", "$_src/hb-aat-layout-common.hh", "$_src/hb-aat-layout-feat-table.hh", "$_src/hb-aat-layout-just-table.hh", "$_src/hb-aat-layout-kerx-table.hh", - "$_src/hb-aat-layout-lcar-table.hh", "$_src/hb-aat-layout-morx-table.hh", "$_src/hb-aat-layout-opbd-table.hh", "$_src/hb-aat-layout-trak-table.hh", @@ -69,15 +162,21 @@ if (skia_use_system_harfbuzz) { "$_src/hb-aat-ltag-table.hh", "$_src/hb-aat-map.cc", "$_src/hb-aat-map.hh", + "$_src/hb-aat.h", "$_src/hb-algs.hh", "$_src/hb-array.hh", "$_src/hb-atomic.hh", "$_src/hb-bimap.hh", + "$_src/hb-bit-page.hh", + "$_src/hb-bit-set-invertible.hh", + "$_src/hb-bit-set.hh", "$_src/hb-blob.cc", "$_src/hb-blob.hh", "$_src/hb-buffer-deserialize-json.hh", - "$_src/hb-buffer-deserialize-text.hh", + "$_src/hb-buffer-deserialize-text-glyphs.hh", + "$_src/hb-buffer-deserialize-text-unicode.hh", "$_src/hb-buffer-serialize.cc", + "$_src/hb-buffer-verify.cc", "$_src/hb-buffer.cc", "$_src/hb-buffer.hh", "$_src/hb-cache.hh", @@ -88,27 +187,26 @@ if (skia_use_system_harfbuzz) { "$_src/hb-cff2-interp-cs.hh", "$_src/hb-common.cc", "$_src/hb-config.hh", - "$_src/hb-coretext.cc", + "$_src/hb-cplusplus.hh", "$_src/hb-debug.hh", - "$_src/hb-directwrite.cc", "$_src/hb-dispatch.hh", + "$_src/hb-draw.cc", + "$_src/hb-draw.h", + "$_src/hb-draw.hh", + "$_src/hb-face-builder.cc", "$_src/hb-face.cc", "$_src/hb-face.hh", - "$_src/hb-fallback-shape.cc", "$_src/hb-font.cc", "$_src/hb-font.hh", - "$_src/hb-ft.cc", - "$_src/hb-gdi.cc", - "$_src/hb-glib.cc", - "$_src/hb-gobject-structs.cc", - "$_src/hb-graphite2.cc", - "$_src/hb-icu.cc", "$_src/hb-iter.hh", "$_src/hb-kern.hh", + "$_src/hb-limits.hh", "$_src/hb-machinery.hh", "$_src/hb-map.cc", "$_src/hb-map.hh", "$_src/hb-meta.hh", + "$_src/hb-ms-feature-ranges.hh", + "$_src/hb-multimap.hh", "$_src/hb-mutex.hh", "$_src/hb-null.hh", "$_src/hb-number-parser.hh", @@ -118,17 +216,15 @@ if (skia_use_system_harfbuzz) { "$_src/hb-open-file.hh", "$_src/hb-open-type.hh", "$_src/hb-ot-cff-common.hh", + "$_src/hb-ot-cff1-std-str.hh", "$_src/hb-ot-cff1-table.cc", "$_src/hb-ot-cff1-table.hh", "$_src/hb-ot-cff2-table.cc", "$_src/hb-ot-cff2-table.hh", "$_src/hb-ot-cmap-table.hh", - "$_src/hb-ot-color-cbdt-table.hh", - "$_src/hb-ot-color-colr-table.hh", - "$_src/hb-ot-color-cpal-table.hh", - "$_src/hb-ot-color-sbix-table.hh", - "$_src/hb-ot-color-svg-table.hh", "$_src/hb-ot-color.cc", + "$_src/hb-ot-color.h", + "$_src/hb-ot-deprecated.h", "$_src/hb-ot-face-table-list.hh", "$_src/hb-ot-face.cc", "$_src/hb-ot-face.hh", @@ -156,59 +252,73 @@ if (skia_use_system_harfbuzz) { "$_src/hb-ot-maxp-table.hh", "$_src/hb-ot-meta-table.hh", "$_src/hb-ot-meta.cc", + "$_src/hb-ot-meta.h", "$_src/hb-ot-metrics.cc", "$_src/hb-ot-metrics.hh", "$_src/hb-ot-name-language-static.hh", "$_src/hb-ot-name-language.hh", "$_src/hb-ot-name-table.hh", "$_src/hb-ot-name.cc", + "$_src/hb-ot-name.h", "$_src/hb-ot-os2-table.hh", "$_src/hb-ot-os2-unicode-ranges.hh", "$_src/hb-ot-post-macroman.hh", + "$_src/hb-ot-post-table-v2subset.hh", "$_src/hb-ot-post-table.hh", - "$_src/hb-ot-shape-complex-arabic-fallback.hh", - "$_src/hb-ot-shape-complex-arabic-table.hh", - "$_src/hb-ot-shape-complex-arabic-win1256.hh", - "$_src/hb-ot-shape-complex-arabic.cc", - "$_src/hb-ot-shape-complex-arabic.hh", - "$_src/hb-ot-shape-complex-default.cc", - "$_src/hb-ot-shape-complex-hangul.cc", - "$_src/hb-ot-shape-complex-hebrew.cc", - "$_src/hb-ot-shape-complex-indic-machine.hh", - "$_src/hb-ot-shape-complex-indic-table.cc", - "$_src/hb-ot-shape-complex-indic.cc", - "$_src/hb-ot-shape-complex-indic.hh", - "$_src/hb-ot-shape-complex-khmer-machine.hh", - "$_src/hb-ot-shape-complex-khmer.cc", - "$_src/hb-ot-shape-complex-khmer.hh", - "$_src/hb-ot-shape-complex-myanmar-machine.hh", - "$_src/hb-ot-shape-complex-myanmar.cc", - "$_src/hb-ot-shape-complex-myanmar.hh", - "$_src/hb-ot-shape-complex-thai.cc", - "$_src/hb-ot-shape-complex-use-machine.hh", - "$_src/hb-ot-shape-complex-use-table.cc", - "$_src/hb-ot-shape-complex-use.cc", - "$_src/hb-ot-shape-complex-use.hh", - "$_src/hb-ot-shape-complex-vowel-constraints.cc", - "$_src/hb-ot-shape-complex-vowel-constraints.hh", - "$_src/hb-ot-shape-complex.hh", "$_src/hb-ot-shape-fallback.cc", "$_src/hb-ot-shape-fallback.hh", "$_src/hb-ot-shape-normalize.cc", "$_src/hb-ot-shape-normalize.hh", "$_src/hb-ot-shape.cc", "$_src/hb-ot-shape.hh", + "$_src/hb-ot-shaper-arabic-fallback.hh", + "$_src/hb-ot-shaper-arabic-joining-list.hh", + "$_src/hb-ot-shaper-arabic-pua.hh", + "$_src/hb-ot-shaper-arabic-table.hh", + "$_src/hb-ot-shaper-arabic.cc", + "$_src/hb-ot-shaper-arabic.hh", + "$_src/hb-ot-shaper-default.cc", + "$_src/hb-ot-shaper-hangul.cc", + "$_src/hb-ot-shaper-hebrew.cc", + "$_src/hb-ot-shaper-indic-machine.hh", + "$_src/hb-ot-shaper-indic-table.cc", + "$_src/hb-ot-shaper-indic.cc", + "$_src/hb-ot-shaper-indic.hh", + "$_src/hb-ot-shaper-khmer-machine.hh", + "$_src/hb-ot-shaper-khmer.cc", + "$_src/hb-ot-shaper-myanmar-machine.hh", + "$_src/hb-ot-shaper-myanmar.cc", + "$_src/hb-ot-shaper-syllabic.cc", + "$_src/hb-ot-shaper-syllabic.hh", + "$_src/hb-ot-shaper-thai.cc", + "$_src/hb-ot-shaper-use-machine.hh", + "$_src/hb-ot-shaper-use-table.hh", + "$_src/hb-ot-shaper-use.cc", + "$_src/hb-ot-shaper-vowel-constraints.cc", + "$_src/hb-ot-shaper-vowel-constraints.hh", + "$_src/hb-ot-shaper.hh", "$_src/hb-ot-stat-table.hh", "$_src/hb-ot-tag-table.hh", "$_src/hb-ot-tag.cc", "$_src/hb-ot-var-avar-table.hh", + "$_src/hb-ot-var-common.hh", + "$_src/hb-ot-var-cvar-table.hh", "$_src/hb-ot-var-fvar-table.hh", "$_src/hb-ot-var-gvar-table.hh", "$_src/hb-ot-var-hvar-table.hh", "$_src/hb-ot-var-mvar-table.hh", "$_src/hb-ot-var.cc", "$_src/hb-ot-vorg-table.hh", + "$_src/hb-outline.cc", + "$_src/hb-outline.hh", + "$_src/hb-paint-extents.cc", + "$_src/hb-paint-extents.hh", + "$_src/hb-paint.cc", + "$_src/hb-paint.h", + "$_src/hb-paint.hh", "$_src/hb-pool.hh", + "$_src/hb-priority-queue.hh", + "$_src/hb-repacker.hh", "$_src/hb-sanitize.hh", "$_src/hb-serialize.hh", "$_src/hb-set-digest.hh", @@ -223,6 +333,7 @@ if (skia_use_system_harfbuzz) { "$_src/hb-shaper.hh", "$_src/hb-static.cc", "$_src/hb-string-array.hh", + "$_src/hb-subset-accelerator.hh", "$_src/hb-subset-cff-common.cc", "$_src/hb-subset-cff-common.hh", "$_src/hb-subset-cff1.cc", @@ -231,8 +342,11 @@ if (skia_use_system_harfbuzz) { "$_src/hb-subset-cff2.hh", "$_src/hb-subset-input.cc", "$_src/hb-subset-input.hh", + "$_src/hb-subset-instancer-solver.cc", "$_src/hb-subset-plan.cc", "$_src/hb-subset-plan.hh", + "$_src/hb-subset-repacker.cc", + "$_src/hb-subset-repacker.h", "$_src/hb-subset.cc", "$_src/hb-subset.hh", "$_src/hb-ucd-table.hh", @@ -240,10 +354,71 @@ if (skia_use_system_harfbuzz) { "$_src/hb-unicode-emoji-table.hh", "$_src/hb-unicode.cc", "$_src/hb-unicode.hh", - "$_src/hb-uniscribe.cc", "$_src/hb-utf.hh", "$_src/hb-vector.hh", "$_src/hb.hh", + "config-override.h", + ] + + # The following sources are explicitly not used. + # They are referenced to aid in detecting previously uncategorized files. + unused_sources = [ + "$_src/graph/test-classdef-graph.cc", + "$_src/harfbuzz-subset.cc", + "$_src/harfbuzz.cc", + "$_src/hb-cairo-utils.cc", + "$_src/hb-cairo-utils.hh", + "$_src/hb-cairo.cc", + "$_src/hb-cairo.h", + "$_src/hb-coretext.cc", + "$_src/hb-coretext.h", + "$_src/hb-directwrite.cc", + "$_src/hb-directwrite.h", + "$_src/hb-fallback-shape.cc", + "$_src/hb-ft-colr.hh", + "$_src/hb-ft.cc", + "$_src/hb-ft.h", + "$_src/hb-gdi.cc", + "$_src/hb-gdi.h", + "$_src/hb-glib.cc", + "$_src/hb-glib.h", + "$_src/hb-gobject-structs.cc", + "$_src/hb-gobject-structs.h", + "$_src/hb-gobject.h", + "$_src/hb-graphite2.cc", + "$_src/hb-graphite2.h", + "$_src/hb-icu.cc", + "$_src/hb-icu.h", + "$_src/hb-ot-shaper-arabic-win1256.hh", + "$_src/hb-style.cc", + "$_src/hb-style.h", + "$_src/hb-uniscribe.cc", + "$_src/hb-uniscribe.h", + "$_src/main.cc", + "$_src/test-algs.cc", + "$_src/test-array.cc", + "$_src/test-bimap.cc", + "$_src/test-buffer-serialize.cc", + "$_src/test-gpos-size-params.cc", + "$_src/test-gsub-get-alternates.cc", + "$_src/test-gsub-would-substitute.cc", + "$_src/test-iter.cc", + "$_src/test-machinery.cc", + "$_src/test-map.cc", + "$_src/test-multimap.cc", + "$_src/test-number.cc", + "$_src/test-ot-glyphname.cc", + "$_src/test-ot-meta.cc", + "$_src/test-ot-name.cc", + "$_src/test-priority-queue.cc", + "$_src/test-repacker.cc", + "$_src/test-serialize.cc", + "$_src/test-set.cc", + "$_src/test-unicode-ranges.cc", + "$_src/test-use-table.cc", + "$_src/test-vector.cc", + "$_src/test.cc", ] + assert(unused_sources != []) } } diff --git a/third_party/harfbuzz/LICENSE b/third_party/harfbuzz/LICENSE new file mode 100644 index 000000000000..6b3a80f57305 --- /dev/null +++ b/third_party/harfbuzz/LICENSE @@ -0,0 +1,29 @@ +// Copyright (c) 2021 Google Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +-------------------------------------------------------------------------------- diff --git a/third_party/harfbuzz/config-override.h b/third_party/harfbuzz/config-override.h new file mode 100644 index 000000000000..899a59436192 --- /dev/null +++ b/third_party/harfbuzz/config-override.h @@ -0,0 +1,11 @@ +/* + * Adds a mutex implementation based on c++ mutex to harfbuzz. + */ +#include + +using hb_mutex_impl_t = std::mutex; +#define HB_MUTEX_IMPL_INIT UNUSED +#define hb_mutex_impl_init(M) HB_STMT_START { new (M) hb_mutex_impl_t; } HB_STMT_END +#define hb_mutex_impl_lock(M) (M)->lock () +#define hb_mutex_impl_unlock(M) (M)->unlock () +#define hb_mutex_impl_finish(M) HB_STMT_START { (M)->~hb_mutex_impl_t(); } HB_STMT_END diff --git a/third_party/harfbuzz/roll-harfbuzz.sh b/third_party/harfbuzz/roll-harfbuzz.sh new file mode 100755 index 000000000000..2e0c700d9378 --- /dev/null +++ b/third_party/harfbuzz/roll-harfbuzz.sh @@ -0,0 +1,99 @@ +#!/bin/bash + +HB_GIT_REPO=https://chromium.googlesource.com/external/github.com/harfbuzz/harfbuzz.git +HB_GIT_REF=origin/upstream/main +HB_GIT_DIR=third_party/externals/harfbuzz +HB_BUILD_DIR=$(dirname -- "$0") + +previousrev() { + STEP="original revision" && + HB_PREVIOUS_REV=$(git grep "${HB_GIT_REPO}" HEAD~1 -- DEPS | sed 's!.*'${HB_GIT_REPO}'@\([[:xdigit:]]\{40\}\).*!\1!') +} + +nextrev() { + STEP="next revision" && + git -C ${HB_GIT_DIR} fetch && + HB_NEXT_REV=$(git -C ${HB_GIT_DIR} rev-parse ${HB_GIT_REF}) +} + +rolldeps() { + STEP="roll-deps" && + sed -i'' -e "s!${HB_GIT_REPO}@${HB_PREVIOUS_REV}!${HB_GIT_REPO}@${HB_NEXT_REV}!" DEPS && + tools/git-sync-deps && + git add DEPS +} + +rollbazel() { + STEP="roll-bazel" && + sed -i'' -e "s!commit = \"${HB_PREVIOUS_REV}\",!commit = \"${HB_NEXT_REV}\",!" bazel/deps.bzl && + git add bazel/deps.bzl +} + +check_all_files_are_categorized() { + #for each file name in ${HB_GIT_DIR}/src/hb-*.{cc,h,hh} + # if the file name is not present in BUILD.gn + # should be added to BUILD.gn (in 'unused_sources' if unwanted) + + #for each file name \"src/.*\" in BUILD.gn + # if the file name does not exist + # should be removed from BUILD.gn + + STEP="Updating BUILD.gn" && + HB_BUILD_DIR_REL=$(realpath --relative-to=${HB_GIT_DIR} ${HB_BUILD_DIR}) + ( # Create subshell for IFS, CDPATH, and cd. + # This implementation doesn't handle '"' or '\n' in file names. + IFS=$'\n' && + CDPATH= && + cd -- "${HB_GIT_DIR}" && + + HB_SOURCE_MISSING=false && + find src -type f \( -name "*.cc" -o -name "*.h" -o -name "*.hh" \) | while read HB_SOURCE + do + if ! grep -qF "$HB_SOURCE" ${HB_BUILD_DIR_REL}/BUILD.gn; then + if ! ${HB_SOURCE_MISSING}; then + echo "Is in src/*.{cc,h,hh} but not in BUILD.gn:" + HB_SOURCE_MISSING=true + fi + echo " \"\$_${HB_SOURCE}\"," + fi + done && + + GN_SOURCE_MISSING=false && + grep -oE "\"\\\$_src/[^\"]+\"" ${HB_BUILD_DIR_REL}/BUILD.gn | sed 's/^...\(.*\).$/\1/' | while read GN_SOURCE + do + if [ ! -f "${GN_SOURCE}" ]; then + if ! ${GN_SOURCE_MISSING}; then + echo "Is referenced in BUILD.gn but does not exist:" && + GN_SOURCE_MISSING=true + fi + echo "\"${GN_SOURCE}\"" + fi + done && + + GN_SOURCE_DUPLICATES=$(sort ${HB_BUILD_DIR_REL}/BUILD.gn | uniq -d | grep -oE "\"\\\$_src/[^\"]+\"") + if [ ! -z ${GN_SOURCE_DUPLICATES} ]; then + echo "Is listed more than once in BUILD.gn:" && + echo ${GN_SOURCE_DUPLICATES} + fi + ) +} + +commit() { + STEP="commit" && + HB_PREVIOUS_REV_SHORT=$(expr substr "${HB_PREVIOUS_REV}" 1 8) && + HB_NEXT_REV_SHORT=$(expr substr "${HB_NEXT_REV}" 1 8) && + HB_COMMIT_COUNT=$(git -C ${HB_GIT_DIR} rev-list --count ${HB_PREVIOUS_REV}..${HB_NEXT_REV}) && + git commit -m"Roll HarfBuzz from ${HB_PREVIOUS_REV_SHORT} to ${HB_NEXT_REV_SHORT} (${HB_COMMIT_COUNT} commits) + +${HB_GIT_REPO}/+log/${HB_PREVIOUS_REV}..${HB_NEXT_REV} + +Disable: treat-URL-as-trailer" +} + +previousrev && +nextrev && +rolldeps "$@" && +rollbazel && +check_all_files_are_categorized && +commit && +true || { echo "Failed step ${STEP}"; exit 1; } From 11dc999b789b725e620bbcbf701a6291adaaa254 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Tue, 22 Aug 2023 17:19:48 +0200 Subject: [PATCH 2/4] Update harfbuzz to 7.3.0 --- third_party/harfbuzz/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/harfbuzz/BUILD.gn b/third_party/harfbuzz/BUILD.gn index 14a93c95939a..8499b960292a 100644 --- a/third_party/harfbuzz/BUILD.gn +++ b/third_party/harfbuzz/BUILD.gn @@ -7,7 +7,7 @@ import("../../gn/skia.gni") import("../third_party.gni") declare_args() { - skia_use_system_harfbuzz = is_official_build + skia_use_system_harfbuzz = is_official_build && !is_wasm } if (skia_use_system_harfbuzz) { From 22344aba5cf1da262d02d894b0318413b5061d73 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Tue, 22 Aug 2023 17:40:09 +0200 Subject: [PATCH 3/4] No need for this --- BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/BUILD.gn b/BUILD.gn index 6ab80c31f5b4..fb132104457a 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -3116,6 +3116,7 @@ skiasharp_build("HarfBuzzSharp") { "HAVE_OT", "HAVE_CONFIG_OVERRIDE_H", "HB_NO_FALLBACK_SHAPE", + # "HB_NO_WIN1256", ] include_dirs = [ From 98ab0ffa9a68d6ee4d648d97afe30d27a90f06a0 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Tue, 22 Aug 2023 22:27:26 +0200 Subject: [PATCH 4/4] Not updated enough --- third_party/harfbuzz/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/harfbuzz/BUILD.gn b/third_party/harfbuzz/BUILD.gn index 8499b960292a..14a93c95939a 100644 --- a/third_party/harfbuzz/BUILD.gn +++ b/third_party/harfbuzz/BUILD.gn @@ -7,7 +7,7 @@ import("../../gn/skia.gni") import("../third_party.gni") declare_args() { - skia_use_system_harfbuzz = is_official_build && !is_wasm + skia_use_system_harfbuzz = is_official_build } if (skia_use_system_harfbuzz) {