diff --git a/BUILD.gn b/BUILD.gn index 00fa3f7f3cb30869170cc50991cf99b59449369c..4c409f1d784a481c72cf21f4cce223a61c338110 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -81,6 +81,333 @@ action("harfbuzz_action") { ] } +harfbuzz_for_skia_dir = "${target_gen_dir}_for_skia" + +action("harfbuzz_action_for_skia") { + script = "//third_party/harfbuzz/install.py" + + _src = "${harfbuzz_for_skia_dir}/harfbuzz-11.0.0/src" + outputs = [ + "$_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/Var/VARC/VARC.cc", + "$_src/OT/Var/VARC/VARC.hh", + "$_src/OT/Var/VARC/coord-setter.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/composite-iter.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-morx-table.hh", + "$_src/hb-aat-layout-opbd-table.hh", + "$_src/hb-aat-layout-trak-table.hh", + "$_src/hb-aat-layout.cc", + "$_src/hb-aat-layout.hh", + "$_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-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", + "$_src/hb-cff-interp-common.hh", + "$_src/hb-cff-interp-cs-common.hh", + "$_src/hb-cff-interp-dict-common.hh", + "$_src/hb-cff1-interp-cs.hh", + "$_src/hb-cff2-interp-cs.hh", + "$_src/hb-common.cc", + "$_src/hb-config.hh", + "$_src/hb-cplusplus.hh", + "$_src/hb-debug.hh", + "$_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-font.cc", + "$_src/hb-font.hh", + "$_src/hb-geometry.hh", + "$_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", + "$_src/hb-number.cc", + "$_src/hb-number.hh", + "$_src/hb-object.hh", + "$_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.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", + "$_src/hb-ot-font.cc", + "$_src/hb-ot-gasp-table.hh", + "$_src/hb-ot-glyf-table.hh", + "$_src/hb-ot-hdmx-table.hh", + "$_src/hb-ot-head-table.hh", + "$_src/hb-ot-hhea-table.hh", + "$_src/hb-ot-hmtx-table.hh", + "$_src/hb-ot-kern-table.hh", + "$_src/hb-ot-layout-base-table.hh", + "$_src/hb-ot-layout-common.hh", + "$_src/hb-ot-layout-gdef-table.hh", + "$_src/hb-ot-layout-gpos-table.hh", + "$_src/hb-ot-layout-gsub-table.hh", + "$_src/hb-ot-layout-gsubgpos.hh", + "$_src/hb-ot-layout-jstf-table.hh", + "$_src/hb-ot-layout.cc", + "$_src/hb-ot-layout.hh", + "$_src/hb-ot-map.cc", + "$_src/hb-ot-map.hh", + "$_src/hb-ot-math-table.hh", + "$_src/hb-ot-math.cc", + "$_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-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-varc-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", + "$_src/hb-set.cc", + "$_src/hb-set.hh", + "$_src/hb-shape-plan.cc", + "$_src/hb-shape-plan.hh", + "$_src/hb-shape.cc", + "$_src/hb-shaper-impl.hh", + "$_src/hb-shaper-list.hh", + "$_src/hb-shaper.cc", + "$_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", + "$_src/hb-subset-cff2.cc", + "$_src/hb-subset-input.cc", + "$_src/hb-subset-input.hh", + "$_src/hb-subset-instancer-iup.cc", + "$_src/hb-subset-instancer-iup.hh", + "$_src/hb-subset-instancer-solver.cc", + "$_src/hb-subset-instancer-solver.hh", + "$_src/hb-subset-plan-member-list.hh", + "$_src/hb-subset-plan.cc", + "$_src/hb-subset-plan.hh", + "$_src/hb-subset.cc", + "$_src/hb-subset.hh", + "$_src/hb-ucd-table.hh", + "$_src/hb-ucd.cc", + "$_src/hb-unicode-emoji-table.hh", + "$_src/hb-unicode.cc", + "$_src/hb-unicode.hh", + "$_src/hb-utf.hh", + "$_src/hb-vector.hh", + "$_src/hb.hh", + ] + + if (is_arkui_x) { + outputs += [ + "$_src/hb-icu.cc", + "$_src/hb-icu.h", + ] + } + inputs = [ "//third_party/harfbuzz/harfbuzz-11.0.0.tar.xz" ] + harfbuzz_path = rebase_path("${harfbuzz_for_skia_dir}", root_build_dir) + harfbuzz_source_path = rebase_path("//third_party/harfbuzz", root_build_dir) + args = [ + "--gen-dir", + "$harfbuzz_path", + "--source-dir", + "$harfbuzz_source_path", + ] +} + if (defined(ohos_lite)) { lite_library("harfbuzz") { output_name = "harfbuzz" @@ -121,6 +448,8 @@ if (defined(ohos_lite)) { defines = [ "HAVE_PTHREAD = 1" ] } } + group("harfbuzz_static_for_skia") { + } } else { ohos_static_library("harfbuzz_static") { sources = get_target_outputs(":harfbuzz_action") @@ -131,4 +460,45 @@ if (defined(ohos_lite)) { part_name = "harfbuzz" subsystem_name = "thirdparty" } + + config("harfbuzz_config_for_skia") { + visibility = [ ":*" ] + + include_dirs = [ "${harfbuzz_for_skia_dir}/harfbuzz-11.0.0/src" ] + + defines = [ + "HAVE_OT", + "HAVE_CONFIG_OVERRIDE_H", + "HB_NO_FALLBACK_SHAPE", + "HB_NO_WIN1256", + ] + if (is_arkui_x) { + defines += [ + "HAVE_ICU", + "HAVE_ICU_BUILTIN", + ] + } + } + + ohos_static_library("harfbuzz_static_for_skia") { + sources = get_target_outputs(":harfbuzz_action_for_skia") + deps = [ ":harfbuzz_action_for_skia" ] + + public_configs = [ ":harfbuzz_config_for_skia" ] + include_dirs = [ "." ] + + cflags = [] + if (defined(is_mingw) && is_mingw == true) { + cflags += [ "/w" ] + } else { + cflags += [ "-w" ] + } + + if (is_arkui_x) { + deps += [ "//third_party/icu/icu4c:static_icuuc" ] + include_dirs += [ "//third_party/icu/icu4c/source/common" ] + } + part_name = "harfbuzz" + subsystem_name = "thirdparty" + } } diff --git a/bundle.json b/bundle.json index 87e50620c8dd92f9f74b3146b2f5afdb27d70436..5f9361e9a0fe7d075c29eaa31eeb6171ba5e8686 100644 --- a/bundle.json +++ b/bundle.json @@ -28,9 +28,14 @@ }, "build": { "sub_component": [ - "//third_party/harfbuzz:harfbuzz_static" + "//third_party/harfbuzz:harfbuzz_static", + "//third_party/harfbuzz:harfbuzz_static_for_skia" + ], + "inner_kits": [ + { + "name": "//third_party/harfbuzz:harfbuzz_static_for_skia" + } ], - "inner_kits": [], "test": [] } } diff --git a/config-override.h b/config-override.h new file mode 100644 index 0000000000000000000000000000000000000000..899a59436192e99f256892f60d623d009d0b242a --- /dev/null +++ b/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