diff options
Diffstat (limited to 'Build/source/libs/harfbuzz/harfbuzz-src/src')
164 files changed, 2735 insertions, 1533 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources index b981b0e264f..654255e20c7 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/Makefile.sources @@ -1,28 +1,28 @@ # Base and default-included sources and headers HB_BASE_sources = \ - hb-atomic-private.hh \ - hb-blob-private.hh \ + hb-atomic.hh \ + hb-blob.hh \ hb-blob.cc \ - hb-buffer-private.hh \ + hb-buffer.hh \ hb-buffer-serialize.cc \ hb-buffer.cc \ hb-common.cc \ hb-debug.hh \ hb-dsalgs.hh \ - hb-face-private.hh \ + hb-face.hh \ hb-face.cc \ - hb-font-private.hh \ + hb-font.hh \ hb-font.cc \ - hb-iter-private.hh \ - hb-map-private.hh \ + hb-iter.hh \ + hb-map.hh \ hb-map.cc \ - hb-machinery-private.hh \ - hb-mutex-private.hh \ + hb-machinery.hh \ + hb-mutex.hh \ hb-null.hh \ - hb-object-private.hh \ - hb-open-file-private.hh \ - hb-open-type-private.hh \ + hb-object.hh \ + hb-open-file.hh \ + hb-open-type.hh \ hb-ot-color-cbdt-table.hh \ hb-ot-cmap-table.hh \ hb-ot-glyf-table.hh \ @@ -38,23 +38,23 @@ HB_BASE_sources = \ hb-ot-post-macroman.hh \ hb-ot-post-table.hh \ hb-ot-tag.cc \ - hb-private.hh \ - hb-set-digest-private.hh \ - hb-set-private.hh \ + hb.hh \ + hb-set-digest.hh \ + hb-set.hh \ hb-set.cc \ hb-shape.cc \ - hb-shape-plan-private.hh \ + hb-shape-plan.hh \ hb-shape-plan.cc \ hb-shaper-list.hh \ - hb-shaper-impl-private.hh \ - hb-shaper-private.hh \ + hb-shaper-impl.hh \ + hb-shaper.hh \ hb-shaper.cc \ hb-static.cc \ hb-string-array.hh \ - hb-unicode-private.hh \ + hb-unicode.hh \ hb-unicode.cc \ - hb-vector-private.hh \ - hb-utf-private.hh \ + hb-vector.hh \ + hb-utf.hh \ hb-warning.cc \ $(NULL) @@ -89,61 +89,63 @@ HB_FALLBACK_sources = \ HB_OT_sources = \ hb-aat-layout.cc \ - hb-aat-layout-common-private.hh \ + hb-aat-layout-common.hh \ hb-aat-layout-ankr-table.hh \ hb-aat-layout-bsln-table.hh \ hb-aat-layout-feat-table.hh \ hb-aat-layout-kerx-table.hh \ hb-aat-layout-morx-table.hh \ hb-aat-layout-trak-table.hh \ - hb-aat-layout-private.hh \ + hb-aat-layout.hh \ hb-aat-ltag-table.hh \ + hb-ot-face.hh \ + hb-ot-face.cc \ hb-ot-font.cc \ hb-ot-layout.cc \ hb-ot-layout-base-table.hh \ - hb-ot-layout-common-private.hh \ + hb-ot-layout-common.hh \ hb-ot-layout-gdef-table.hh \ hb-ot-layout-gpos-table.hh \ - hb-ot-layout-gsubgpos-private.hh \ + hb-ot-layout-gsubgpos.hh \ hb-ot-layout-gsub-table.hh \ hb-ot-layout-jstf-table.hh \ - hb-ot-layout-private.hh \ + hb-ot-layout.hh \ hb-ot-color.cc \ hb-ot-color-colr-table.hh \ hb-ot-color-cpal-table.hh \ hb-ot-color-sbix-table.hh \ hb-ot-color-svg-table.hh \ hb-ot-map.cc \ - hb-ot-map-private.hh \ + hb-ot-map.hh \ hb-ot-math.cc \ hb-ot-math-table.hh \ hb-ot-shape.cc \ hb-ot-shape-complex-arabic.cc \ hb-ot-shape-complex-arabic-fallback.hh \ - hb-ot-shape-complex-arabic-private.hh \ + hb-ot-shape-complex-arabic.hh \ hb-ot-shape-complex-arabic-table.hh \ hb-ot-shape-complex-arabic-win1256.hh \ hb-ot-shape-complex-default.cc \ hb-ot-shape-complex-hangul.cc \ hb-ot-shape-complex-hebrew.cc \ hb-ot-shape-complex-indic.cc \ - hb-ot-shape-complex-indic-private.hh \ + hb-ot-shape-complex-indic.hh \ hb-ot-shape-complex-indic-table.cc \ - hb-ot-shape-complex-khmer-private.hh \ + hb-ot-shape-complex-khmer.hh \ hb-ot-shape-complex-khmer.cc \ - hb-ot-shape-complex-myanmar-private.hh \ + hb-ot-shape-complex-myanmar.hh \ hb-ot-shape-complex-myanmar.cc \ hb-ot-shape-complex-thai.cc \ hb-ot-shape-complex-tibetan.cc \ hb-ot-shape-complex-use.cc \ - hb-ot-shape-complex-use-private.hh \ + hb-ot-shape-complex-use.hh \ hb-ot-shape-complex-use-table.cc \ - hb-ot-shape-complex-private.hh \ - hb-ot-shape-normalize-private.hh \ + hb-ot-shape-complex.hh \ + hb-ot-shape-normalize.hh \ hb-ot-shape-normalize.cc \ - hb-ot-shape-fallback-private.hh \ + hb-ot-shape-fallback.hh \ hb-ot-shape-fallback.cc \ - hb-ot-shape-private.hh \ + hb-ot-shape.hh \ hb-ot-var.cc \ hb-ot-var-avar-table.hh \ hb-ot-var-fvar-table.hh \ @@ -207,16 +209,17 @@ HB_ICU_headers = hb-icu.h HB_SUBSET_sources = \ hb-static.cc \ hb-subset.cc \ + hb-subset.hh \ hb-subset-glyf.cc \ + hb-subset-glyf.hh \ hb-subset-input.cc \ + hb-subset-input.hh \ hb-subset-plan.cc \ + hb-subset-plan.hh \ $(NULL) HB_SUBSET_headers = \ hb-subset.h \ - hb-subset-glyf.hh \ - hb-subset-plan.hh \ - hb-subset-private.hh \ $(NULL) HB_GOBJECT_DIST_sources = hb-gobject-structs.cc diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/check-includes.sh b/Build/source/libs/harfbuzz/harfbuzz-src/src/check-includes.sh index fd565da53fb..f938f706cfd 100755 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/check-includes.sh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/check-includes.sh @@ -23,14 +23,14 @@ grep -v 'hb[.]h:' | grep . >&2 && stat=1 -echo 'Checking that source files #include "hb-*private.hh" first (or none)' +echo 'Checking that source files #include a private header first (or none)' for x in $HBSOURCES; do test -f "$srcdir/$x" -a ! -f "$x" && x="$srcdir/$x" - grep '#.*\<include\>' "$x" /dev/null | grep -v 'include _' | head -n 1 + grep '#.*\<include\>' "$x" /dev/null | head -n 1 done | -grep -v '"hb-.*private[.]hh"' | -grep -v 'hb-private[.]hh:' | +grep -v '"hb-.*[.]hh"' | +grep -v 'hb[.]hh' | grep . >&2 && stat=1 diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-indic-data.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-indic-data.cc index d57413884be..a506889810b 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-indic-data.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-indic-data.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-complex-indic-private.hh" +#include "hb-ot-shape-complex-indic.hh" int main (void) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-khmer-data.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-khmer-data.cc index 7dd09b2b5ca..12871fa850f 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-khmer-data.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-khmer-data.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-complex-khmer-private.hh" +#include "hb-ot-shape-complex-khmer.hh" int main (void) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-myanmar-data.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-myanmar-data.cc index 2df9cd987f3..9f8b12ed229 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-myanmar-data.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-myanmar-data.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-complex-myanmar-private.hh" +#include "hb-ot-shape-complex-myanmar.hh" int main (void) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-use-data.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-use-data.cc index 0e64688f1e0..4a8b25842e1 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-use-data.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/dump-use-data.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-complex-use-private.hh" +#include "hb-ot-shape-complex-use.hh" int main (void) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-indic-table.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-indic-table.py index 6252664caae..e65b9814adf 100755 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-indic-table.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-indic-table.py @@ -102,7 +102,7 @@ for h in headers: print (" * %s" % (l.strip())) print (" */") print () -print ('#include "hb-ot-shape-complex-indic-private.hh"') +print ('#include "hb-ot-shape-complex-indic.hh"') print () # Shorten values diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-use-table.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-use-table.py index c742ebacae4..a8724619a03 100755 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-use-table.py +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-use-table.py @@ -394,7 +394,7 @@ for h in headers: print (" * %s" % (l.strip())) print (" */") print () -print ('#include "hb-ot-shape-complex-use-private.hh"') +print ('#include "hb-ot-shape-complex-use.hh"') print () total = 0 diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-ankr-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-ankr-table.hh index 3b7912b9df6..a197cec8112 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-ankr-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-ankr-table.hh @@ -25,7 +25,7 @@ #ifndef HB_AAT_LAYOUT_ANKR_TABLE_HH #define HB_AAT_LAYOUT_ANKR_TABLE_HH -#include "hb-aat-layout-common-private.hh" +#include "hb-aat-layout-common.hh" /* * ankr -- Anchor Point diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-bsln-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-bsln-table.hh index df2bf5b43f0..b86408626f2 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-bsln-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-bsln-table.hh @@ -25,7 +25,7 @@ #ifndef HB_AAT_LAYOUT_BSLN_TABLE_HH #define HB_AAT_LAYOUT_BSLN_TABLE_HH -#include "hb-aat-layout-common-private.hh" +#include "hb-aat-layout-common.hh" /* * bsln -- Baseline diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-common-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-common.hh index d7f35052d77..25f4fe14a75 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-common-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-common.hh @@ -24,10 +24,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_AAT_LAYOUT_COMMON_PRIVATE_HH -#define HB_AAT_LAYOUT_COMMON_PRIVATE_HH +#ifndef HB_AAT_LAYOUT_COMMON_HH +#define HB_AAT_LAYOUT_COMMON_HH -#include "hb-aat-layout-private.hh" +#include "hb-aat-layout.hh" namespace AAT { @@ -641,4 +641,4 @@ struct hb_aat_apply_context_t : } /* namespace AAT */ -#endif /* HB_AAT_LAYOUT_COMMON_PRIVATE_HH */ +#endif /* HB_AAT_LAYOUT_COMMON_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-feat-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-feat-table.hh index 3e070d79592..b7007631662 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-feat-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-feat-table.hh @@ -25,7 +25,7 @@ #ifndef HB_AAT_LAYOUT_FEAT_TABLE_HH #define HB_AAT_LAYOUT_FEAT_TABLE_HH -#include "hb-aat-layout-common-private.hh" +#include "hb-aat-layout-common.hh" /* * feat -- Feature Name diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-kerx-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-kerx-table.hh index cc03d627862..615a8f8d4c3 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-kerx-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-kerx-table.hh @@ -28,8 +28,8 @@ #ifndef HB_AAT_LAYOUT_KERX_TABLE_HH #define HB_AAT_LAYOUT_KERX_TABLE_HH -#include "hb-open-type-private.hh" -#include "hb-aat-layout-common-private.hh" +#include "hb-open-type.hh" +#include "hb-aat-layout-common.hh" #include "hb-aat-layout-ankr-table.hh" /* diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-morx-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-morx-table.hh index f25842457db..ef452e22b29 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-morx-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-morx-table.hh @@ -27,9 +27,9 @@ #ifndef HB_AAT_LAYOUT_MORX_TABLE_HH #define HB_AAT_LAYOUT_MORX_TABLE_HH -#include "hb-open-type-private.hh" -#include "hb-aat-layout-common-private.hh" -#include "hb-ot-layout-common-private.hh" +#include "hb-open-type.hh" +#include "hb-aat-layout-common.hh" +#include "hb-ot-layout-common.hh" /* * morx -- Extended Glyph Metamorphosis diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-trak-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-trak-table.hh index f5dc558c3fe..c4bec2cab64 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-trak-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-trak-table.hh @@ -28,9 +28,9 @@ #ifndef HB_AAT_LAYOUT_TRAK_TABLE_HH #define HB_AAT_LAYOUT_TRAK_TABLE_HH -#include "hb-aat-layout-common-private.hh" -#include "hb-ot-layout-private.hh" -#include "hb-open-type-private.hh" +#include "hb-aat-layout-common.hh" +#include "hb-ot-layout.hh" +#include "hb-open-type.hh" /* * trak -- Tracking diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc index 36d4037ad9b..a5e36a40a38 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.cc @@ -24,12 +24,10 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" -#include "hb-ot-layout-private.hh" -#include "hb-ot-layout-gsubgpos-private.hh" - -#include "hb-aat-layout-private.hh" +#include "hb-ot-face.hh" +#include "hb-aat-layout.hh" #include "hb-aat-layout-ankr-table.hh" #include "hb-aat-layout-bsln-table.hh" // Just so we compile it; unused otherwise. #include "hb-aat-layout-feat-table.hh" // Just so we compile it; unused otherwise. @@ -51,25 +49,12 @@ _get_morx (hb_face_t *face, hb_blob_t **blob = nullptr) *blob = hb_blob_get_empty (); return Null(AAT::morx); } - hb_ot_layout_t * layout = hb_ot_layout_from_face (face); - const AAT::morx& morx = *(layout->table.morx.get ()); + const AAT::morx& morx = *(hb_ot_face_data (face)->morx.get ()); if (blob) - *blob = layout->table.morx.get_blob (); + *blob = hb_ot_face_data (face)->morx.get_blob (); return morx; } -// static inline void -// _hb_aat_layout_create (hb_face_t *face) -// { -// hb_blob_t *morx_blob = hb_sanitize_context_t ().reference_table<AAT::morx> (face); -// morx_blob->as<AAT::morx> (); - -// if (0) -// { -// morx_blob->as<AAT::Lookup<OT::GlyphID> > ()->get_value (1, face->get_num_glyphs ()); -// } -// } - void hb_aat_layout_substitute (hb_font_t *font, hb_buffer_t *buffer) { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.hh index ce75c8e7192..ac9c535395a 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-layout.hh @@ -24,14 +24,14 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_AAT_LAYOUT_PRIVATE_HH -#define HB_AAT_LAYOUT_PRIVATE_HH +#ifndef HB_AAT_LAYOUT_HH +#define HB_AAT_LAYOUT_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-font-private.hh" -#include "hb-buffer-private.hh" -#include "hb-open-type-private.hh" +#include "hb-font.hh" +#include "hb-buffer.hh" +#include "hb-open-type.hh" HB_INTERNAL void @@ -40,4 +40,4 @@ hb_aat_layout_substitute (hb_font_t *font, hb_buffer_t *buffer); HB_INTERNAL void hb_aat_layout_position (hb_font_t *font, hb_buffer_t *buffer); -#endif /* HB_AAT_LAYOUT_PRIVATE_HH */ +#endif /* HB_AAT_LAYOUT_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-ltag-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-ltag-table.hh index 15c4e89cbe5..e308ab28c37 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-ltag-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-aat-ltag-table.hh @@ -25,7 +25,7 @@ #ifndef HB_AAT_LTAG_TABLE_HH #define HB_AAT_LTAG_TABLE_HH -#include "hb-aat-layout-common-private.hh" +#include "hb-aat-layout-common.hh" /* * ltag -- Language Tag diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-atomic-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-atomic.hh index 297c646986c..6e3672c18bc 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-atomic-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-atomic.hh @@ -29,10 +29,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_ATOMIC_PRIVATE_HH -#define HB_ATOMIC_PRIVATE_HH +#ifndef HB_ATOMIC_HH +#define HB_ATOMIC_HH -#include "hb-private.hh" +#include "hb.hh" /* @@ -98,7 +98,7 @@ static inline void _hb_memory_barrier (void) { #if !defined(MemoryBarrier) /* MinGW has a convoluted history of supporting MemoryBarrier. */ - long dummy = 0; + LONG dummy = 0; InterlockedExchange (&dummy, 1); #else MemoryBarrier (); @@ -106,7 +106,8 @@ static inline void _hb_memory_barrier (void) } #define _hb_memory_barrier() _hb_memory_barrier () -#define hb_atomic_int_impl_add(AI, V) InterlockedExchangeAdd ((unsigned *) (AI), (V)) +#define hb_atomic_int_impl_add(AI, V) InterlockedExchangeAdd ((LONG *) (AI), (V)) +static_assert ((sizeof (LONG) == sizeof (int)), ""); #define hb_atomic_ptr_impl_cmpexch(P,O,N) (InterlockedCompareExchangePointer ((void **) (P), (void *) (N), (void *) (O)) == (void *) (O)) @@ -278,4 +279,4 @@ struct hb_atomic_ptr_t }; -#endif /* HB_ATOMIC_PRIVATE_HH */ +#endif /* HB_ATOMIC_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob.cc index 25c3e05aad1..a335df308a5 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob.cc @@ -30,8 +30,8 @@ #define _POSIX_C_SOURCE 200809L #endif -#include "hb-private.hh" -#include "hb-blob-private.hh" +#include "hb.hh" +#include "hb-blob.hh" #ifdef HAVE_SYS_MMAN_H #ifdef HAVE_UNISTD_H diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob.hh index 49ad68ecec7..bee8c9794ad 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-blob.hh @@ -26,10 +26,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_BLOB_PRIVATE_HH -#define HB_BLOB_PRIVATE_HH +#ifndef HB_BLOB_HH +#define HB_BLOB_HH -#include "hb-private.hh" +#include "hb.hh" /* @@ -62,6 +62,10 @@ struct hb_blob_t { return unlikely (!data) ? &Null(Type) : reinterpret_cast<const Type *> (data); } + inline hb_bytes_t as_bytes (void) const + { + return hb_bytes_t (data, length); + } public: hb_object_header_t header; @@ -79,4 +83,4 @@ struct hb_blob_t DECLARE_NULL_INSTANCE (hb_blob_t); -#endif /* HB_BLOB_PRIVATE_HH */ +#endif /* HB_BLOB_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-json.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-json.hh index 380f3c5fca3..1f9e2e91db8 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-json.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-json.hh @@ -29,7 +29,7 @@ #ifndef HB_BUFFER_DESERIALIZE_JSON_HH #define HB_BUFFER_DESERIALIZE_JSON_HH -#include "hb-private.hh" +#include "hb.hh" #line 36 "hb-buffer-deserialize-json.hh" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-json.rl b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-json.rl index ec9bc7c9ae9..f3abb027b20 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-json.rl +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-json.rl @@ -27,7 +27,7 @@ #ifndef HB_BUFFER_DESERIALIZE_JSON_HH #define HB_BUFFER_DESERIALIZE_JSON_HH -#include "hb-private.hh" +#include "hb.hh" %%{ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text.hh index 5bca369f8d2..67f0a1252f8 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text.hh @@ -29,7 +29,7 @@ #ifndef HB_BUFFER_DESERIALIZE_TEXT_HH #define HB_BUFFER_DESERIALIZE_TEXT_HH -#include "hb-private.hh" +#include "hb.hh" #line 36 "hb-buffer-deserialize-text.hh" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text.rl b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text.rl index 1d90979a902..6268a6c5039 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text.rl +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-deserialize-text.rl @@ -27,7 +27,7 @@ #ifndef HB_BUFFER_DESERIALIZE_TEXT_HH #define HB_BUFFER_DESERIALIZE_TEXT_HH -#include "hb-private.hh" +#include "hb.hh" %%{ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-serialize.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-serialize.cc index 11471941de8..1b6d14731fd 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-serialize.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-serialize.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-buffer-private.hh" +#include "hb-buffer.hh" static const char *serialize_formats[] = { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc index eb7b01caafa..536ab5d5376 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.cc @@ -27,8 +27,8 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-buffer-private.hh" -#include "hb-utf-private.hh" +#include "hb-buffer.hh" +#include "hb-utf.hh" /** diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.hh index a6c4b696330..bcaf066c70b 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-buffer.hh @@ -27,11 +27,11 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_BUFFER_PRIVATE_HH -#define HB_BUFFER_PRIVATE_HH +#ifndef HB_BUFFER_HH +#define HB_BUFFER_HH -#include "hb-private.hh" -#include "hb-unicode-private.hh" +#include "hb.hh" +#include "hb-unicode.hh" #ifndef HB_BUFFER_MAX_LEN_FACTOR @@ -119,7 +119,7 @@ struct hb_buffer_t /* Text before / after the main buffer contents. * Always in Unicode, and ordered outward. * Index 0 is for "pre-context", 1 for "post-context". */ - static const unsigned int CONTEXT_LENGTH = 5; + enum { CONTEXT_LENGTH = 5 }; hb_codepoint_t context[2][CONTEXT_LENGTH]; unsigned int context_len[2]; @@ -386,4 +386,4 @@ _next_cluster (hb_buffer_t *buffer, unsigned int start) #define HB_BUFFER_ASSERT_VAR(b, var) HB_BUFFER_XALLOCATE_VAR (b, assert_var, var ()) -#endif /* HB_BUFFER_PRIVATE_HH */ +#endif /* HB_BUFFER_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.cc index 22dd52f49d8..ed3fed2a35c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-common.cc @@ -26,9 +26,9 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" -#include "hb-machinery-private.hh" +#include "hb-machinery.hh" #include <locale.h> #ifdef HAVE_XLOCALE_H @@ -731,8 +731,9 @@ parse_uint32 (const char **pp, const char *end, uint32_t *pv) #ifdef USE_XLOCALE - +#ifdef HB_USE_ATEXIT static void free_static_C_locale (void); +#endif static struct hb_C_locale_lazy_loader_t : hb_lazy_loader_t<hb_remove_ptr_t<HB_LOCALE_T>::value, hb_C_locale_lazy_loader_t> diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc index 1b916a53d34..a7ba85f8350 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-coretext.cc @@ -28,8 +28,8 @@ #define HB_SHAPER coretext -#include "hb-private.hh" -#include "hb-shaper-impl-private.hh" +#include "hb.hh" +#include "hb-shaper-impl.hh" #include "hb-coretext.h" #include <math.h> diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-debug.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-debug.hh index 9056ffca2b1..49663d215dc 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-debug.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-debug.hh @@ -27,8 +27,8 @@ #ifndef HB_DEBUG_HH #define HB_DEBUG_HH -#include "hb-private.hh" -#include "hb-atomic-private.hh" +#include "hb.hh" +#include "hb-atomic.hh" #include "hb-dsalgs.hh" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.cc index baad81884dc..35197c23865 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-directwrite.cc @@ -22,9 +22,9 @@ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ -#include "hb-private.hh" +#include "hb.hh" #define HB_SHAPER directwrite -#include "hb-shaper-impl-private.hh" +#include "hb-shaper-impl.hh" #include <DWrite_1.h> diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-dsalgs.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-dsalgs.hh index 8cbe6584b29..7e06ff17010 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-dsalgs.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-dsalgs.hh @@ -27,7 +27,7 @@ #ifndef HB_DSALGS_HH #define HB_DSALGS_HH -#include "hb-private.hh" +#include "hb.hh" /* Void! For when we need a expression-type of void. */ @@ -492,6 +492,15 @@ template <typename Type> struct hb_auto_t : Type { hb_auto_t (void) { Type::init (); } + /* Explicitly allow the following only for pointer and references, + * to avoid any accidental copies. + * + * Apparently if we template for all types, then gcc seems to + * capture a reference argument in the type, but clang doesn't, + * causing unwanted copies and bugs that come with it. Ideally + * we should use C++11-style rvalue reference &&t1. */ + template <typename T1> explicit hb_auto_t (T1 *t1) { Type::init (t1); } + template <typename T1> explicit hb_auto_t (T1 &t1) { Type::init (t1); } ~hb_auto_t (void) { Type::fini (); } private: /* Hide */ void init (void) {} @@ -502,6 +511,9 @@ struct hb_bytes_t { inline hb_bytes_t (void) : bytes (nullptr), len (0) {} inline hb_bytes_t (const char *bytes_, unsigned int len_) : bytes (bytes_), len (len_) {} + inline hb_bytes_t (const void *bytes_, unsigned int len_) : bytes ((const char *) bytes_), len (len_) {} + + inline void free (void) { ::free ((void *) bytes); bytes = nullptr; len = 0; } inline int cmp (const hb_bytes_t &a) const { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.cc index 49f29d3fa87..92c34152335 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.cc @@ -26,11 +26,13 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" -#include "hb-face-private.hh" -#include "hb-blob-private.hh" -#include "hb-open-file-private.hh" +#include "hb-face.hh" +#include "hb-blob.hh" +#include "hb-open-file.hh" +#include "hb-ot-face.hh" +#include "hb-ot-cmap-table.hh" /** @@ -512,3 +514,208 @@ hb_face_get_table_tags (const hb_face_t *face, return ot_face.get_table_tags (start_offset, table_count, table_tags); } + + +/* + * Character set. + */ + + +/** + * hb_face_collect_unicodes: + * @face: font face. + * @out: set to add Unicode characters covered by @face to. + * + * Since: 1.9.0 + */ +void +hb_face_collect_unicodes (hb_face_t *face, + hb_set_t *out) +{ + if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return; + hb_ot_face_data (face)->cmap->collect_unicodes (out); +} + +/** + * hb_face_collect_variation_selectors: + * @face: font face. + * @out: set to add Variation Selector characters covered by @face to. + * + * + * + * Since: 1.9.0 + */ +void +hb_face_collect_variation_selectors (hb_face_t *face, + hb_set_t *out) +{ + if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return; + hb_ot_face_data (face)->cmap->collect_variation_selectors (out); +} + +/** + * hb_face_collect_variation_unicodes: + * @face: font face. + * @out: set to add Unicode characters for @variation_selector covered by @face to. + * + * + * + * Since: 1.9.0 + */ +void +hb_face_collect_variation_unicodes (hb_face_t *face, + hb_codepoint_t variation_selector, + hb_set_t *out) +{ + if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return; + hb_ot_face_data (face)->cmap->collect_variation_unicodes (variation_selector, out); +} + + + +/* + * face-builder: A face that has add_table(). + */ + +struct hb_face_builder_data_t +{ + struct table_entry_t + { + inline int cmp (const hb_tag_t *t) const + { + if (*t < tag) return -1; + if (*t > tag) return -1; + return 0; + } + + hb_tag_t tag; + hb_blob_t *blob; + }; + + hb_vector_t<table_entry_t, 32> tables; +}; + +static hb_face_builder_data_t * +_hb_face_builder_data_create (void) +{ + hb_face_builder_data_t *data = (hb_face_builder_data_t *) calloc (1, sizeof (hb_face_builder_data_t)); + if (unlikely (!data)) + return nullptr; + + data->tables.init (); + + return data; +} + +static void +_hb_face_builder_data_destroy (void *user_data) +{ + hb_face_builder_data_t *data = (hb_face_builder_data_t *) user_data; + + for (unsigned int i = 0; i < data->tables.len; i++) + hb_blob_destroy (data->tables[i].blob); + + data->tables.fini (); + + free (data); +} + +static hb_blob_t * +_hb_face_builder_data_reference_blob (hb_face_builder_data_t *data) +{ + + unsigned int table_count = data->tables.len; + unsigned int face_length = table_count * 16 + 12; + + for (unsigned int i = 0; i < table_count; i++) + face_length += hb_ceil_to_4 (hb_blob_get_length (data->tables.arrayZ[i].blob)); + + char *buf = (char *) malloc (face_length); + if (unlikely (!buf)) + return nullptr; + + hb_serialize_context_t c (buf, face_length); + OT::OpenTypeFontFile *f = c.start_serialize<OT::OpenTypeFontFile> (); + + bool is_cff = data->tables.lsearch (HB_TAG ('C','F','F',' ')) || data->tables.lsearch (HB_TAG ('C','F','F','2')); + hb_tag_t sfnt_tag = is_cff ? OT::OpenTypeFontFile::CFFTag : OT::OpenTypeFontFile::TrueTypeTag; + + Supplier<hb_tag_t> tags_supplier (&data->tables[0].tag, table_count, sizeof (data->tables[0])); + Supplier<hb_blob_t *> blobs_supplier (&data->tables[0].blob, table_count, sizeof (data->tables[0])); + bool ret = f->serialize_single (&c, + sfnt_tag, + tags_supplier, + blobs_supplier, + table_count); + + c.end_serialize (); + + if (unlikely (!ret)) + { + free (buf); + return nullptr; + } + + return hb_blob_create (buf, face_length, HB_MEMORY_MODE_WRITABLE, buf, free); +} + +static hb_blob_t * +_hb_face_builder_reference_table (hb_face_t *face, hb_tag_t tag, void *user_data) +{ + hb_face_builder_data_t *data = (hb_face_builder_data_t *) user_data; + + if (!tag) + return _hb_face_builder_data_reference_blob (data); + + hb_face_builder_data_t::table_entry_t *entry = data->tables.lsearch (tag); + if (entry) + return hb_blob_reference (entry->blob); + + return nullptr; +} + + +/** + * hb_face_builder_create: + * + * Creates a #hb_face_t that can be used with hb_face_builder_add_table(). + * After tables are added to the face, it can be compiled to a binary + * font file by calling hb_face_reference_blob(). + * + * Return value: (transfer full) New face. + * + * Since: 1.9.0 + **/ +hb_face_t * +hb_face_builder_create (void) +{ + hb_face_builder_data_t *data = _hb_face_builder_data_create (); + if (unlikely (!data)) return hb_face_get_empty (); + + return hb_face_create_for_tables (_hb_face_builder_reference_table, + data, + _hb_face_builder_data_destroy); +} + +/** + * hb_face_builder_add_table: + * + * Add table for @tag with data provided by @blob to the face. @face must + * be created using hb_face_builder_create(). + * + * Since: 1.9.0 + **/ +hb_bool_t +hb_face_builder_add_table (hb_face_t *face, hb_tag_t tag, hb_blob_t *blob) +{ + if (unlikely (face->destroy != (hb_destroy_func_t) _hb_face_builder_data_destroy)) + return false; + + hb_face_builder_data_t *data = (hb_face_builder_data_t *) face->user_data; + hb_face_builder_data_t::table_entry_t *entry = data->tables.push (); + + entry->tag = tag; + entry->blob = hb_blob_reference (blob); + + return true; +} diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.h b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.h index 208092efc28..e8ff090d55f 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.h +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.h @@ -33,6 +33,7 @@ #include "hb-common.h" #include "hb-blob.h" +#include "hb-set.h" HB_BEGIN_DECLS @@ -120,6 +121,38 @@ hb_face_get_table_tags (const hb_face_t *face, unsigned int *table_count, /* IN/OUT */ hb_tag_t *table_tags /* OUT */); + +/* + * Character set. + */ + +HB_EXTERN void +hb_face_collect_unicodes (hb_face_t *face, + hb_set_t *out); + +HB_EXTERN void +hb_face_collect_variation_selectors (hb_face_t *face, + hb_set_t *out); + +HB_EXTERN void +hb_face_collect_variation_unicodes (hb_face_t *face, + hb_codepoint_t variation_selector, + hb_set_t *out); + + +/* + * Builder face. + */ + +HB_EXTERN hb_face_t * +hb_face_builder_create (void); + +HB_EXTERN hb_bool_t +hb_face_builder_add_table (hb_face_t *face, + hb_tag_t tag, + hb_blob_t *blob); + + HB_END_DECLS #endif /* HB_FACE_H */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.hh index 086ce6e96d1..f90453dbd1f 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-face.hh @@ -26,13 +26,13 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_FACE_PRIVATE_HH -#define HB_FACE_PRIVATE_HH +#ifndef HB_FACE_HH +#define HB_FACE_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-shaper-private.hh" -#include "hb-shape-plan-private.hh" +#include "hb-shaper.hh" +#include "hb-shape-plan.hh" /* @@ -105,4 +105,4 @@ DECLARE_NULL_INSTANCE (hb_face_t); #undef HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS -#endif /* HB_FACE_PRIVATE_HH */ +#endif /* HB_FACE_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-fallback-shape.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-fallback-shape.cc index eff20f70c77..dc8536c8281 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-fallback-shape.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-fallback-shape.cc @@ -25,7 +25,7 @@ */ #define HB_SHAPER fallback -#include "hb-shaper-impl-private.hh" +#include "hb-shaper-impl.hh" HB_SHAPER_DATA_ENSURE_DEFINE(fallback, face) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc index 857b8f57734..bc831dd53f2 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.cc @@ -26,10 +26,10 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" -#include "hb-font-private.hh" -#include "hb-machinery-private.hh" +#include "hb-font.hh" +#include "hb-machinery.hh" /* diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.hh index d3a41380258..4c8d0aeec03 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-font.hh @@ -26,13 +26,13 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_FONT_PRIVATE_HH -#define HB_FONT_PRIVATE_HH +#ifndef HB_FONT_HH +#define HB_FONT_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-face-private.hh" -#include "hb-shaper-private.hh" +#include "hb-face.hh" +#include "hb-shaper.hh" /* @@ -601,4 +601,4 @@ DECLARE_NULL_INSTANCE (hb_font_t); #undef HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS -#endif /* HB_FONT_PRIVATE_HH */ +#endif /* HB_FONT_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc index 01341b604a1..5d6abb29d16 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ft.cc @@ -27,12 +27,12 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" #include "hb-ft.h" -#include "hb-font-private.hh" -#include "hb-machinery-private.hh" +#include "hb-font.hh" +#include "hb-machinery.hh" #include FT_ADVANCES_H #include FT_MULTIPLE_MASTERS_H @@ -417,7 +417,9 @@ hb_ft_get_font_h_extents (hb_font_t *font HB_UNUSED, return true; } +#ifdef HB_USE_ATEXIT static void free_static_ft_funcs (void); +#endif static struct hb_ft_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t<hb_ft_font_funcs_lazy_loader_t> { @@ -682,8 +684,9 @@ hb_ft_font_create_referenced (FT_Face ft_face) return hb_ft_font_create (ft_face, _hb_ft_face_destroy); } - +#ifdef HB_USE_ATEXIT static void free_static_ft_library (void); +#endif static struct hb_ft_library_lazy_loader_t : hb_lazy_loader_t<hb_remove_ptr_t<FT_Library>::value, hb_ft_library_lazy_loader_t> diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-glib.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-glib.cc index 809b22f6b46..18f3a81db64 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-glib.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-glib.cc @@ -26,12 +26,12 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" #include "hb-glib.h" -#include "hb-unicode-private.hh" -#include "hb-machinery-private.hh" +#include "hb-unicode.hh" +#include "hb-machinery.hh" #if !GLIB_CHECK_VERSION(2,29,14) @@ -366,8 +366,9 @@ hb_glib_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs HB_UNUSED, } - +#ifdef HB_USE_ATEXIT static void free_static_glib_funcs (void); +#endif static struct hb_glib_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader_t<hb_glib_unicode_funcs_lazy_loader_t> { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gobject-enums.cc.tmpl b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gobject-enums.cc.tmpl index ca458a3846c..e056df47891 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gobject-enums.cc.tmpl +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gobject-enums.cc.tmpl @@ -25,7 +25,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" /* g++ didn't like older gtype.h gcc-only code path. */ #include <glib.h> diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gobject-structs.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gobject-structs.cc index 0c8e55733eb..1b87585832e 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gobject-structs.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-gobject-structs.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" /* g++ didn't like older gtype.h gcc-only code path. */ #include <glib.h> diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-graphite2.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-graphite2.cc index 1f42a36f35a..817278f309b 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-graphite2.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-graphite2.cc @@ -27,7 +27,7 @@ */ #define HB_SHAPER graphite2 -#include "hb-shaper-impl-private.hh" +#include "hb-shaper-impl.hh" #include "hb-graphite2.h" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-icu.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-icu.cc index 2e3ad367544..564f71fe2dc 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-icu.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-icu.cc @@ -27,12 +27,12 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" #include "hb-icu.h" -#include "hb-unicode-private.hh" -#include "hb-machinery-private.hh" +#include "hb-unicode.hh" +#include "hb-machinery.hh" #include <unicode/uchar.h> #include <unicode/unorm2.h> @@ -343,8 +343,9 @@ hb_icu_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs HB_UNUSED, return utf32_len; } - +#ifdef HB_USE_ATEXIT static void free_static_icu_funcs (void); +#endif static struct hb_icu_unicode_funcs_lazy_loader_t : hb_unicode_funcs_lazy_loader_t<hb_icu_unicode_funcs_lazy_loader_t> { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-iter-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-iter.hh index 314133ade70..6fd6aed79a7 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-iter-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-iter.hh @@ -24,10 +24,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_ITER_PRIVATE_HH -#define HB_ITER_PRIVATE_HH +#ifndef HB_ITER_HH +#define HB_ITER_HH -#include "hb-private.hh" +#include "hb.hh" /* Unified iterator object. @@ -146,4 +146,4 @@ m (void) } } -#endif /* HB_ITER_PRIVATE_HH */ +#endif /* HB_ITER_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-machinery-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-machinery.hh index 99ef485a307..62f49072113 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-machinery-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-machinery.hh @@ -26,13 +26,14 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_MACHINERY_PRIVATE_HH -#define HB_MACHINERY_PRIVATE_HH +#ifndef HB_MACHINERY_HH +#define HB_MACHINERY_HH -#include "hb-private.hh" -#include "hb-blob-private.hh" +#include "hb.hh" +#include "hb-blob.hh" -#include "hb-iter-private.hh" +#include "hb-iter.hh" +#include "hb-vector.hh" /* @@ -98,8 +99,8 @@ static inline Type& StructAfter(TObject &X) #define DEFINE_SIZE_STATIC(size) \ DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size)); \ - static const unsigned int static_size = (size); \ - static const unsigned int min_size = (size); \ + enum { static_size = (size) }; \ + enum { min_size = (size) }; \ inline unsigned int get_size (void) const { return (size); } #define DEFINE_SIZE_UNION(size, _member) \ @@ -111,9 +112,13 @@ static inline Type& StructAfter(TObject &X) static const unsigned int min_size = (size) #define DEFINE_SIZE_ARRAY(size, array) \ - DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + sizeof (array[0])); \ + DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + VAR * sizeof (array[0])); \ DEFINE_COMPILES_ASSERTION ((void) array[0].static_size) \ - static const unsigned int min_size = (size) + enum { min_size = (size) }; \ + +#define DEFINE_SIZE_ARRAY_SIZED(size, array) \ + DEFINE_SIZE_ARRAY(size, array); \ + inline unsigned int get_size (void) const { return (size - array[0].min_size + array.get_size ()); } #define DEFINE_SIZE_ARRAY2(size, array1, array2) \ DEFINE_INSTANCE_ASSERTION (sizeof (*this) == (size) + sizeof (this->array1[0]) + sizeof (this->array2[0])); \ @@ -128,7 +133,7 @@ static inline Type& StructAfter(TObject &X) template <typename Context, typename Return, unsigned int MaxDebugDepth> struct hb_dispatch_context_t { - static const unsigned int max_debug_depth = MaxDebugDepth; + enum { max_debug_depth = MaxDebugDepth }; typedef Return return_t; template <typename T, typename F> inline bool may_dispatch (const T *obj, const F *format) { return true; } @@ -138,6 +143,68 @@ struct hb_dispatch_context_t /* * Sanitize + * + * + * === Introduction === + * + * The sanitize machinery is at the core of our zero-cost font loading. We + * mmap() font file into memory and create a blob out of it. Font subtables + * are returned as a readonly sub-blob of the main font blob. These table + * blobs are then sanitized before use, to ensure invalid memory access does + * not happen. The toplevel sanitize API use is like, eg. to load the 'head' + * table: + * + * hb_blob_t *head_blob = hb_sanitize_context_t ().reference_table<OT::head> (face); + * + * The blob then can be converted to a head table struct with: + * + * const head *head_table = head_blob->as<head> (); + * + * What the reference_table does is, to call hb_face_reference_table() to load + * the table blob, sanitize it and return either the sanitized blob, or empty + * blob if sanitization failed. The blob->as() function returns the null + * object of its template type argument if the blob is empty. Otherwise, it + * just casts the blob contents to the desired type. + * + * Sanitizing a blob of data with a type T works as follows (with minor + * simplification): + * + * - Cast blob content to T*, call sanitize() method of it, + * - If sanitize succeeded, return blob. + * - Otherwise, if blob is not writable, try making it writable, + * or copy if cannot be made writable in-place, + * - Call sanitize() again. Return blob if sanitize succeeded. + * - Return empty blob otherwise. + * + * + * === The sanitize() contract === + * + * The sanitize() method of each object type shall return true if it's safe to + * call other methods of the object, and false otherwise. + * + * Note that what sanitize() checks for might align with what the specification + * describes as valid table data, but does not have to be. In particular, we + * do NOT want to be pedantic and concern ourselves with validity checks that + * are irrelevant to our use of the table. On the contrary, we want to be + * lenient with error handling and accept invalid data to the extent that it + * does not impose extra burden on us. + * + * Based on the sanitize contract, one can see that what we check for depends + * on how we use the data in other table methods. Ie. if other table methods + * assume that offsets do NOT point out of the table data block, then that's + * something sanitize() must check for (GSUB/GPOS/GDEF/etc work this way). On + * the other hand, if other methods do such checks themselves, then sanitize() + * does not have to bother with them (glyf/local work this way). The choice + * depends on the table structure and sanitize() performance. For example, to + * check glyf/loca offsets in sanitize() would cost O(num-glyphs). We try hard + * to avoid such costs during font loading. By postponing such checks to the + * actual glyph loading, we reduce the sanitize cost to O(1) and total runtime + * cost to O(used-glyphs). As such, this is preferred. + * + * The same argument can be made re GSUB/GPOS/GDEF, but there, the table + * structure is so complicated that by checking all offsets at sanitize() time, + * we make the code much simpler in other methods, as offsets and referenced + * objectes do not need to be validated at each use site. */ /* This limits sanitizing time on really broken fonts. */ @@ -375,12 +442,19 @@ struct hb_serialize_context_t { this->start = (char *) start_; this->end = this->start + size; + reset (); + } + inline void reset (void) + { this->ran_out_of_room = false; this->head = this->start; this->debug_depth = 0; } + inline bool err (bool e) { return this->ran_out_of_room = this->ran_out_of_room || e; } + + /* To be called around main operation. */ template <typename Type> inline Type *start_serialize (void) { @@ -391,7 +465,6 @@ struct hb_serialize_context_t return start_embed<Type> (); } - inline void end_serialize (void) { DEBUG_MSG_LEVEL (SERIALIZE, this->start, 0, -1, @@ -401,15 +474,20 @@ struct hb_serialize_context_t this->ran_out_of_room ? "RAN OUT OF ROOM" : "did not ran out of room"); } + inline unsigned int length (void) const { return this->head - this->start; } + + inline void align (unsigned int alignment) + { + unsigned int l = length () % alignment; + if (l) + allocate_size<void> (alignment - l); + } + template <typename Type> - inline Type *copy (void) + inline Type *start_embed (void) const { - assert (!this->ran_out_of_room); - unsigned int len = this->head - this->start; - void *p = malloc (len); - if (p) - memcpy (p, this->start, len); - return reinterpret_cast<Type *> (p); + Type *ret = reinterpret_cast<Type *> (this->head); + return ret; } template <typename Type> @@ -432,19 +510,12 @@ struct hb_serialize_context_t } template <typename Type> - inline Type *start_embed (void) - { - Type *ret = reinterpret_cast<Type *> (this->head); - return ret; - } - - template <typename Type> inline Type *embed (const Type &obj) { unsigned int size = obj.get_size (); Type *ret = this->allocate_size<Type> (size); if (unlikely (!ret)) return nullptr; - memcpy (ret, obj, size); + memcpy (ret, &obj, size); return ret; } @@ -466,6 +537,38 @@ struct hb_serialize_context_t return reinterpret_cast<Type *> (&obj); } + /* Output routines. */ + template <typename Type> + inline Type *copy (void) const + { + assert (!this->ran_out_of_room); + unsigned int len = this->head - this->start; + void *p = malloc (len); + if (p) + memcpy (p, this->start, len); + return reinterpret_cast<Type *> (p); + } + inline hb_bytes_t copy_bytes (void) const + { + assert (!this->ran_out_of_room); + unsigned int len = this->head - this->start; + void *p = malloc (len); + if (p) + memcpy (p, this->start, len); + else + return hb_bytes_t (); + return hb_bytes_t (p, len); + } + inline hb_blob_t *copy_blob (void) const + { + assert (!this->ran_out_of_room); + return hb_blob_create (this->start, + this->head - this->start, + HB_MEMORY_MODE_DUPLICATE, + nullptr, nullptr); + } + + public: unsigned int debug_depth; char *start, *end, *head; bool ran_out_of_room; @@ -479,12 +582,19 @@ struct hb_serialize_context_t template <typename Type> struct Supplier { - inline Supplier (const Type *array, unsigned int len_, unsigned int stride_=sizeof(Type)) + inline Supplier (const Type *array, unsigned int len_, unsigned int stride_=sizeof (Type)) { head = array; len = len_; stride = stride_; } + inline Supplier (const hb_vector_t<Type> *v) + { + head = v->arrayZ; + len = v->len; + stride = sizeof (Type); + } + inline const Type operator [] (unsigned int i) const { if (unlikely (i >= len)) return Type (); @@ -682,6 +792,10 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData> } return p; } + inline Stored * get_stored_relaxed (void) const + { + return this->instance.get_relaxed (); + } inline void set_stored (Stored *instance_) { @@ -695,6 +809,7 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData> } inline const Returned * get (void) const { return Funcs::convert (get_stored ()); } + inline const Returned * get_relaxed (void) const { return Funcs::convert (get_stored_relaxed ()); } inline Returned * get_unconst (void) const { return const_cast<Returned *> (Funcs::convert (get_stored ())); } /* To be possibly overloaded by subclasses. */ @@ -729,9 +844,9 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData> /* Specializations. */ -template <unsigned int WheresFace, typename T> +template <typename T, unsigned int WheresFace> struct hb_face_lazy_loader_t : hb_lazy_loader_t<T, - hb_face_lazy_loader_t<WheresFace, T>, + hb_face_lazy_loader_t<T, WheresFace>, hb_face_t, WheresFace> {}; template <typename T, unsigned int WheresFace> @@ -789,4 +904,4 @@ struct hb_unicode_funcs_lazy_loader_t : hb_lazy_loader_t<hb_unicode_funcs_t, Sub }; -#endif /* HB_MACHINERY_PRIVATE_HH */ +#endif /* HB_MACHINERY_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-map.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-map.cc index 138a85612fc..225f37bc678 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-map.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-map.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-map-private.hh" +#include "hb-map.hh" /* Public API */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-map-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-map.hh index 00f089e8151..21898a7a677 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-map-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-map.hh @@ -24,10 +24,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_MAP_PRIVATE_HH -#define HB_MAP_PRIVATE_HH +#ifndef HB_MAP_HH +#define HB_MAP_HH -#include "hb-private.hh" +#include "hb.hh" template <typename T> @@ -251,4 +251,4 @@ struct hb_map_t }; -#endif /* HB_MAP_PRIVATE_HH */ +#endif /* HB_MAP_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-mutex-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-mutex.hh index 14bde3103e1..d8cdf4b64ac 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-mutex-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-mutex.hh @@ -29,10 +29,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_MUTEX_PRIVATE_HH -#define HB_MUTEX_PRIVATE_HH +#ifndef HB_MUTEX_HH +#define HB_MUTEX_HH -#include "hb-private.hh" +#include "hb.hh" /* mutex */ @@ -138,4 +138,4 @@ struct hb_mutex_t }; -#endif /* HB_MUTEX_PRIVATE_HH */ +#endif /* HB_MUTEX_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-null.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-null.hh index 91efee6443d..7128f0a94f3 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-null.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-null.hh @@ -27,7 +27,7 @@ #ifndef HB_NULL_HH #define HB_NULL_HH -#include "hb-private.hh" +#include "hb.hh" /* @@ -51,27 +51,40 @@ static inline Type const & Null (void) { /* Specializaitons for arbitrary-content Null objects expressed in bytes. */ #define DECLARE_NULL_NAMESPACE_BYTES(Namespace, Type) \ -} /* Close namespace. */ \ -extern HB_INTERNAL const unsigned char _hb_Null_##Namespace##_##Type[Namespace::Type::min_size]; \ -template <> \ -/*static*/ inline const Namespace::Type& Null<Namespace::Type> (void) { \ - return *reinterpret_cast<const Namespace::Type *> (_hb_Null_##Namespace##_##Type); \ -} \ -namespace Namespace { \ -static_assert (true, "Just so we take semicolon after.") + } /* Close namespace. */ \ + extern HB_INTERNAL const unsigned char _hb_Null_##Namespace##_##Type[Namespace::Type::min_size]; \ + template <> \ + /*static*/ inline const Namespace::Type& Null<Namespace::Type> (void) { \ + return *reinterpret_cast<const Namespace::Type *> (_hb_Null_##Namespace##_##Type); \ + } \ + namespace Namespace { \ + static_assert (true, "Just so we take semicolon after.") #define DEFINE_NULL_NAMESPACE_BYTES(Namespace, Type) \ -const unsigned char _hb_Null_##Namespace##_##Type[Namespace::Type::min_size] + const unsigned char _hb_Null_##Namespace##_##Type[Namespace::Type::min_size] /* Specializaitons for arbitrary-content Null objects expressed as struct initializer. */ #define DECLARE_NULL_INSTANCE(Type) \ -extern HB_INTERNAL const Type _hb_Null_##Type; \ -template <> \ -/*static*/ inline const Type& Null<Type> (void) { \ - return _hb_Null_##Type; \ -} \ + extern HB_INTERNAL const Type _hb_Null_##Type; \ + template <> \ + /*static*/ inline const Type& Null<Type> (void) { \ + return _hb_Null_##Type; \ + } \ static_assert (true, "Just so we take semicolon after.") #define DEFINE_NULL_INSTANCE(Type) \ -const Type _hb_Null_##Type + const Type _hb_Null_##Type + +/* Specializaiton to disallow Null objects. */ +#define DECLARE_NULL_DISALLOW(Type) \ + template <> inline const Type& Null<Type> (void) +#define DECLARE_NULL_NAMSPACE_DISALLOW(Namespace, Type) \ + } /* Close namespace. */ \ + template <> \ + /*static*/ inline const Namespace::Type& Null<Namespace::Type> (void) { \ + extern void *_hb_undefined; \ + return *reinterpret_cast<const Namespace::Type *> (_hb_undefined); \ + } \ + namespace Namespace { \ + static_assert (true, "Just so we take semicolon after.") /* Global writable pool. Enlarge as necessary. */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object.hh index 4955a68dc3c..ca85af691d9 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-object.hh @@ -29,13 +29,13 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OBJECT_PRIVATE_HH -#define HB_OBJECT_PRIVATE_HH +#ifndef HB_OBJECT_HH +#define HB_OBJECT_HH -#include "hb-private.hh" -#include "hb-atomic-private.hh" -#include "hb-mutex-private.hh" -#include "hb-vector-private.hh" +#include "hb.hh" +#include "hb-atomic.hh" +#include "hb-mutex.hh" +#include "hb-vector.hh" /* @@ -322,4 +322,4 @@ static inline void *hb_object_get_user_data (Type *obj, } -#endif /* HB_OBJECT_PRIVATE_HH */ +#endif /* HB_OBJECT_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-file-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-file.hh index d47bff66e78..d3b748602ba 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-file-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-file.hh @@ -26,10 +26,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OPEN_FILE_PRIVATE_HH -#define HB_OPEN_FILE_PRIVATE_HH +#ifndef HB_OPEN_FILE_HH +#define HB_OPEN_FILE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" #include "hb-ot-head-table.hh" @@ -115,7 +115,7 @@ typedef struct OffsetTable * table list. */ int i = tables.len < 64 ? tables.lsearch (t) : tables.bsearch (t); if (table_index) - *table_index = i == -1 ? Index::NOT_FOUND_INDEX : (unsigned int) i; + *table_index = i == -1 ? (unsigned) Index::NOT_FOUND_INDEX : (unsigned) i; return i != -1; } inline const TableRecord& get_table_by_tag (hb_tag_t tag) const @@ -161,8 +161,7 @@ typedef struct OffsetTable memcpy (start, hb_blob_get_data (blob, nullptr), rec.length); /* 4-byte allignment. */ - if (rec.length % 4) - c->allocate_size<void> (4 - rec.length % 4); + c->align (4); const char *end = (const char *) c->head; if (tags[i] == HB_OT_TAG_head && end - start >= head::static_size) @@ -565,4 +564,4 @@ struct OpenTypeFontFile } /* namespace OT */ -#endif /* HB_OPEN_FILE_PRIVATE_HH */ +#endif /* HB_OPEN_FILE_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type.hh index 5580565f118..ef18163fa56 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-open-type.hh @@ -26,13 +26,14 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OPEN_TYPE_PRIVATE_HH -#define HB_OPEN_TYPE_PRIVATE_HH +#ifndef HB_OPEN_TYPE_HH +#define HB_OPEN_TYPE_HH -#include "hb-private.hh" -#include "hb-blob-private.hh" -#include "hb-face-private.hh" -#include "hb-machinery-private.hh" +#include "hb.hh" +#include "hb-blob.hh" +#include "hb-face.hh" +#include "hb-machinery.hh" +#include "hb-subset.hh" namespace OT { @@ -149,7 +150,7 @@ typedef HBUINT16 NameID; /* Script/language-system/feature index */ struct Index : HBUINT16 { - static const unsigned int NOT_FOUND_INDEX = 0xFFFFu; + enum { NOT_FOUND_INDEX = 0xFFFFu }; }; DECLARE_NULL_NAMESPACE_BYTES (OT, Index); @@ -246,6 +247,19 @@ struct OffsetTo : Offset<OffsetType> return * (Type *) Offset<OffsetType>::serialize (c, base); } + template <typename T> + inline void serialize_subset (hb_subset_context_t *c, const T &src, const void *base) + { + if (&src == &Null(T)) + { + this->set (0); + return; + } + serialize (c->serializer, base); + if (!src.subset (c)) + this->set (0); + } + inline bool sanitize (hb_sanitize_context_t *c, const void *base) const { TRACE_SANITIZE (this); @@ -404,7 +418,6 @@ struct ArrayOf if (unlikely (!c->extend (*this))) return_trace (false); return_trace (true); } - inline bool serialize (hb_serialize_context_t *c, Supplier<Type> &items, unsigned int items_len) @@ -505,6 +518,17 @@ struct OffsetListOf : OffsetArrayOf<Type> return this+this->arrayZ[i]; } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + struct OffsetListOf<Type> *out = c->serializer->embed (*this); + if (unlikely (!out)) return_trace (false); + unsigned int count = this->len; + for (unsigned int i = 0; i < count; i++) + out->arrayZ[i].serialize_subset (c, (*this)[i], out); + return_trace (true); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -646,4 +670,4 @@ struct BinSearchArrayOf : SortedArrayOf<Type, BinSearchHeader> {}; } /* namespace OT */ -#endif /* HB_OPEN_TYPE_PRIVATE_HH */ +#endif /* HB_OPEN_TYPE_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh index 67a9c7dd96b..e6876d12cf6 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-cmap-table.hh @@ -27,9 +27,8 @@ #ifndef HB_OT_CMAP_TABLE_HH #define HB_OT_CMAP_TABLE_HH -#include "hb-open-type-private.hh" -#include "hb-set-private.hh" -#include "hb-subset-plan.hh" +#include "hb-open-type.hh" +#include "hb-set.hh" /* * cmap -- Character to Glyph Index Mapping @@ -37,10 +36,6 @@ */ #define HB_OT_TAG_cmap HB_TAG('c','m','a','p') -#ifndef HB_MAX_UNICODE_CODEPOINT_VALUE -#define HB_MAX_UNICODE_CODEPOINT_VALUE 0x10FFFF -#endif - namespace OT { @@ -54,6 +49,12 @@ struct CmapSubtableFormat0 *glyph = gid; return true; } + inline void collect_unicodes (hb_set_t *out) const + { + for (unsigned int i = 0; i < 256; i++) + if (glyphIdArray[i]) + out->add (i); + } inline bool sanitize (hb_sanitize_context_t *c) const { @@ -237,15 +238,14 @@ struct CmapSubtableFormat4 glyphIdArray = idRangeOffset + segCount; glyphIdArrayLength = (subtable->length - 16 - 8 * segCount) / 2; } + inline void fini (void) {} - static inline bool get_glyph_func (const void *obj, hb_codepoint_t codepoint, hb_codepoint_t *glyph) + inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const { - const accelerator_t *thiz = (const accelerator_t *) obj; - /* Custom two-array bsearch. */ - int min = 0, max = (int) thiz->segCount - 1; - const HBUINT16 *startCount = thiz->startCount; - const HBUINT16 *endCount = thiz->endCount; + int min = 0, max = (int) this->segCount - 1; + const HBUINT16 *startCount = this->startCount; + const HBUINT16 *endCount = this->endCount; unsigned int i; while (min <= max) { @@ -264,33 +264,55 @@ struct CmapSubtableFormat4 found: hb_codepoint_t gid; - unsigned int rangeOffset = thiz->idRangeOffset[i]; + unsigned int rangeOffset = this->idRangeOffset[i]; if (rangeOffset == 0) - gid = codepoint + thiz->idDelta[i]; + gid = codepoint + this->idDelta[i]; else { /* Somebody has been smoking... */ - unsigned int index = rangeOffset / 2 + (codepoint - thiz->startCount[i]) + i - thiz->segCount; - if (unlikely (index >= thiz->glyphIdArrayLength)) + unsigned int index = rangeOffset / 2 + (codepoint - this->startCount[i]) + i - this->segCount; + if (unlikely (index >= this->glyphIdArrayLength)) return false; - gid = thiz->glyphIdArray[index]; + gid = this->glyphIdArray[index]; if (unlikely (!gid)) return false; - gid += thiz->idDelta[i]; + gid += this->idDelta[i]; } - - *glyph = gid & 0xFFFFu; + gid &= 0xFFFFu; + if (!gid) + return false; + *glyph = gid; return true; } - - static inline void get_all_codepoints_func (const void *obj, hb_set_t *out) + static inline bool get_glyph_func (const void *obj, hb_codepoint_t codepoint, hb_codepoint_t *glyph) { - const accelerator_t *thiz = (const accelerator_t *) obj; - for (unsigned int i = 0; i < thiz->segCount; i++) + return ((const accelerator_t *) obj)->get_glyph (codepoint, glyph); + } + inline void collect_unicodes (hb_set_t *out) const + { + unsigned int count = this->segCount; + if (count && this->startCount[count - 1] == 0xFFFFu) + count--; /* Skip sentinel segment. */ + for (unsigned int i = 0; i < count; i++) { - if (thiz->startCount[i] != 0xFFFFu - || thiz->endCount[i] != 0xFFFFu) // Skip the last segment (0xFFFF) - hb_set_add_range (out, thiz->startCount[i], thiz->endCount[i]); + unsigned int rangeOffset = this->idRangeOffset[i]; + if (rangeOffset == 0) + out->add_range (this->startCount[i], this->endCount[i]); + else + { + for (hb_codepoint_t codepoint = this->startCount[i]; + codepoint <= this->endCount[i]; + codepoint++) + { + unsigned int index = rangeOffset / 2 + (codepoint - this->startCount[i]) + i - this->segCount; + if (unlikely (index >= this->glyphIdArrayLength)) + break; + hb_codepoint_t gid = this->glyphIdArray[index]; + if (unlikely (!gid)) + continue; + out->add (codepoint); + } + } } } @@ -305,10 +327,14 @@ struct CmapSubtableFormat4 inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const { - accelerator_t accel; - accel.init (this); + hb_auto_t<accelerator_t> accel (this); return accel.get_glyph_func (&accel, codepoint, glyph); } + inline void collect_unicodes (hb_set_t *out) const + { + hb_auto_t<accelerator_t> accel (this); + accel.collect_unicodes (out); + } inline bool sanitize (hb_sanitize_context_t *c) const { @@ -383,7 +409,7 @@ struct CmapSubtableLongGroup HBUINT32 startCharCode; /* First character code in this group. */ HBUINT32 endCharCode; /* Last character code in this group. */ HBUINT32 glyphID; /* Glyph index; interpretation depends on - * subtable format. */ + * subtable format. */ public: DEFINE_SIZE_STATIC (12); }; @@ -400,6 +426,14 @@ struct CmapSubtableTrimmed *glyph = gid; return true; } + inline void collect_unicodes (hb_set_t *out) const + { + hb_codepoint_t start = startCharCode; + unsigned int count = glyphIdArray.len; + for (unsigned int i = 0; i < count; i++) + if (glyphIdArray[i]) + out->add (start + i); + } inline bool sanitize (hb_sanitize_context_t *c) const { @@ -432,18 +466,19 @@ struct CmapSubtableLongSegmented int i = groups.bsearch (codepoint); if (i == -1) return false; - *glyph = T::group_get_glyph (groups[i], codepoint); + hb_codepoint_t gid = T::group_get_glyph (groups[i], codepoint); + if (!gid) + return false; + *glyph = gid; return true; } - inline void get_all_codepoints (hb_set_t *out) const + inline void collect_unicodes (hb_set_t *out) const { for (unsigned int i = 0; i < this->groups.len; i++) { - hb_set_add_range (out, - MIN ((unsigned int) this->groups[i].startCharCode, - (unsigned int) HB_MAX_UNICODE_CODEPOINT_VALUE), - MIN ((unsigned int) this->groups[i].endCharCode, - (unsigned int) HB_MAX_UNICODE_CODEPOINT_VALUE)); + out->add_range (this->groups[i].startCharCode, + MIN ((hb_codepoint_t) this->groups[i].endCharCode, + (hb_codepoint_t) HB_UNICODE_MAX)); } } @@ -574,13 +609,29 @@ struct UnicodeValueRange } HBUINT24 startUnicodeValue; /* First value in this range. */ - HBUINT8 additionalCount; /* Number of additional values in this + HBUINT8 additionalCount; /* Number of additional values in this * range. */ public: DEFINE_SIZE_STATIC (4); }; -typedef SortedArrayOf<UnicodeValueRange, HBUINT32> DefaultUVS; +struct DefaultUVS : SortedArrayOf<UnicodeValueRange, HBUINT32> +{ + inline void collect_unicodes (hb_set_t *out) const + { + unsigned int count = len; + for (unsigned int i = 0; i < count; i++) + { + hb_codepoint_t first = arrayZ[i].startUnicodeValue; + hb_codepoint_t last = MIN ((hb_codepoint_t) (first + arrayZ[i].additionalCount), + (hb_codepoint_t) HB_UNICODE_MAX); + out->add_range (first, last); + } + } + + public: + DEFINE_SIZE_ARRAY (4, arrayZ); +}; struct UVSMapping { @@ -601,7 +652,18 @@ struct UVSMapping DEFINE_SIZE_STATIC (5); }; -typedef SortedArrayOf<UVSMapping, HBUINT32> NonDefaultUVS; +struct NonDefaultUVS : SortedArrayOf<UVSMapping, HBUINT32> +{ + inline void collect_unicodes (hb_set_t *out) const + { + unsigned int count = len; + for (unsigned int i = 0; i < count; i++) + out->add (arrayZ[i].glyphID); + } + + public: + DEFINE_SIZE_ARRAY (4, arrayZ); +}; struct VariationSelectorRecord { @@ -616,7 +678,7 @@ struct VariationSelectorRecord return GLYPH_VARIANT_USE_DEFAULT; const NonDefaultUVS &nonDefaults = base+nonDefaultUVS; i = nonDefaults.bsearch (codepoint); - if (i != -1) + if (i != -1 && nonDefaults[i].glyphID) { *glyph = nonDefaults[i].glyphID; return GLYPH_VARIANT_FOUND; @@ -624,6 +686,12 @@ struct VariationSelectorRecord return GLYPH_VARIANT_NOT_FOUND; } + inline void collect_unicodes (hb_set_t *out, const void *base) const + { + (base+defaultUVS).collect_unicodes (out); + (base+nonDefaultUVS).collect_unicodes (out); + } + inline int cmp (const hb_codepoint_t &variation_selector) const { return varSelector.cmp (variation_selector); @@ -652,7 +720,19 @@ struct CmapSubtableFormat14 hb_codepoint_t variation_selector, hb_codepoint_t *glyph) const { - return record[record.bsearch(variation_selector)].get_glyph (codepoint, glyph, this); + return record[record.bsearch (variation_selector)].get_glyph (codepoint, glyph, this); + } + + inline void collect_variation_selectors (hb_set_t *out) const + { + unsigned int count = record.len; + for (unsigned int i = 0; i < count; i++) + out->add (record.arrayZ[i].varSelector); + } + inline void collect_variation_unicodes (hb_codepoint_t variation_selector, + hb_set_t *out) const + { + record[record.bsearch (variation_selector)].collect_unicodes (out, this); } inline bool sanitize (hb_sanitize_context_t *c) const @@ -690,6 +770,19 @@ struct CmapSubtable default: return false; } } + inline void collect_unicodes (hb_set_t *out) const + { + switch (u.format) { + case 0: u.format0 .collect_unicodes (out); return; + case 4: u.format4 .collect_unicodes (out); return; + case 6: u.format6 .collect_unicodes (out); return; + case 10: u.format10.collect_unicodes (out); return; + case 12: u.format12.collect_unicodes (out); return; + case 13: u.format13.collect_unicodes (out); return; + case 14: + default: return; + } + } inline bool sanitize (hb_sanitize_context_t *c) const { @@ -754,7 +847,8 @@ struct cmap { static const hb_tag_t tableTag = HB_OT_TAG_cmap; - struct subset_plan { + struct subset_plan + { subset_plan(void) { format4_segments.init(); @@ -895,33 +989,44 @@ struct cmap return result; } + const CmapSubtable *find_best_subtable (bool *symbol = nullptr) const + { + if (symbol) *symbol = false; + + const CmapSubtable *subtable; + + /* 32-bit subtables. */ + if ((subtable = this->find_subtable (3, 10))) return subtable; + if ((subtable = this->find_subtable (0, 6))) return subtable; + if ((subtable = this->find_subtable (0, 4))) return subtable; + + /* 16-bit subtables. */ + if ((subtable = this->find_subtable (3, 1))) return subtable; + if ((subtable = this->find_subtable (0, 3))) return subtable; + if ((subtable = this->find_subtable (0, 2))) return subtable; + if ((subtable = this->find_subtable (0, 1))) return subtable; + if ((subtable = this->find_subtable (0, 0))) return subtable; + + /* Symbol subtable. */ + if ((subtable = this->find_subtable (3, 0))) + { + if (symbol) *symbol = true; + return subtable; + } + + /* Meh. */ + return &Null(CmapSubtable); + } + struct accelerator_t { inline void init (hb_face_t *face) { this->blob = hb_sanitize_context_t().reference_table<cmap> (face); const cmap *table = this->blob->as<cmap> (); - const CmapSubtable *subtable = nullptr; const CmapSubtableFormat14 *subtable_uvs = nullptr; - - bool symbol = false; - /* 32-bit subtables. */ - if (!subtable) subtable = table->find_subtable (3, 10); - if (!subtable) subtable = table->find_subtable (0, 6); - if (!subtable) subtable = table->find_subtable (0, 4); - /* 16-bit subtables. */ - if (!subtable) subtable = table->find_subtable (3, 1); - if (!subtable) subtable = table->find_subtable (0, 3); - if (!subtable) subtable = table->find_subtable (0, 2); - if (!subtable) subtable = table->find_subtable (0, 1); - if (!subtable) subtable = table->find_subtable (0, 0); - if (!subtable) - { - subtable = table->find_subtable (3, 0); - if (subtable) symbol = true; - } - /* Meh. */ - if (!subtable) subtable = &Null(CmapSubtable); + bool symbol; + subtable = table->find_best_subtable (&symbol); /* UVS subtable. */ if (!subtable_uvs) @@ -933,30 +1038,26 @@ struct cmap /* Meh. */ if (!subtable_uvs) subtable_uvs = &Null(CmapSubtableFormat14); - this->uvs_table = subtable_uvs; + this->subtable_uvs = subtable_uvs; this->get_glyph_data = subtable; if (unlikely (symbol)) { this->get_glyph_func = get_glyph_from_symbol<CmapSubtable>; - this->get_all_codepoints_func = null_get_all_codepoints_func; } else { switch (subtable->u.format) { /* Accelerate format 4 and format 12. */ default: this->get_glyph_func = get_glyph_from<CmapSubtable>; - this->get_all_codepoints_func = null_get_all_codepoints_func; break; case 12: this->get_glyph_func = get_glyph_from<CmapSubtableFormat12>; - this->get_all_codepoints_func = get_all_codepoints_from<CmapSubtableFormat12>; break; case 4: { this->format4_accel.init (&subtable->u.format4); this->get_glyph_data = &this->format4_accel; this->get_glyph_func = this->format4_accel.get_glyph_func; - this->get_all_codepoints_func = this->format4_accel.get_all_codepoints_func; } break; } @@ -978,9 +1079,9 @@ struct cmap hb_codepoint_t variation_selector, hb_codepoint_t *glyph) const { - switch (this->uvs_table->get_glyph_variant (unicode, - variation_selector, - glyph)) + switch (this->subtable_uvs->get_glyph_variant (unicode, + variation_selector, + glyph)) { case GLYPH_VARIANT_NOT_FOUND: return false; case GLYPH_VARIANT_FOUND: return true; @@ -990,22 +1091,24 @@ struct cmap return get_nominal_glyph (unicode, glyph); } - inline void get_all_codepoints (hb_set_t *out) const + inline void collect_unicodes (hb_set_t *out) const + { + subtable->collect_unicodes (out); + } + inline void collect_variation_selectors (hb_set_t *out) const + { + subtable_uvs->collect_variation_selectors (out); + } + inline void collect_variation_unicodes (hb_codepoint_t variation_selector, + hb_set_t *out) const { - this->get_all_codepoints_func (get_glyph_data, out); + subtable_uvs->collect_variation_unicodes (variation_selector, out); } protected: typedef bool (*hb_cmap_get_glyph_func_t) (const void *obj, hb_codepoint_t codepoint, hb_codepoint_t *glyph); - typedef void (*hb_cmap_get_all_codepoints_func_t) (const void *obj, - hb_set_t *out); - - static inline void null_get_all_codepoints_func (const void *obj, hb_set_t *out) - { - // NOOP - } template <typename Type> static inline bool get_glyph_from (const void *obj, @@ -1017,14 +1120,6 @@ struct cmap } template <typename Type> - static inline void get_all_codepoints_from (const void *obj, - hb_set_t *out) - { - const Type *typed_obj = (const Type *) obj; - typed_obj->get_all_codepoints (out); - } - - template <typename Type> static inline bool get_glyph_from_symbol (const void *obj, hb_codepoint_t codepoint, hb_codepoint_t *glyph) @@ -1047,13 +1142,14 @@ struct cmap } private: + const CmapSubtable *subtable; + const CmapSubtableFormat14 *subtable_uvs; + hb_cmap_get_glyph_func_t get_glyph_func; const void *get_glyph_data; - hb_cmap_get_all_codepoints_func_t get_all_codepoints_func; CmapSubtableFormat4::accelerator_t format4_accel; - const CmapSubtableFormat14 *uvs_table; hb_blob_t *blob; }; @@ -1066,10 +1162,7 @@ struct cmap key.platformID.set (platform_id); key.encodingID.set (encoding_id); - /* Note: We can use bsearch, but since it has no performance - * implications, we use lsearch and as such accept fonts with - * unsorted subtable list. */ - int result = encodingRecord./*bsearch*/lsearch (key); + int result = encodingRecord.bsearch (key); if (result == -1 || !encodingRecord[result].subtable) return nullptr; @@ -1084,6 +1177,7 @@ struct cmap DEFINE_SIZE_ARRAY (4, encodingRecord); }; +struct cmap_accelerator_t : cmap::accelerator_t {}; } /* namespace OT */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cbdt-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cbdt-table.hh index 21c2f477366..8bedf2224a0 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cbdt-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cbdt-table.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_COLOR_CBDT_TABLE_HH #define HB_OT_COLOR_CBDT_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" /* * CBLC -- Color Bitmap Location @@ -533,6 +533,8 @@ struct CBDT DEFINE_SIZE_ARRAY(4, dataZ); }; +struct CBDT_accelerator_t : CBDT::accelerator_t {}; + } /* namespace OT */ #endif /* HB_OT_COLOR_CBDT_TABLE_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-colr-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-colr-table.hh index ce6702d2ad3..070226f18e2 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-colr-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-colr-table.hh @@ -25,7 +25,7 @@ #ifndef HB_OT_COLOR_COLR_TABLE_HH #define HB_OT_COLOR_COLR_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" /* * COLR -- Color diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cpal-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cpal-table.hh index 2c312748d3b..2c9fced093e 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cpal-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-cpal-table.hh @@ -28,7 +28,7 @@ #ifndef HB_OT_COLOR_CPAL_TABLE_HH #define HB_OT_COLOR_CPAL_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" /* diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-sbix-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-sbix-table.hh index 0461afa3298..1b643c77a59 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-sbix-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-sbix-table.hh @@ -25,7 +25,7 @@ #ifndef HB_OT_COLOR_SBIX_TABLE_HH #define HB_OT_COLOR_SBIX_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" /* * sbix -- Standard Bitmap Graphics diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-svg-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-svg-table.hh index 3976694f844..ad9162f7c7d 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-svg-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color-svg-table.hh @@ -25,7 +25,7 @@ #ifndef HB_OT_COLOR_SVG_TABLE_HH #define HB_OT_COLOR_SVG_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" /* * SVG -- SVG (Scalable Vector Graphics) diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color.cc index 86171c63353..7cdff380ef2 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-color.cc @@ -25,7 +25,7 @@ * Google Author(s): Sascha Brawer */ -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" #include "hb-ot-color-colr-table.hh" #include "hb-ot-color-cpal-table.hh" #include "hb-ot.h" @@ -33,8 +33,8 @@ #include <stdlib.h> #include <string.h> -#include "hb-ot-layout-private.hh" -#include "hb-shaper-private.hh" +#include "hb-ot-layout.hh" +#include "hb-shaper.hh" #if 0 HB_MARK_AS_FLAG_T (hb_ot_color_palette_flags_t) @@ -45,16 +45,14 @@ static inline const OT::COLR& _get_colr (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::COLR); - hb_ot_layout_t * layout = hb_ot_layout_from_face (face); - return *(layout->colr.get ()); + return *(hb_ot_face_data (face)->colr.get ()); } static inline const OT::CPAL& _get_cpal (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::CPAL); - hb_ot_layout_t * layout = hb_ot_layout_from_face (face); - return *(layout->cpal.get ()); + return *(hb_ot_face_data (face)->cpal.get ()); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-face.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-face.cc new file mode 100644 index 00000000000..388a5972058 --- /dev/null +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-face.cc @@ -0,0 +1,76 @@ +/* + * Copyright © 2018 Google, Inc. + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Google Author(s): Behdad Esfahbod + */ + +#include "hb-ot-face.hh" + +#include "hb-ot-cmap-table.hh" +#include "hb-ot-glyf-table.hh" +#include "hb-ot-hmtx-table.hh" +#include "hb-ot-kern-table.hh" +#include "hb-ot-post-table.hh" +#include "hb-ot-color-cbdt-table.hh" +#include "hb-ot-layout-gdef-table.hh" +#include "hb-ot-layout-gsub-table.hh" +#include "hb-ot-layout-gpos-table.hh" + + +void hb_ot_face_data_t::init0 (hb_face_t *face) +{ + this->face = face; +#define HB_OT_LAYOUT_TABLE(Namespace, Type) Type.init0 (); +#define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) HB_OT_LAYOUT_TABLE (Namespace, Type) + HB_OT_LAYOUT_TABLES +#undef HB_OT_LAYOUT_ACCELERATOR +#undef HB_OT_LAYOUT_TABLE +} +void hb_ot_face_data_t::fini (void) +{ +#define HB_OT_LAYOUT_TABLE(Namespace, Type) Type.fini (); +#define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) HB_OT_LAYOUT_TABLE (Namespace, Type) + HB_OT_LAYOUT_TABLES +#undef HB_OT_LAYOUT_ACCELERATOR +#undef HB_OT_LAYOUT_TABLE +} + +hb_ot_face_data_t * +_hb_ot_face_data_create (hb_face_t *face) +{ + hb_ot_face_data_t *data = (hb_ot_face_data_t *) calloc (1, sizeof (hb_ot_face_data_t)); + if (unlikely (!data)) + return nullptr; + + data->init0 (face); + + return data; +} + +void +_hb_ot_face_data_destroy (hb_ot_face_data_t *data) +{ + data->fini (); + free (data); +} + diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-face.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-face.hh new file mode 100644 index 00000000000..5ac3538e44d --- /dev/null +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-face.hh @@ -0,0 +1,116 @@ +/* + * Copyright © 2007,2008,2009 Red Hat, Inc. + * Copyright © 2012,2013 Google, Inc. + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Red Hat Author(s): Behdad Esfahbod + * Google Author(s): Behdad Esfahbod + */ + +#ifndef HB_OT_FACE_HH +#define HB_OT_FACE_HH + +#include "hb.hh" + +#include "hb-machinery.hh" + + +#define hb_ot_face_data(face) ((hb_ot_face_data_t *) face->shaper_data.ot.get_relaxed ()) + + +/* + * hb_ot_face_data_t + */ + +/* Most of these tables are NOT needed for shaping. But we need to hook them *somewhere*. + * This is as good as any place. */ +#define HB_OT_LAYOUT_TABLES \ + /* OpenType shaping. */ \ + HB_OT_LAYOUT_TABLE(OT, JSTF) \ + HB_OT_LAYOUT_TABLE(OT, BASE) \ + /* AAT shaping. */ \ + HB_OT_LAYOUT_TABLE(AAT, morx) \ + HB_OT_LAYOUT_TABLE(AAT, kerx) \ + HB_OT_LAYOUT_TABLE(AAT, ankr) \ + HB_OT_LAYOUT_TABLE(AAT, trak) \ + /* OpenType variations. */ \ + HB_OT_LAYOUT_TABLE(OT, fvar) \ + HB_OT_LAYOUT_TABLE(OT, avar) \ + HB_OT_LAYOUT_TABLE(OT, MVAR) \ + /* OpenType math. */ \ + HB_OT_LAYOUT_TABLE(OT, MATH) \ + /* OpenType fundamentals. */ \ + HB_OT_LAYOUT_ACCELERATOR(OT, GDEF) \ + HB_OT_LAYOUT_ACCELERATOR(OT, GSUB) \ + HB_OT_LAYOUT_ACCELERATOR(OT, GPOS) \ + HB_OT_LAYOUT_ACCELERATOR(OT, cmap) \ + HB_OT_LAYOUT_ACCELERATOR(OT, hmtx) \ + HB_OT_LAYOUT_ACCELERATOR(OT, vmtx) \ + HB_OT_LAYOUT_ACCELERATOR(OT, post) \ + HB_OT_LAYOUT_ACCELERATOR(OT, kern) \ + HB_OT_LAYOUT_ACCELERATOR(OT, glyf) \ + HB_OT_LAYOUT_ACCELERATOR(OT, CBDT) \ + /* */ + +/* Declare tables. */ +#define HB_OT_LAYOUT_TABLE(Namespace, Type) namespace Namespace { struct Type; } +#define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) HB_OT_LAYOUT_TABLE (Namespace, Type##_accelerator_t) +HB_OT_LAYOUT_TABLES +#undef HB_OT_LAYOUT_ACCELERATOR +#undef HB_OT_LAYOUT_TABLE + +struct hb_ot_face_data_t +{ + HB_INTERNAL void init0 (hb_face_t *face); + HB_INTERNAL void fini (void); + +#define HB_OT_LAYOUT_TABLE_ORDER(Namespace, Type) \ + HB_PASTE (ORDER_, HB_PASTE (Namespace, HB_PASTE (_, Type))) + enum order_t + { + ORDER_ZERO, +#define HB_OT_LAYOUT_TABLE(Namespace, Type) HB_OT_LAYOUT_TABLE_ORDER (Namespace, Type), +#define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) HB_OT_LAYOUT_TABLE (Namespace, Type) + HB_OT_LAYOUT_TABLES +#undef HB_OT_LAYOUT_ACCELERATOR +#undef HB_OT_LAYOUT_TABLE + }; + + hb_face_t *face; /* MUST be JUST before the lazy loaders. */ +#define HB_OT_LAYOUT_TABLE(Namespace, Type) \ + hb_table_lazy_loader_t<Namespace::Type, HB_OT_LAYOUT_TABLE_ORDER (Namespace, Type)> Type; +#define HB_OT_LAYOUT_ACCELERATOR(Namespace, Type) \ + hb_face_lazy_loader_t<Namespace::Type##_accelerator_t, HB_OT_LAYOUT_TABLE_ORDER (Namespace, Type)> Type; + HB_OT_LAYOUT_TABLES +#undef HB_OT_LAYOUT_ACCELERATOR +#undef HB_OT_LAYOUT_TABLE +}; + + +HB_INTERNAL hb_ot_face_data_t * +_hb_ot_face_data_create (hb_face_t *face); + +HB_INTERNAL void +_hb_ot_face_data_destroy (hb_ot_face_data_t *data); + + +#endif /* HB_OT_FACE_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-font.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-font.cc index 9da8fc7d497..a4c5584fbd9 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-font.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-font.cc @@ -24,84 +24,22 @@ * Google Author(s): Behdad Esfahbod, Roozbeh Pournader */ -#include "hb-private.hh" +#include "hb.hh" #include "hb-ot.h" -#include "hb-font-private.hh" -#include "hb-machinery-private.hh" +#include "hb-font.hh" +#include "hb-machinery.hh" +#include "hb-ot-face.hh" #include "hb-ot-cmap-table.hh" -#include "hb-ot-glyf-table.hh" #include "hb-ot-hmtx-table.hh" #include "hb-ot-kern-table.hh" #include "hb-ot-post-table.hh" - +#include "hb-ot-glyf-table.hh" #include "hb-ot-color-cbdt-table.hh" -struct hb_ot_font_t -{ - inline void init (hb_face_t *face) - { - cmap.init (face); - h_metrics.init (face); - v_metrics.init (face, h_metrics.ascender - h_metrics.descender); /* TODO Can we do this lazily? */ - - this->face = face; - glyf.init (); - cbdt.init (); - post.init (); - kern.init (); - } - inline void fini (void) - { - cmap.fini (); - h_metrics.fini (); - v_metrics.fini (); - - glyf.fini (); - cbdt.fini (); - post.fini (); - kern.fini (); - } - - OT::cmap::accelerator_t cmap; - OT::hmtx::accelerator_t h_metrics; - OT::vmtx::accelerator_t v_metrics; - - hb_face_t *face; /* MUST be JUST before the lazy loaders. */ - hb_face_lazy_loader_t<1, OT::glyf::accelerator_t> glyf; - hb_face_lazy_loader_t<2, OT::CBDT::accelerator_t> cbdt; - hb_face_lazy_loader_t<3, OT::post::accelerator_t> post; - hb_face_lazy_loader_t<4, OT::kern::accelerator_t> kern; -}; - - -static hb_ot_font_t * -_hb_ot_font_create (hb_face_t *face) -{ - hb_ot_font_t *ot_font = (hb_ot_font_t *) calloc (1, sizeof (hb_ot_font_t)); - - if (unlikely (!ot_font)) - return nullptr; - - ot_font->init (face); - - return ot_font; -} - -static void -_hb_ot_font_destroy (void *data) -{ - hb_ot_font_t *ot_font = (hb_ot_font_t *) data; - - ot_font->fini (); - - free (ot_font); -} - - static hb_bool_t hb_ot_get_nominal_glyph (hb_font_t *font HB_UNUSED, void *font_data, @@ -110,8 +48,8 @@ hb_ot_get_nominal_glyph (hb_font_t *font HB_UNUSED, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; - return ot_font->cmap.get_nominal_glyph (unicode, glyph); + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; + return ot_font->cmap.get_relaxed()->get_nominal_glyph (unicode, glyph); } static hb_bool_t @@ -122,8 +60,8 @@ hb_ot_get_variation_glyph (hb_font_t *font HB_UNUSED, hb_codepoint_t *glyph, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; - return ot_font->cmap.get_variation_glyph (unicode, variation_selector, glyph); + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; + return ot_font->cmap.get_relaxed ()->get_variation_glyph (unicode, variation_selector, glyph); } static hb_position_t @@ -132,8 +70,8 @@ hb_ot_get_glyph_h_advance (hb_font_t *font, hb_codepoint_t glyph, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; - return font->em_scale_x (ot_font->h_metrics.get_advance (glyph, font)); + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; + return font->em_scale_x (ot_font->hmtx.get_relaxed ()->get_advance (glyph, font)); } static hb_position_t @@ -142,8 +80,8 @@ hb_ot_get_glyph_v_advance (hb_font_t *font, hb_codepoint_t glyph, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; - return font->em_scale_y (-(int) ot_font->v_metrics.get_advance (glyph, font)); + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; + return font->em_scale_y (-(int) ot_font->vmtx.get_relaxed ()->get_advance (glyph, font)); } static hb_position_t @@ -153,7 +91,7 @@ hb_ot_get_glyph_h_kerning (hb_font_t *font, hb_codepoint_t right_glyph, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; return font->em_scale_x (ot_font->kern->get_h_kerning (left_glyph, right_glyph)); } @@ -164,10 +102,10 @@ hb_ot_get_glyph_extents (hb_font_t *font, hb_glyph_extents_t *extents, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; bool ret = ot_font->glyf->get_extents (glyph, extents); if (!ret) - ret = ot_font->cbdt->get_extents (glyph, extents); + ret = ot_font->CBDT->get_extents (glyph, extents); // TODO Hook up side-bearings variations. extents->x_bearing = font->em_scale_x (extents->x_bearing); extents->y_bearing = font->em_scale_y (extents->y_bearing); @@ -183,7 +121,7 @@ hb_ot_get_glyph_name (hb_font_t *font HB_UNUSED, char *name, unsigned int size, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; return ot_font->post->get_glyph_name (glyph, name, size); } @@ -194,7 +132,7 @@ hb_ot_get_glyph_from_name (hb_font_t *font HB_UNUSED, hb_codepoint_t *glyph, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; return ot_font->post->get_glyph_from_name (name, len, glyph); } @@ -204,12 +142,12 @@ hb_ot_get_font_h_extents (hb_font_t *font, hb_font_extents_t *metrics, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; - metrics->ascender = font->em_scale_y (ot_font->h_metrics.ascender); - metrics->descender = font->em_scale_y (ot_font->h_metrics.descender); - metrics->line_gap = font->em_scale_y (ot_font->h_metrics.line_gap); + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; + metrics->ascender = font->em_scale_y (ot_font->hmtx.get_relaxed ()->ascender); + metrics->descender = font->em_scale_y (ot_font->hmtx.get_relaxed ()->descender); + metrics->line_gap = font->em_scale_y (ot_font->hmtx.get_relaxed ()->line_gap); // TODO Hook up variations. - return ot_font->h_metrics.has_font_extents; + return ot_font->hmtx.get_relaxed ()->has_font_extents; } static hb_bool_t @@ -218,16 +156,17 @@ hb_ot_get_font_v_extents (hb_font_t *font, hb_font_extents_t *metrics, void *user_data HB_UNUSED) { - const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data; - metrics->ascender = font->em_scale_x (ot_font->v_metrics.ascender); - metrics->descender = font->em_scale_x (ot_font->v_metrics.descender); - metrics->line_gap = font->em_scale_x (ot_font->v_metrics.line_gap); + const hb_ot_face_data_t *ot_font = (const hb_ot_face_data_t *) font_data; + metrics->ascender = font->em_scale_x (ot_font->vmtx.get_relaxed ()->ascender); + metrics->descender = font->em_scale_x (ot_font->vmtx.get_relaxed ()->descender); + metrics->line_gap = font->em_scale_x (ot_font->vmtx.get_relaxed ()->line_gap); // TODO Hook up variations. - return ot_font->v_metrics.has_font_extents; + return ot_font->vmtx.get_relaxed ()->has_font_extents; } - +#ifdef HB_USE_ATEXIT static void free_static_ot_funcs (void); +#endif static struct hb_ot_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t<hb_ot_font_funcs_lazy_loader_t> { @@ -283,12 +222,16 @@ _hb_ot_get_font_funcs (void) void hb_ot_font_set_funcs (hb_font_t *font) { - hb_ot_font_t *ot_font = _hb_ot_font_create (font->face); - if (unlikely (!ot_font)) - return; + if (unlikely (!hb_ot_shaper_face_data_ensure (font->face))) return; + hb_ot_face_data_t *ot_font = hb_ot_face_data (font->face); + + /* Load them lazies. We access them with get_relaxed() for performance. */ + ot_font->cmap.get (); + ot_font->hmtx.get (); + ot_font->vmtx.get (); hb_font_set_funcs (font, _hb_ot_get_font_funcs (), ot_font, - _hb_ot_font_destroy); + nullptr); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-glyf-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-glyf-table.hh index bcf89e46247..7c20983603f 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-glyf-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-glyf-table.hh @@ -27,11 +27,9 @@ #ifndef HB_OT_GLYF_TABLE_HH #define HB_OT_GLYF_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" #include "hb-ot-head-table.hh" #include "hb-subset-glyf.hh" -#include "hb-subset-plan.hh" -#include "hb-subset-private.hh" namespace OT { @@ -490,6 +488,8 @@ struct glyf DEFINE_SIZE_ARRAY (0, dataZ); }; +struct glyf_accelerator_t : glyf::accelerator_t {}; + } /* namespace OT */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hdmx-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hdmx-table.hh index 0951871ce97..87dd6d01822 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hdmx-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hdmx-table.hh @@ -27,8 +27,7 @@ #ifndef HB_OT_HDMX_TABLE_HH #define HB_OT_HDMX_TABLE_HH -#include "hb-open-type-private.hh" -#include "hb-subset-plan.hh" +#include "hb-open-type.hh" /* * hdmx -- Horizontal Device Metrics @@ -89,8 +88,13 @@ struct DeviceRecord { TRACE_SERIALIZE (this); - if (unlikely (!c->allocate_size<DeviceRecord> (get_size (subset_view.len())))) + unsigned int size = get_size (subset_view.len()); + if (unlikely (!c->allocate_size<DeviceRecord> (size))) + { + DEBUG_MSG (SUBSET, nullptr, "Couldn't allocate enough space for DeviceRecord: %d.", + size); return_trace (false); + } this->pixel_size.set (subset_view.source_device_record->pixel_size); this->max_width.set (subset_view.source_device_record->max_width); @@ -161,14 +165,14 @@ struct hdmx return_trace (true); } - static inline size_t get_subsetted_size (hb_subset_plan_t *plan) + static inline size_t get_subsetted_size (const hdmx *source_hdmx, hb_subset_plan_t *plan) { - return min_size + DeviceRecord::get_size (plan->glyphs.len); + return min_size + source_hdmx->num_records * DeviceRecord::get_size (plan->glyphs.len); } inline bool subset (hb_subset_plan_t *plan) const { - size_t dest_size = get_subsetted_size (plan); + size_t dest_size = get_subsetted_size (this, plan); hdmx *dest = (hdmx *) malloc (dest_size); if (unlikely (!dest)) { @@ -178,8 +182,10 @@ struct hdmx hb_serialize_context_t c (dest, dest_size); hdmx *hdmx_prime = c.start_serialize<hdmx> (); - if (!hdmx_prime || !hdmx_prime->serialize (&c, this, plan)) { + if (!hdmx_prime || !hdmx_prime->serialize (&c, this, plan)) + { free (dest); + DEBUG_MSG(SUBSET, nullptr, "Failed to serialize write new hdmx."); return false; } c.end_serialize (); diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-head-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-head-table.hh index fded120be28..602e365ce5d 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-head-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-head-table.hh @@ -29,7 +29,7 @@ #ifndef HB_OT_HEAD_TABLE_HH #define HB_OT_HEAD_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" /* * head -- Font Header diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hhea-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hhea-table.hh index efb42b61616..3336cadd472 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hhea-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hhea-table.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_HHEA_TABLE_HH #define HB_OT_HHEA_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" /* * hhea -- Horizontal Header diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh index 13fa9d6e092..3e4b3bdef5c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-hmtx-table.hh @@ -27,11 +27,10 @@ #ifndef HB_OT_HMTX_TABLE_HH #define HB_OT_HMTX_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" #include "hb-ot-hhea-table.hh" #include "hb-ot-os2-table.hh" #include "hb-ot-var-hvar-table.hh" -#include "hb-subset-plan.hh" /* * hmtx -- Horizontal Metrics @@ -332,6 +331,9 @@ struct vmtx : hmtxvmtx<vmtx, vhea> { static const hb_tag_t os2Tag = HB_TAG_NONE; }; +struct hmtx_accelerator_t : hmtx::accelerator_t {}; +struct vmtx_accelerator_t : vmtx::accelerator_t {}; + } /* namespace OT */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-kern-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-kern-table.hh index b4d81095282..40f94be296f 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-kern-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-kern-table.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_KERN_TABLE_HH #define HB_OT_KERN_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" /* * kern -- Kerning @@ -390,6 +390,8 @@ struct kern DEFINE_SIZE_UNION (2, major); }; +struct kern_accelerator_t : kern::accelerator_t {}; + } /* namespace OT */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-base-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-base-table.hh index 96da07fb5cd..449e74550e9 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-base-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-base-table.hh @@ -28,8 +28,8 @@ #ifndef HB_OT_LAYOUT_BASE_TABLE_HH #define HB_OT_LAYOUT_BASE_TABLE_HH -#include "hb-open-type-private.hh" -#include "hb-ot-layout-common-private.hh" +#include "hb-open-type.hh" +#include "hb-ot-layout-common.hh" namespace OT { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common.hh index 89d5eae494f..dd65f338494 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-common.hh @@ -26,13 +26,13 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OT_LAYOUT_COMMON_PRIVATE_HH -#define HB_OT_LAYOUT_COMMON_PRIVATE_HH +#ifndef HB_OT_LAYOUT_COMMON_HH +#define HB_OT_LAYOUT_COMMON_HH -#include "hb-private.hh" -#include "hb-ot-layout-private.hh" -#include "hb-open-type-private.hh" -#include "hb-set-private.hh" +#include "hb.hh" +#include "hb-ot-layout.hh" +#include "hb-open-type.hh" +#include "hb-set.hh" #ifndef HB_MAX_NESTING_LEVEL @@ -97,15 +97,14 @@ struct Record }; template <typename Type> -struct RecordArrayOf : SortedArrayOf<Record<Type> > { +struct RecordArrayOf : SortedArrayOf<Record<Type> > +{ + inline const OffsetTo<Type>& get_offset (unsigned int i) const + { return (*this)[i].offset; } + inline OffsetTo<Type>& get_offset (unsigned int i) + { return (*this)[i].offset; } inline const Tag& get_tag (unsigned int i) const - { - /* We cheat slightly and don't define separate Null objects - * for Record types. Instead, we return the correct Null(Tag) - * here. */ - if (unlikely (i >= this->len)) return Null(Tag); - return (*this)[i].tag; - } + { return (*this)[i].tag; } inline unsigned int get_tags (unsigned int start_offset, unsigned int *record_count /* IN/OUT */, hb_tag_t *record_tags /* OUT */) const @@ -136,7 +135,18 @@ template <typename Type> struct RecordListOf : RecordArrayOf<Type> { inline const Type& operator [] (unsigned int i) const - { return this+RecordArrayOf<Type>::operator [](i).offset; } + { return this+this->get_offset (i); } + + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + struct RecordListOf<Type> *out = c->serializer->embed (*this); + if (unlikely (!out)) return_trace (false); + unsigned int count = this->len; + for (unsigned int i = 0; i < count; i++) + out->get_offset (i).serialize_subset (c, (*this)[i], out); + return_trace (true); + } inline bool sanitize (hb_sanitize_context_t *c) const { @@ -158,9 +168,8 @@ struct RangeRecord return_trace (c->check_struct (this)); } - inline bool intersects (const hb_set_t *glyphs) const { - return glyphs->intersects (start, end); - } + inline bool intersects (const hb_set_t *glyphs) const + { return glyphs->intersects (start, end); } template <typename set_t> inline bool add_coverage (set_t *glyphs) const { @@ -224,6 +233,12 @@ struct LangSys return reqFeatureIndex;; } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + return_trace (c->serializer->embed (*this)); + } + inline bool sanitize (hb_sanitize_context_t *c, const Record<LangSys>::sanitize_closure_t * = nullptr) const { @@ -238,7 +253,7 @@ struct LangSys * = 0xFFFFu */ IndexArray featureIndex; /* Array of indices into the FeatureList */ public: - DEFINE_SIZE_ARRAY (6, featureIndex); + DEFINE_SIZE_ARRAY_SIZED (6, featureIndex); }; DECLARE_NULL_NAMESPACE_BYTES (OT, LangSys); @@ -263,6 +278,18 @@ struct Script inline bool has_default_lang_sys (void) const { return defaultLangSys != 0; } inline const LangSys& get_default_lang_sys (void) const { return this+defaultLangSys; } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + struct Script *out = c->serializer->embed (*this); + if (unlikely (!out)) return_trace (false); + out->defaultLangSys.serialize_subset (c, this+defaultLangSys, out); + unsigned int count = langSys.len; + for (unsigned int i = 0; i < count; i++) + out->langSys.arrayZ[i].offset.serialize_subset (c, this+langSys[i].offset, out); + return_trace (true); + } + inline bool sanitize (hb_sanitize_context_t *c, const Record<Script>::sanitize_closure_t * = nullptr) const { @@ -278,7 +305,7 @@ struct Script langSys; /* Array of LangSysRecords--listed * alphabetically by LangSysTag */ public: - DEFINE_SIZE_ARRAY (4, langSys); + DEFINE_SIZE_ARRAY_SIZED (4, langSys); }; typedef RecordListOf<Script> ScriptList; @@ -516,6 +543,15 @@ struct Feature inline const FeatureParams &get_feature_params (void) const { return this+featureParams; } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + struct Feature *out = c->serializer->embed (*this); + if (unlikely (!out)) return_trace (false); + out->featureParams.set (0); /* TODO(subset) FeatureParams. */ + return_trace (true); + } + inline bool sanitize (hb_sanitize_context_t *c, const Record<Feature>::sanitize_closure_t *closure = nullptr) const { @@ -567,7 +603,7 @@ struct Feature * if not required */ IndexArray lookupIndex; /* Array of LookupList indices */ public: - DEFINE_SIZE_ARRAY (4, lookupIndex); + DEFINE_SIZE_ARRAY_SIZED (4, lookupIndex); }; typedef RecordListOf<Feature> FeatureList; @@ -598,16 +634,16 @@ struct Lookup { inline unsigned int get_subtable_count (void) const { return subTable.len; } - template <typename SubTableType> - inline const SubTableType& get_subtable (unsigned int i) const - { return this+CastR<OffsetArrayOf<SubTableType> > (subTable)[i]; } + template <typename TSubTable> + inline const TSubTable& get_subtable (unsigned int i) const + { return this+CastR<OffsetArrayOf<TSubTable> > (subTable)[i]; } - template <typename SubTableType> - inline const OffsetArrayOf<SubTableType>& get_subtables (void) const - { return CastR<OffsetArrayOf<SubTableType> > (subTable); } - template <typename SubTableType> - inline OffsetArrayOf<SubTableType>& get_subtables (void) - { return CastR<OffsetArrayOf<SubTableType> > (subTable); } + template <typename TSubTable> + inline const OffsetArrayOf<TSubTable>& get_subtables (void) const + { return CastR<OffsetArrayOf<TSubTable> > (subTable); } + template <typename TSubTable> + inline OffsetArrayOf<TSubTable>& get_subtables (void) + { return CastR<OffsetArrayOf<TSubTable> > (subTable); } inline unsigned int get_size (void) const { @@ -633,14 +669,14 @@ struct Lookup return flag; } - template <typename SubTableType, typename context_t> + template <typename TSubTable, typename context_t> inline typename context_t::return_t dispatch (context_t *c) const { unsigned int lookup_type = get_type (); TRACE_DISPATCH (this, lookup_type); unsigned int count = get_subtable_count (); for (unsigned int i = 0; i < count; i++) { - typename context_t::return_t r = get_subtable<SubTableType> (i).dispatch (c, lookup_type); + typename context_t::return_t r = get_subtable<TSubTable> (i).dispatch (c, lookup_type); if (c->stop_sublookup_iteration (r)) return_trace (r); } @@ -666,16 +702,72 @@ struct Lookup return_trace (true); } + /* Older compileres need this to NOT be locally defined in a function. */ + template <typename TSubTable> + struct SubTableSubsetWrapper + { + inline SubTableSubsetWrapper (const TSubTable &subtable_, + unsigned int lookup_type_) : + subtable (subtable_), + lookup_type (lookup_type_) {} + + inline bool subset (hb_subset_context_t *c) const + { return subtable.dispatch (c, lookup_type); } + + private: + const TSubTable &subtable; + unsigned int lookup_type; + }; + + template <typename TSubTable> + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + struct Lookup *out = c->serializer->embed (*this); + if (unlikely (!out)) return_trace (false); + + /* Subset the actual subtables. */ + /* TODO Drop empty ones, either by calling intersects() beforehand, + * or just dropping null offsets after. */ + const OffsetArrayOf<TSubTable>& subtables = get_subtables<TSubTable> (); + OffsetArrayOf<TSubTable>& out_subtables = out->get_subtables<TSubTable> (); + unsigned int count = subTable.len; + for (unsigned int i = 0; i < count; i++) + { + SubTableSubsetWrapper<TSubTable> wrapper (this+subtables[i], get_type ()); + + out_subtables[i].serialize_subset (c, wrapper, out); + } + + return_trace (true); + } + + template <typename TSubTable> inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); - /* Real sanitize of the subtables is done by GSUB/GPOS/... */ if (!(c->check_struct (this) && subTable.sanitize (c))) return_trace (false); if (lookupFlag & LookupFlag::UseMarkFilteringSet) { const HBUINT16 &markFilteringSet = StructAfter<HBUINT16> (subTable); if (!markFilteringSet.sanitize (c)) return_trace (false); } + + if (unlikely (!dispatch<TSubTable> (c))) return_trace (false); + + if (unlikely (get_type () == TSubTable::Extension)) + { + /* The spec says all subtables of an Extension lookup should + * have the same type, which shall not be the Extension type + * itself (but we already checked for that). + * This is specially important if one has a reverse type! */ + unsigned int type = get_subtable<TSubTable> (0).u.extension.get_type (); + unsigned int count = get_subtable_count (); + for (unsigned int i = 1; i < count; i++) + if (get_subtable<TSubTable> (i).u.extension.get_type () != type) + return_trace (false); + } + return_trace (true); return_trace (true); } @@ -730,9 +822,17 @@ struct CoverageFormat1 return_trace (glyphArray.sanitize (c)); } - inline bool intersects_coverage (const hb_set_t *glyphs, unsigned int index) const { - return glyphs->has (glyphArray[index]); + inline bool intersects (const hb_set_t *glyphs) const + { + /* TODO Speed up, using hb_set_next() and bsearch()? */ + unsigned int count = glyphArray.len; + for (unsigned int i = 0; i < count; i++) + if (glyphs->has (glyphArray[i])) + return true; + return false; } + inline bool intersects_coverage (const hb_set_t *glyphs, unsigned int index) const + { return glyphs->has (glyphArray[index]); } template <typename set_t> inline bool add_coverage (set_t *glyphs) const { @@ -743,6 +843,7 @@ struct CoverageFormat1 /* Older compilers need this to be public. */ struct Iter { inline void init (const struct CoverageFormat1 &c_) { c = &c_; i = 0; }; + inline void fini (void) {}; inline bool more (void) { return i < c->glyphArray.len; } inline void next (void) { i++; } inline hb_codepoint_t get_glyph (void) { return c->glyphArray[i]; } @@ -819,7 +920,17 @@ struct CoverageFormat2 return_trace (rangeRecord.sanitize (c)); } - inline bool intersects_coverage (const hb_set_t *glyphs, unsigned int index) const { + inline bool intersects (const hb_set_t *glyphs) const + { + /* TODO Speed up, using hb_set_next() and bsearch()? */ + unsigned int count = rangeRecord.len; + for (unsigned int i = 0; i < count; i++) + if (rangeRecord[i].intersects (glyphs)) + return true; + return false; + } + inline bool intersects_coverage (const hb_set_t *glyphs, unsigned int index) const + { unsigned int i; unsigned int count = rangeRecord.len; for (i = 0; i < count; i++) { @@ -859,6 +970,7 @@ struct CoverageFormat2 i = c->rangeRecord.len; } } + inline void fini (void) {}; inline bool more (void) { return i < c->rangeRecord.len; } inline void next (void) { @@ -924,7 +1036,8 @@ struct Coverage if (glyphs[i - 1] + 1 != glyphs[i]) num_ranges++; u.format.set (num_glyphs * 2 < num_ranges * 3 ? 1 : 2); - switch (u.format) { + switch (u.format) + { case 1: return_trace (u.format1.serialize (c, glyphs, num_glyphs)); case 2: return_trace (u.format2.serialize (c, glyphs, num_glyphs)); default:return_trace (false); @@ -935,25 +1048,27 @@ struct Coverage { TRACE_SANITIZE (this); if (!u.format.sanitize (c)) return_trace (false); - switch (u.format) { + switch (u.format) + { case 1: return_trace (u.format1.sanitize (c)); case 2: return_trace (u.format2.sanitize (c)); default:return_trace (true); } } - inline bool intersects (const hb_set_t *glyphs) const { - /* TODO speed this up */ - Coverage::Iter iter; - for (iter.init (*this); iter.more (); iter.next ()) { - if (glyphs->has (iter.get_glyph ())) - return true; + inline bool intersects (const hb_set_t *glyphs) const + { + switch (u.format) + { + case 1: return u.format1.intersects (glyphs); + case 2: return u.format2.intersects (glyphs); + default:return false; } - return false; } - - inline bool intersects_coverage (const hb_set_t *glyphs, unsigned int index) const { - switch (u.format) { + inline bool intersects_coverage (const hb_set_t *glyphs, unsigned int index) const + { + switch (u.format) + { case 1: return u.format1.intersects_coverage (glyphs, index); case 2: return u.format2.intersects_coverage (glyphs, index); default:return false; @@ -963,47 +1078,61 @@ struct Coverage /* Might return false if array looks unsorted. * Used for faster rejection of corrupt data. */ template <typename set_t> - inline bool add_coverage (set_t *glyphs) const { - switch (u.format) { + inline bool add_coverage (set_t *glyphs) const + { + switch (u.format) + { case 1: return u.format1.add_coverage (glyphs); case 2: return u.format2.add_coverage (glyphs); default:return false; } } - struct Iter { + struct Iter + { Iter (void) : format (0), u () {}; - inline void init (const Coverage &c_) { + inline void init (const Coverage &c_) + { format = c_.u.format; - switch (format) { + switch (format) + { case 1: u.format1.init (c_.u.format1); return; case 2: u.format2.init (c_.u.format2); return; - default: return; + default: return; } } - inline bool more (void) { - switch (format) { + inline void fini (void) {} + inline bool more (void) + { + switch (format) + { case 1: return u.format1.more (); case 2: return u.format2.more (); default:return false; } } - inline void next (void) { - switch (format) { + inline void next (void) + { + switch (format) + { case 1: u.format1.next (); break; case 2: u.format2.next (); break; - default: break; + default: break; } } - inline hb_codepoint_t get_glyph (void) { - switch (format) { + inline hb_codepoint_t get_glyph (void) + { + switch (format) + { case 1: return u.format1.get_glyph (); case 2: return u.format2.get_glyph (); default:return 0; } } - inline unsigned int get_coverage (void) { - switch (format) { + inline unsigned int get_coverage (void) + { + switch (format) + { case 1: return u.format1.get_coverage (); case 2: return u.format2.get_coverage (); default:return -1; @@ -1085,6 +1214,17 @@ struct ClassDefFormat1 return true; } + inline bool intersects (const hb_set_t *glyphs) const + { + /* TODO Speed up, using hb_set_next()? */ + hb_codepoint_t start = startGlyph; + hb_codepoint_t end = startGlyph + classValue.len; + for (hb_codepoint_t iter = startGlyph - 1; + hb_set_next (glyphs, &iter) && iter < end;) + if (classValue[iter - start]) + return true; + return false; + } inline bool intersects_class (const hb_set_t *glyphs, unsigned int klass) const { unsigned int count = classValue.len; if (klass == 0) @@ -1135,7 +1275,8 @@ struct ClassDefFormat2 } template <typename set_t> - inline bool add_coverage (set_t *glyphs) const { + inline bool add_coverage (set_t *glyphs) const + { unsigned int count = rangeRecord.len; for (unsigned int i = 0; i < count; i++) if (rangeRecord[i].value) @@ -1145,7 +1286,8 @@ struct ClassDefFormat2 } template <typename set_t> - inline bool add_class (set_t *glyphs, unsigned int klass) const { + inline bool add_class (set_t *glyphs, unsigned int klass) const + { unsigned int count = rangeRecord.len; for (unsigned int i = 0; i < count; i++) { @@ -1156,7 +1298,17 @@ struct ClassDefFormat2 return true; } - inline bool intersects_class (const hb_set_t *glyphs, unsigned int klass) const { + inline bool intersects (const hb_set_t *glyphs) const + { + /* TODO Speed up, using hb_set_next() and bsearch()? */ + unsigned int count = rangeRecord.len; + for (unsigned int i = 0; i < count; i++) + if (rangeRecord[i].intersects (glyphs)) + return true; + return false; + } + inline bool intersects_class (const hb_set_t *glyphs, unsigned int klass) const + { unsigned int count = rangeRecord.len; if (klass == 0) { @@ -1233,6 +1385,13 @@ struct ClassDef } } + inline bool intersects (const hb_set_t *glyphs) const { + switch (u.format) { + case 1: return u.format1.intersects (glyphs); + case 2: return u.format2.intersects (glyphs); + default:return false; + } + } inline bool intersects_class (const hb_set_t *glyphs, unsigned int klass) const { switch (u.format) { case 1: return u.format1.intersects_class (glyphs, klass); @@ -1584,7 +1743,7 @@ struct FeatureVariationRecord struct FeatureVariations { - static const unsigned int NOT_FOUND_INDEX = 0xFFFFFFFFu; + enum { NOT_FOUND_INDEX = 0xFFFFFFFFu }; inline bool find_index (const int *coords, unsigned int coord_len, unsigned int *index) const @@ -1610,6 +1769,12 @@ struct FeatureVariations return (this+record.substitutions).find_substitute (feature_index); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + return_trace (c->serializer->embed (*this)); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -1623,7 +1788,7 @@ struct FeatureVariations LArrayOf<FeatureVariationRecord> varRecords; public: - DEFINE_SIZE_ARRAY (8, varRecords); + DEFINE_SIZE_ARRAY_SIZED (8, varRecords); }; @@ -1803,4 +1968,4 @@ struct Device } /* namespace OT */ -#endif /* HB_OT_LAYOUT_COMMON_PRIVATE_HH */ +#endif /* HB_OT_LAYOUT_COMMON_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gdef-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gdef-table.hh index d2b41a8ef50..cad99a3d62e 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gdef-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gdef-table.hh @@ -29,9 +29,9 @@ #ifndef HB_OT_LAYOUT_GDEF_TABLE_HH #define HB_OT_LAYOUT_GDEF_TABLE_HH -#include "hb-ot-layout-common-private.hh" +#include "hb-ot-layout-common.hh" -#include "hb-font-private.hh" +#include "hb-font.hh" namespace OT { @@ -337,6 +337,7 @@ struct MarkGlyphSets * https://docs.microsoft.com/en-us/typography/opentype/spec/gdef */ + struct GDEF { static const hb_tag_t tableTag = HB_OT_TAG_GDEF; @@ -386,19 +387,6 @@ struct GDEF inline const VariationStore &get_var_store (void) const { return version.to_int () >= 0x00010003u ? this+varStore : Null(VariationStore); } - inline bool sanitize (hb_sanitize_context_t *c) const - { - TRACE_SANITIZE (this); - return_trace (version.sanitize (c) && - likely (version.major == 1) && - glyphClassDef.sanitize (c, this) && - attachList.sanitize (c, this) && - ligCaretList.sanitize (c, this) && - markAttachClassDef.sanitize (c, this) && - (version.to_int () < 0x00010002u || markGlyphSetsDef.sanitize (c, this)) && - (version.to_int () < 0x00010003u || varStore.sanitize (c, this))); - } - /* glyph_props is a 16-bit integer where the lower 8-bit have bits representing * glyph class and other bits, and high 8-bit gthe mark attachment type (if any). * Not to be confused with lookup_props which is very similar. */ @@ -420,6 +408,38 @@ struct GDEF } } + struct accelerator_t + { + HB_INTERNAL inline void init (hb_face_t *face); + + inline void fini (void) + { + hb_blob_destroy (this->blob); + } + + hb_blob_t *blob; + const GDEF *table; + }; + + inline unsigned int get_size (void) const + { + return min_size + + (version.to_int () >= 0x00010002u ? markGlyphSetsDef.static_size : 0) + + (version.to_int () >= 0x00010003u ? varStore.static_size : 0); + } + + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (version.sanitize (c) && + likely (version.major == 1) && + glyphClassDef.sanitize (c, this) && + attachList.sanitize (c, this) && + ligCaretList.sanitize (c, this) && + markAttachClassDef.sanitize (c, this) && + (version.to_int () < 0x00010002u || markGlyphSetsDef.sanitize (c, this)) && + (version.to_int () < 0x00010003u || varStore.sanitize (c, this))); + } protected: FixedVersion<>version; /* Version of the GDEF table--currently @@ -454,6 +474,7 @@ struct GDEF DEFINE_SIZE_MIN (12); }; +struct GDEF_accelerator_t : GDEF::accelerator_t {}; } /* namespace OT */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gpos-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gpos-table.hh index fe34a328b27..5847306d6e4 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gpos-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gpos-table.hh @@ -29,7 +29,7 @@ #ifndef HB_OT_LAYOUT_GPOS_TABLE_HH #define HB_OT_LAYOUT_GPOS_TABLE_HH -#include "hb-ot-layout-gsubgpos-private.hh" +#include "hb-ot-layout-gsubgpos.hh" namespace OT { @@ -459,6 +459,9 @@ struct MarkArray : ArrayOf<MarkRecord> /* Array of MarkRecords--in Coverage orde struct SinglePosFormat1 { + inline bool intersects (const hb_set_t *glyphs) const + { return (this+coverage).intersects (glyphs); } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); @@ -466,9 +469,7 @@ struct SinglePosFormat1 } inline const Coverage &get_coverage (void) const - { - return this+coverage; - } + { return this+coverage; } inline bool apply (hb_ot_apply_context_t *c) const { @@ -483,6 +484,13 @@ struct SinglePosFormat1 return_trace (true); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -507,6 +515,9 @@ struct SinglePosFormat1 struct SinglePosFormat2 { + inline bool intersects (const hb_set_t *glyphs) const + { return (this+coverage).intersects (glyphs); } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); @@ -514,9 +525,7 @@ struct SinglePosFormat2 } inline const Coverage &get_coverage (void) const - { - return this+coverage; - } + { return this+coverage; } inline bool apply (hb_ot_apply_context_t *c) const { @@ -535,6 +544,13 @@ struct SinglePosFormat2 return_trace (true); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -598,6 +614,24 @@ struct PairSet { friend struct PairPosFormat1; + inline bool intersects (const hb_set_t *glyphs, + const ValueFormat *valueFormats) const + { + unsigned int len1 = valueFormats[0].get_len (); + unsigned int len2 = valueFormats[1].get_len (); + unsigned int record_size = HBUINT16::static_size * (1 + len1 + len2); + + const PairValueRecord *record = CastP<PairValueRecord> (arrayZ); + unsigned int count = len; + for (unsigned int i = 0; i < count; i++) + { + if (glyphs->has (record->secondGlyph)) + return true; + record = &StructAtOffset<const PairValueRecord> (record, record_size); + } + return false; + } + inline void collect_glyphs (hb_collect_glyphs_context_t *c, const ValueFormat *valueFormats) const { @@ -652,7 +686,8 @@ struct PairSet return_trace (false); } - struct sanitize_closure_t { + struct sanitize_closure_t + { const void *base; const ValueFormat *valueFormats; unsigned int len1; /* valueFormats[0].get_len() */ @@ -681,6 +716,20 @@ struct PairSet struct PairPosFormat1 { + inline bool intersects (const hb_set_t *glyphs) const + { + unsigned int count = pairSet.len; + for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) + { + if (unlikely (iter.get_coverage () >= count)) + break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ + if (glyphs->has (iter.get_glyph ()) && + (this+pairSet[iter.get_coverage ()]).intersects (glyphs, valueFormat)) + return true; + } + return false; + } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); @@ -691,9 +740,7 @@ struct PairPosFormat1 } inline const Coverage &get_coverage (void) const - { - return this+coverage; - } + { return this+coverage; } inline bool apply (hb_ot_apply_context_t *c) const { @@ -709,6 +756,13 @@ struct PairPosFormat1 return_trace ((this+pairSet[index]).apply (c, valueFormat, skippy_iter.idx)); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -717,7 +771,8 @@ struct PairPosFormat1 unsigned int len1 = valueFormat[0].get_len (); unsigned int len2 = valueFormat[1].get_len (); - PairSet::sanitize_closure_t closure = { + PairSet::sanitize_closure_t closure = + { this, valueFormat, len1, @@ -747,6 +802,12 @@ struct PairPosFormat1 struct PairPosFormat2 { + inline bool intersects (const hb_set_t *glyphs) const + { + return (this+coverage).intersects (glyphs) && + (this+classDef2).intersects (glyphs); + } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); @@ -755,9 +816,7 @@ struct PairPosFormat2 } inline const Coverage &get_coverage (void) const - { - return this+coverage; - } + { return this+coverage; } inline bool apply (hb_ot_apply_context_t *c) const { @@ -790,6 +849,13 @@ struct PairPosFormat2 return_trace (true); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -889,6 +955,9 @@ reverse_cursive_minor_offset (hb_glyph_position_t *pos, unsigned int i, hb_direc struct CursivePosFormat1 { + inline bool intersects (const hb_set_t *glyphs) const + { return (this+coverage).intersects (glyphs); } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); @@ -896,9 +965,7 @@ struct CursivePosFormat1 } inline const Coverage &get_coverage (void) const - { - return this+coverage; - } + { return this+coverage; } inline bool apply (hb_ot_apply_context_t *c) const { @@ -1001,6 +1068,13 @@ struct CursivePosFormat1 return_trace (true); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -1047,6 +1121,10 @@ typedef AnchorMatrix BaseArray; /* base-major-- struct MarkBasePosFormat1 { + inline bool intersects (const hb_set_t *glyphs) const + { return (this+markCoverage).intersects (glyphs) && + (this+baseCoverage).intersects (glyphs); } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); @@ -1055,9 +1133,7 @@ struct MarkBasePosFormat1 } inline const Coverage &get_coverage (void) const - { - return this+markCoverage; - } + { return this+markCoverage; } inline bool apply (hb_ot_apply_context_t *c) const { @@ -1099,6 +1175,13 @@ struct MarkBasePosFormat1 return_trace ((this+markArray).apply (c, mark_index, base_index, this+baseArray, classCount, skippy_iter.idx)); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -1161,6 +1244,10 @@ typedef OffsetListOf<LigatureAttach> LigatureArray; struct MarkLigPosFormat1 { + inline bool intersects (const hb_set_t *glyphs) const + { return (this+markCoverage).intersects (glyphs) && + (this+ligatureCoverage).intersects (glyphs); } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); @@ -1169,9 +1256,7 @@ struct MarkLigPosFormat1 } inline const Coverage &get_coverage (void) const - { - return this+markCoverage; - } + { return this+markCoverage; } inline bool apply (hb_ot_apply_context_t *c) const { @@ -1216,6 +1301,13 @@ struct MarkLigPosFormat1 return_trace ((this+markArray).apply (c, mark_index, comp_index, lig_attach, classCount, j)); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -1274,6 +1366,10 @@ typedef AnchorMatrix Mark2Array; /* mark2-major-- struct MarkMarkPosFormat1 { + inline bool intersects (const hb_set_t *glyphs) const + { return (this+mark1Coverage).intersects (glyphs) && + (this+mark2Coverage).intersects (glyphs); } + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); @@ -1282,9 +1378,7 @@ struct MarkMarkPosFormat1 } inline const Coverage &get_coverage (void) const - { - return this+mark1Coverage; - } + { return this+mark1Coverage; } inline bool apply (hb_ot_apply_context_t *c) const { @@ -1330,6 +1424,13 @@ struct MarkMarkPosFormat1 return_trace ((this+mark1Array).apply (c, mark1_index, mark2_index, this+mark2Array, classCount, j)); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -1388,7 +1489,7 @@ struct ChainContextPos : ChainContext {}; struct ExtensionPos : Extension<ExtensionPos> { - typedef struct PosLookupSubTable LookupSubTable; + typedef struct PosLookupSubTable SubTable; }; @@ -1400,6 +1501,7 @@ struct ExtensionPos : Extension<ExtensionPos> struct PosLookupSubTable { + friend struct Lookup; friend struct PosLookup; enum Type { @@ -1453,8 +1555,10 @@ struct PosLookupSubTable struct PosLookup : Lookup { - inline const PosLookupSubTable& get_subtable (unsigned int i) const - { return Lookup::get_subtable<PosLookupSubTable> (i); } + typedef struct PosLookupSubTable SubTable; + + inline const SubTable& get_subtable (unsigned int i) const + { return Lookup::get_subtable<SubTable> (i); } inline bool is_reverse (void) const { @@ -1467,6 +1571,12 @@ struct PosLookup : Lookup return_trace (dispatch (c)); } + inline bool intersects (const hb_set_t *glyphs) const + { + hb_intersects_context_t c (glyphs); + return dispatch (&c); + } + inline hb_collect_glyphs_context_t::return_t collect_glyphs (hb_collect_glyphs_context_t *c) const { TRACE_COLLECT_GLYPHS (this); @@ -1487,18 +1597,15 @@ struct PosLookup : Lookup template <typename context_t> inline typename context_t::return_t dispatch (context_t *c) const - { return Lookup::dispatch<PosLookupSubTable> (c); } + { return Lookup::dispatch<SubTable> (c); } + + inline bool subset (hb_subset_context_t *c) const + { return Lookup::subset<SubTable> (c); } inline bool sanitize (hb_sanitize_context_t *c) const - { - TRACE_SANITIZE (this); - if (unlikely (!Lookup::sanitize (c))) return_trace (false); - return_trace (dispatch (c)); - } + { return Lookup::sanitize<SubTable> (c); } }; -typedef OffsetListOf<PosLookup> PosLookupList; - /* * GPOS -- Glyph Positioning * https://docs.microsoft.com/en-us/typography/opentype/spec/gpos @@ -1515,13 +1622,13 @@ struct GPOS : GSUBGPOS static inline void position_finish_advances (hb_font_t *font, hb_buffer_t *buffer); static inline void position_finish_offsets (hb_font_t *font, hb_buffer_t *buffer); + inline bool subset (hb_subset_context_t *c) const + { return GSUBGPOS::subset<PosLookup> (c); } + inline bool sanitize (hb_sanitize_context_t *c) const - { - TRACE_SANITIZE (this); - if (unlikely (!GSUBGPOS::sanitize (c))) return_trace (false); - const OffsetTo<PosLookupList> &list = CastR<OffsetTo<PosLookupList> > (lookupList); - return_trace (list.sanitize (c, this)); - } + { return GSUBGPOS::sanitize<PosLookup> (c); } + + typedef GSUBGPOS::accelerator_t<GPOS> accelerator_t; }; @@ -1628,15 +1735,13 @@ GPOS::position_finish_offsets (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer) template <typename context_t> /*static*/ inline typename context_t::return_t PosLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index) { - const GPOS &gpos = *(hb_ot_layout_from_face (c->face)->table.GPOS); - const PosLookup &l = gpos.get_lookup (lookup_index); + const PosLookup &l = _get_gpos_relaxed (c->face)->get_lookup (lookup_index); return l.dispatch (c); } /*static*/ inline bool PosLookup::apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index) { - const GPOS &gpos = *(hb_ot_layout_from_face (c->face)->table.GPOS); - const PosLookup &l = gpos.get_lookup (lookup_index); + const PosLookup &l = _get_gpos_relaxed (c->face).get_lookup (lookup_index); unsigned int saved_lookup_props = c->lookup_props; unsigned int saved_lookup_index = c->lookup_index; c->set_lookup_index (lookup_index); @@ -1647,6 +1752,8 @@ template <typename context_t> return ret; } +struct GPOS_accelerator_t : GPOS::accelerator_t {}; + #undef attach_chain #undef attach_type diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsub-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsub-table.hh index 1d5a02a021d..76a0ea6d329 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsub-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsub-table.hh @@ -29,19 +29,26 @@ #ifndef HB_OT_LAYOUT_GSUB_TABLE_HH #define HB_OT_LAYOUT_GSUB_TABLE_HH -#include "hb-ot-layout-gsubgpos-private.hh" +#include "hb-ot-layout-gsubgpos.hh" namespace OT { +static inline void SingleSubst_serialize (hb_serialize_context_t *c, + Supplier<GlyphID> &glyphs, + Supplier<GlyphID> &substitutes, + unsigned int num_glyphs); + struct SingleSubstFormat1 { + inline bool intersects (const hb_set_t *glyphs) const + { return (this+coverage).intersects (glyphs); } + inline void closure (hb_closure_context_t *c) const { TRACE_CLOSURE (this); - Coverage::Iter iter; - for (iter.init (this+coverage); iter.more (); iter.next ()) + for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) { /* TODO Switch to range-based API to work around malicious fonts. * https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -55,8 +62,7 @@ struct SingleSubstFormat1 { TRACE_COLLECT_GLYPHS (this); if (unlikely (!(this+coverage).add_coverage (c->input))) return; - Coverage::Iter iter; - for (iter.init (this+coverage); iter.more (); iter.next ()) + for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) { /* TODO Switch to range-based API to work around malicious fonts. * https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -66,9 +72,7 @@ struct SingleSubstFormat1 } inline const Coverage &get_coverage (void) const - { - return this+coverage; - } + { return this+coverage; } inline bool would_apply (hb_would_apply_context_t *c) const { @@ -103,6 +107,30 @@ struct SingleSubstFormat1 return_trace (true); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + hb_auto_t<hb_vector_t<GlyphID> > from; + hb_auto_t<hb_vector_t<GlyphID> > to; + hb_codepoint_t delta = deltaGlyphID; + for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) + { + if (!c->plan->glyphset->has (iter.get_glyph ())) + continue; + from.push ()->set (iter.get_glyph ()); + to.push ()->set ((iter.get_glyph () + delta) & 0xFFFF); + } + c->serializer->err (from.in_error () || to.in_error ()); + + Supplier<GlyphID> from_supplier (&from); + Supplier<GlyphID> to_supplier (&to); + SingleSubst_serialize (c->serializer, + from_supplier, + to_supplier, + from.len); + return_trace (from.len); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -122,12 +150,14 @@ struct SingleSubstFormat1 struct SingleSubstFormat2 { + inline bool intersects (const hb_set_t *glyphs) const + { return (this+coverage).intersects (glyphs); } + inline void closure (hb_closure_context_t *c) const { TRACE_CLOSURE (this); - Coverage::Iter iter; unsigned int count = substitute.len; - for (iter.init (this+coverage); iter.more (); iter.next ()) + for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -140,9 +170,8 @@ struct SingleSubstFormat2 { TRACE_COLLECT_GLYPHS (this); if (unlikely (!(this+coverage).add_coverage (c->input))) return; - Coverage::Iter iter; unsigned int count = substitute.len; - for (iter.init (this+coverage); iter.more (); iter.next ()) + for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -151,9 +180,7 @@ struct SingleSubstFormat2 } inline const Coverage &get_coverage (void) const - { - return this+coverage; - } + { return this+coverage; } inline bool would_apply (hb_would_apply_context_t *c) const { @@ -164,14 +191,12 @@ struct SingleSubstFormat2 inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); - hb_codepoint_t glyph_id = c->buffer->cur().codepoint; - unsigned int index = (this+coverage).get_coverage (glyph_id); + unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint); if (likely (index == NOT_COVERED)) return_trace (false); if (unlikely (index >= substitute.len)) return_trace (false); - glyph_id = substitute[index]; - c->replace_glyph (glyph_id); + c->replace_glyph (substitute[index]); return_trace (true); } @@ -188,6 +213,29 @@ struct SingleSubstFormat2 return_trace (true); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + hb_auto_t<hb_vector_t<GlyphID> > from; + hb_auto_t<hb_vector_t<GlyphID> > to; + for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) + { + if (!c->plan->glyphset->has (iter.get_glyph ())) + continue; + from.push ()->set (iter.get_glyph ()); + to.push ()->set (substitute[iter.get_coverage ()]); + } + c->serializer->err (from.in_error () || to.in_error ()); + + Supplier<GlyphID> from_supplier (&from); + Supplier<GlyphID> to_supplier (&to); + SingleSubst_serialize (c->serializer, + from_supplier, + to_supplier, + from.len); + return_trace (from.len); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -255,6 +303,17 @@ struct SingleSubst } u; }; +static inline void +SingleSubst_serialize (hb_serialize_context_t *c, + Supplier<GlyphID> &glyphs, + Supplier<GlyphID> &substitutes, + unsigned int num_glyphs) +{ + c->start_embed<SingleSubst> ()->serialize (c, + glyphs, + substitutes, + num_glyphs); +} struct Sequence { @@ -329,12 +388,14 @@ struct Sequence struct MultipleSubstFormat1 { + inline bool intersects (const hb_set_t *glyphs) const + { return (this+coverage).intersects (glyphs); } + inline void closure (hb_closure_context_t *c) const { TRACE_CLOSURE (this); - Coverage::Iter iter; unsigned int count = sequence.len; - for (iter.init (this+coverage); iter.more (); iter.next ()) + for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -349,13 +410,11 @@ struct MultipleSubstFormat1 if (unlikely (!(this+coverage).add_coverage (c->input))) return; unsigned int count = sequence.len; for (unsigned int i = 0; i < count; i++) - (this+sequence[i]).collect_glyphs (c); + (this+sequence[i]).collect_glyphs (c); } inline const Coverage &get_coverage (void) const - { - return this+coverage; - } + { return this+coverage; } inline bool would_apply (hb_would_apply_context_t *c) const { @@ -391,6 +450,13 @@ struct MultipleSubstFormat1 return_trace (true); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -445,27 +511,82 @@ struct MultipleSubst } u; }; +struct AlternateSet +{ + inline void closure (hb_closure_context_t *c) const + { + TRACE_CLOSURE (this); + unsigned int count = alternates.len; + for (unsigned int i = 0; i < count; i++) + c->out->add (alternates[i]); + } + + inline void collect_glyphs (hb_collect_glyphs_context_t *c) const + { + TRACE_COLLECT_GLYPHS (this); + c->output->add_array (alternates.arrayZ, alternates.len); + } + + inline bool apply (hb_ot_apply_context_t *c) const + { + TRACE_APPLY (this); + unsigned int count = alternates.len; + + if (unlikely (!count)) return_trace (false); + + hb_mask_t glyph_mask = c->buffer->cur().mask; + hb_mask_t lookup_mask = c->lookup_mask; + + /* Note: This breaks badly if two features enabled this lookup together. */ + unsigned int shift = hb_ctz (lookup_mask); + unsigned int alt_index = ((lookup_mask & glyph_mask) >> shift); + + if (unlikely (alt_index > count || alt_index == 0)) return_trace (false); + + c->replace_glyph (alternates[alt_index - 1]); + + return_trace (true); + } + + inline bool serialize (hb_serialize_context_t *c, + Supplier<GlyphID> &glyphs, + unsigned int num_glyphs) + { + TRACE_SERIALIZE (this); + if (unlikely (!c->extend_min (*this))) return_trace (false); + if (unlikely (!alternates.serialize (c, glyphs, num_glyphs))) return_trace (false); + return_trace (true); + } -typedef ArrayOf<GlyphID> AlternateSet; /* Array of alternate GlyphIDs--in + inline bool sanitize (hb_sanitize_context_t *c) const + { + TRACE_SANITIZE (this); + return_trace (alternates.sanitize (c)); + } + + protected: + ArrayOf<GlyphID> + alternates; /* Array of alternate GlyphIDs--in * arbitrary order */ + public: + DEFINE_SIZE_ARRAY (2, alternates); +}; struct AlternateSubstFormat1 { + inline bool intersects (const hb_set_t *glyphs) const + { return (this+coverage).intersects (glyphs); } + inline void closure (hb_closure_context_t *c) const { TRACE_CLOSURE (this); - Coverage::Iter iter; unsigned int count = alternateSet.len; - for (iter.init (this+coverage); iter.more (); iter.next ()) + for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ - if (c->glyphs->has (iter.get_glyph ())) { - const AlternateSet &alt_set = this+alternateSet[iter.get_coverage ()]; - unsigned int count = alt_set.len; - for (unsigned int i = 0; i < count; i++) - c->out->add (alt_set[i]); - } + if (c->glyphs->has (iter.get_glyph ())) + (this+alternateSet[iter.get_coverage ()]).closure (c); } } @@ -473,21 +594,17 @@ struct AlternateSubstFormat1 { TRACE_COLLECT_GLYPHS (this); if (unlikely (!(this+coverage).add_coverage (c->input))) return; - Coverage::Iter iter; unsigned int count = alternateSet.len; - for (iter.init (this+coverage); iter.more (); iter.next ()) + for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ - const AlternateSet &alt_set = this+alternateSet[iter.get_coverage ()]; - c->output->add_array (alt_set.arrayZ, alt_set.len); + (this+alternateSet[iter.get_coverage ()]).collect_glyphs (c); } } inline const Coverage &get_coverage (void) const - { - return this+coverage; - } + { return this+coverage; } inline bool would_apply (hb_would_apply_context_t *c) const { @@ -498,29 +615,11 @@ struct AlternateSubstFormat1 inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); - hb_codepoint_t glyph_id = c->buffer->cur().codepoint; - unsigned int index = (this+coverage).get_coverage (glyph_id); + unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint); if (likely (index == NOT_COVERED)) return_trace (false); - const AlternateSet &alt_set = this+alternateSet[index]; - - if (unlikely (!alt_set.len)) return_trace (false); - - hb_mask_t glyph_mask = c->buffer->cur().mask; - hb_mask_t lookup_mask = c->lookup_mask; - - /* Note: This breaks badly if two features enabled this lookup together. */ - unsigned int shift = hb_ctz (lookup_mask); - unsigned int alt_index = ((lookup_mask & glyph_mask) >> shift); - - if (unlikely (alt_index > alt_set.len || alt_index == 0)) return_trace (false); - - glyph_id = alt_set[alt_index - 1]; - - c->replace_glyph (glyph_id); - - return_trace (true); + return_trace ((this+alternateSet[index]).apply (c)); } inline bool serialize (hb_serialize_context_t *c, @@ -541,6 +640,13 @@ struct AlternateSubstFormat1 return_trace (true); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -598,6 +704,15 @@ struct AlternateSubst struct Ligature { + inline bool intersects (const hb_set_t *glyphs) const + { + unsigned int count = component.len; + for (unsigned int i = 1; i < count; i++) + if (!glyphs->has (component[i])) + return false; + return true; + } + inline void closure (hb_closure_context_t *c) const { TRACE_CLOSURE (this); @@ -701,6 +816,15 @@ struct Ligature struct LigatureSet { + inline bool intersects (const hb_set_t *glyphs) const + { + unsigned int num_ligs = ligature.len; + for (unsigned int i = 0; i < num_ligs; i++) + if ((this+ligature[i]).intersects (glyphs)) + return true; + return false; + } + inline void closure (hb_closure_context_t *c) const { TRACE_CLOSURE (this); @@ -778,12 +902,25 @@ struct LigatureSet struct LigatureSubstFormat1 { + inline bool intersects (const hb_set_t *glyphs) const + { + unsigned int count = ligatureSet.len; + for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) + { + if (unlikely (iter.get_coverage () >= count)) + break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ + if (glyphs->has (iter.get_glyph ()) && + (this+ligatureSet[iter.get_coverage ()]).intersects (glyphs)) + return true; + } + return false; + } + inline void closure (hb_closure_context_t *c) const { TRACE_CLOSURE (this); - Coverage::Iter iter; unsigned int count = ligatureSet.len; - for (iter.init (this+coverage); iter.more (); iter.next ()) + for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -796,9 +933,8 @@ struct LigatureSubstFormat1 { TRACE_COLLECT_GLYPHS (this); if (unlikely (!(this+coverage).add_coverage (c->input))) return; - Coverage::Iter iter; unsigned int count = ligatureSet.len; - for (iter.init (this+coverage); iter.more (); iter.next ()) + for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -807,9 +943,7 @@ struct LigatureSubstFormat1 } inline const Coverage &get_coverage (void) const - { - return this+coverage; - } + { return this+coverage; } inline bool would_apply (hb_would_apply_context_t *c) const { @@ -824,9 +958,8 @@ struct LigatureSubstFormat1 inline bool apply (hb_ot_apply_context_t *c) const { TRACE_APPLY (this); - hb_codepoint_t glyph_id = c->buffer->cur().codepoint; - unsigned int index = (this+coverage).get_coverage (glyph_id); + unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint); if (likely (index == NOT_COVERED)) return_trace (false); const LigatureSet &lig_set = this+ligatureSet[index]; @@ -855,6 +988,13 @@ struct LigatureSubstFormat1 return_trace (true); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -924,7 +1064,7 @@ struct ChainContextSubst : ChainContext {}; struct ExtensionSubst : Extension<ExtensionSubst> { - typedef struct SubstLookupSubTable LookupSubTable; + typedef struct SubstLookupSubTable SubTable; inline bool is_reverse (void) const; }; @@ -932,6 +1072,28 @@ struct ExtensionSubst : Extension<ExtensionSubst> struct ReverseChainSingleSubstFormat1 { + inline bool intersects (const hb_set_t *glyphs) const + { + if (!(this+coverage).intersects (glyphs)) + return false; + + const OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (backtrack); + + unsigned int count; + + count = backtrack.len; + for (unsigned int i = 0; i < count; i++) + if (!(this+backtrack[i]).intersects (glyphs)) + return false; + + count = lookahead.len; + for (unsigned int i = 0; i < count; i++) + if (!(this+lookahead[i]).intersects (glyphs)) + return false; + + return true; + } + inline void closure (hb_closure_context_t *c) const { TRACE_CLOSURE (this); @@ -950,9 +1112,8 @@ struct ReverseChainSingleSubstFormat1 return; const ArrayOf<GlyphID> &substitute = StructAfter<ArrayOf<GlyphID> > (lookahead); - Coverage::Iter iter; count = substitute.len; - for (iter.init (this+coverage); iter.more (); iter.next ()) + for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) { if (unlikely (iter.get_coverage () >= count)) break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ @@ -983,9 +1144,7 @@ struct ReverseChainSingleSubstFormat1 } inline const Coverage &get_coverage (void) const - { - return this+coverage; - } + { return this+coverage; } inline bool would_apply (hb_would_apply_context_t *c) const { @@ -1026,6 +1185,13 @@ struct ReverseChainSingleSubstFormat1 return_trace (false); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -1045,7 +1211,7 @@ struct ReverseChainSingleSubstFormat1 * beginning of table */ OffsetArrayOf<Coverage> backtrack; /* Array of coverage tables - * in backtracking sequence, in glyph + * in backtracking sequence, in glyph * sequence order */ OffsetArrayOf<Coverage> lookaheadX; /* Array of coverage tables @@ -1086,6 +1252,7 @@ struct ReverseChainSingleSubst struct SubstLookupSubTable { + friend struct Lookup; friend struct SubstLookup; enum Type { @@ -1136,16 +1303,18 @@ struct SubstLookupSubTable struct SubstLookup : Lookup { - inline const SubstLookupSubTable& get_subtable (unsigned int i) const - { return Lookup::get_subtable<SubstLookupSubTable> (i); } + typedef SubstLookupSubTable SubTable; + + inline const SubTable& get_subtable (unsigned int i) const + { return Lookup::get_subtable<SubTable> (i); } inline static bool lookup_type_is_reverse (unsigned int lookup_type) - { return lookup_type == SubstLookupSubTable::ReverseChainSingle; } + { return lookup_type == SubTable::ReverseChainSingle; } inline bool is_reverse (void) const { unsigned int type = get_type (); - if (unlikely (type == SubstLookupSubTable::Extension)) + if (unlikely (type == SubTable::Extension)) return CastR<ExtensionSubst> (get_subtable(0)).is_reverse (); return lookup_type_is_reverse (type); } @@ -1156,6 +1325,12 @@ struct SubstLookup : Lookup return_trace (dispatch (c)); } + inline bool intersects (const hb_set_t *glyphs) const + { + hb_intersects_context_t c (glyphs); + return dispatch (&c); + } + inline hb_closure_context_t::return_t closure (hb_closure_context_t *c, unsigned int this_index) const { TRACE_CLOSURE (this); @@ -1196,9 +1371,9 @@ struct SubstLookup : Lookup static bool apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index); - inline SubstLookupSubTable& serialize_subtable (hb_serialize_context_t *c, - unsigned int i) - { return get_subtables<SubstLookupSubTable> ()[i].serialize (c, this); } + inline SubTable& serialize_subtable (hb_serialize_context_t *c, + unsigned int i) + { return get_subtables<SubTable> ()[i].serialize (c, this); } inline bool serialize_single (hb_serialize_context_t *c, uint32_t lookup_props, @@ -1207,7 +1382,7 @@ struct SubstLookup : Lookup unsigned int num_glyphs) { TRACE_SERIALIZE (this); - if (unlikely (!Lookup::serialize (c, SubstLookupSubTable::Single, lookup_props, 1))) return_trace (false); + if (unlikely (!Lookup::serialize (c, SubTable::Single, lookup_props, 1))) return_trace (false); return_trace (serialize_subtable (c, 0).u.single.serialize (c, glyphs, substitutes, num_glyphs)); } @@ -1219,7 +1394,7 @@ struct SubstLookup : Lookup Supplier<GlyphID> &substitute_glyphs_list) { TRACE_SERIALIZE (this); - if (unlikely (!Lookup::serialize (c, SubstLookupSubTable::Multiple, lookup_props, 1))) return_trace (false); + if (unlikely (!Lookup::serialize (c, SubTable::Multiple, lookup_props, 1))) return_trace (false); return_trace (serialize_subtable (c, 0).u.multiple.serialize (c, glyphs, substitute_len_list, @@ -1235,7 +1410,7 @@ struct SubstLookup : Lookup Supplier<GlyphID> &alternate_glyphs_list) { TRACE_SERIALIZE (this); - if (unlikely (!Lookup::serialize (c, SubstLookupSubTable::Alternate, lookup_props, 1))) return_trace (false); + if (unlikely (!Lookup::serialize (c, SubTable::Alternate, lookup_props, 1))) return_trace (false); return_trace (serialize_subtable (c, 0).u.alternate.serialize (c, glyphs, alternate_len_list, @@ -1253,7 +1428,7 @@ struct SubstLookup : Lookup Supplier<GlyphID> &component_list /* Starting from second for each ligature */) { TRACE_SERIALIZE (this); - if (unlikely (!Lookup::serialize (c, SubstLookupSubTable::Ligature, lookup_props, 1))) return_trace (false); + if (unlikely (!Lookup::serialize (c, SubTable::Ligature, lookup_props, 1))) return_trace (false); return_trace (serialize_subtable (c, 0).u.ligature.serialize (c, first_glyphs, ligature_per_first_glyph_count_list, @@ -1280,32 +1455,15 @@ struct SubstLookup : Lookup template <typename context_t> inline typename context_t::return_t dispatch (context_t *c) const - { return Lookup::dispatch<SubstLookupSubTable> (c); } + { return Lookup::dispatch<SubTable> (c); } - inline bool sanitize (hb_sanitize_context_t *c) const - { - TRACE_SANITIZE (this); - if (unlikely (!Lookup::sanitize (c))) return_trace (false); - if (unlikely (!dispatch (c))) return_trace (false); + inline bool subset (hb_subset_context_t *c) const + { return Lookup::subset<SubTable> (c); } - if (unlikely (get_type () == SubstLookupSubTable::Extension)) - { - /* The spec says all subtables of an Extension lookup should - * have the same type, which shall not be the Extension type - * itself (but we already checked for that). - * This is specially important if one has a reverse type! */ - unsigned int type = get_subtable (0).u.extension.get_type (); - unsigned int count = get_subtable_count (); - for (unsigned int i = 1; i < count; i++) - if (get_subtable (i).u.extension.get_type () != type) - return_trace (false); - } - return_trace (true); - } + inline bool sanitize (hb_sanitize_context_t *c) const + { return Lookup::sanitize<SubTable> (c); } }; -typedef OffsetListOf<SubstLookup> SubstLookupList; - /* * GSUB -- Glyph Substitution * https://docs.microsoft.com/en-us/typography/opentype/spec/gsub @@ -1318,32 +1476,14 @@ struct GSUB : GSUBGPOS inline const SubstLookup& get_lookup (unsigned int i) const { return CastR<SubstLookup> (GSUBGPOS::get_lookup (i)); } - static inline void substitute_start (hb_font_t *font, hb_buffer_t *buffer); + inline bool subset (hb_subset_context_t *c) const + { return GSUBGPOS::subset<SubstLookup> (c); } inline bool sanitize (hb_sanitize_context_t *c) const - { - TRACE_SANITIZE (this); - if (unlikely (!GSUBGPOS::sanitize (c))) return_trace (false); - const OffsetTo<SubstLookupList> &list = CastR<OffsetTo<SubstLookupList> > (lookupList); - return_trace (list.sanitize (c, this)); - } -}; - - -void -GSUB::substitute_start (hb_font_t *font, hb_buffer_t *buffer) -{ - _hb_buffer_assert_gsubgpos_vars (buffer); + { return GSUBGPOS::sanitize<SubstLookup> (c); } - const GDEF &gdef = *hb_ot_layout_from_face (font->face)->table.GDEF; - unsigned int count = buffer->len; - for (unsigned int i = 0; i < count; i++) - { - _hb_glyph_info_set_glyph_props (&buffer->info[i], gdef.get_glyph_props (buffer->info[i].codepoint)); - _hb_glyph_info_clear_lig_props (&buffer->info[i]); - buffer->info[i].syllable() = 0; - } -} + typedef GSUBGPOS::accelerator_t<GSUB> accelerator_t; +}; /* Out-of-class implementation for methods recursing */ @@ -1351,23 +1491,21 @@ GSUB::substitute_start (hb_font_t *font, hb_buffer_t *buffer) /*static*/ inline bool ExtensionSubst::is_reverse (void) const { unsigned int type = get_type (); - if (unlikely (type == SubstLookupSubTable::Extension)) - return CastR<ExtensionSubst> (get_subtable<LookupSubTable>()).is_reverse (); + if (unlikely (type == SubTable::Extension)) + return CastR<ExtensionSubst> (get_subtable<SubTable>()).is_reverse (); return SubstLookup::lookup_type_is_reverse (type); } template <typename context_t> /*static*/ inline typename context_t::return_t SubstLookup::dispatch_recurse_func (context_t *c, unsigned int lookup_index) { - const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->table.GSUB); - const SubstLookup &l = gsub.get_lookup (lookup_index); + const SubstLookup &l = _get_gsub_relaxed (c->face).get_lookup (lookup_index); return l.dispatch (c); } /*static*/ inline bool SubstLookup::apply_recurse_func (hb_ot_apply_context_t *c, unsigned int lookup_index) { - const GSUB &gsub = *(hb_ot_layout_from_face (c->face)->table.GSUB); - const SubstLookup &l = gsub.get_lookup (lookup_index); + const SubstLookup &l = _get_gsub_relaxed (c->face).get_lookup (lookup_index); unsigned int saved_lookup_props = c->lookup_props; unsigned int saved_lookup_index = c->lookup_index; c->set_lookup_index (lookup_index); @@ -1378,6 +1516,7 @@ template <typename context_t> return ret; } +struct GSUB_accelerator_t : GSUB::accelerator_t {}; } /* namespace OT */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh index 40a2fc4ccd3..315951a34f8 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-gsubgpos.hh @@ -26,19 +26,37 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH -#define HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH - -#include "hb-private.hh" -#include "hb-buffer-private.hh" -#include "hb-map-private.hh" +#ifndef HB_OT_LAYOUT_GSUBGPOS_HH +#define HB_OT_LAYOUT_GSUBGPOS_HH + +#include "hb.hh" +#include "hb-buffer.hh" +#include "hb-map.hh" +#include "hb-set.hh" +#include "hb-ot-layout-common.hh" #include "hb-ot-layout-gdef-table.hh" -#include "hb-set-private.hh" namespace OT { +struct hb_intersects_context_t : + hb_dispatch_context_t<hb_intersects_context_t, bool, 0> +{ + inline const char *get_name (void) { return "INTERSECTS"; } + template <typename T> + inline return_t dispatch (const T &obj) { return obj.intersects (this->glyphs); } + static return_t default_return_value (void) { return false; } + bool stop_sublookup_iteration (return_t r) const { return r; } + + const hb_set_t *glyphs; + unsigned int debug_depth; + + hb_intersects_context_t (const hb_set_t *glyphs_) : + glyphs (glyphs_), + debug_depth (0) {} +}; + struct hb_closure_context_t : hb_dispatch_context_t<hb_closure_context_t, hb_void_t, HB_DEBUG_CLOSURE> { @@ -48,15 +66,14 @@ struct hb_closure_context_t : inline return_t dispatch (const T &obj) { obj.closure (this); return HB_VOID; } static return_t default_return_value (void) { return HB_VOID; } bool stop_sublookup_iteration (return_t r HB_UNUSED) const { return false; } - return_t recurse (unsigned int lookup_index) + void recurse (unsigned int lookup_index) { if (unlikely (nesting_level_left == 0 || !recurse_func)) - return default_return_value (); + return; nesting_level_left--; recurse_func (this, lookup_index); nesting_level_left++; - return HB_VOID; } bool should_visit_lookup (unsigned int lookup_index) @@ -145,10 +162,10 @@ struct hb_collect_glyphs_context_t : inline return_t dispatch (const T &obj) { obj.collect_glyphs (this); return HB_VOID; } static return_t default_return_value (void) { return HB_VOID; } bool stop_sublookup_iteration (return_t r HB_UNUSED) const { return false; } - return_t recurse (unsigned int lookup_index) + void recurse (unsigned int lookup_index) { if (unlikely (nesting_level_left == 0 || !recurse_func)) - return default_return_value (); + return; /* Note that GPOS sets recurse_func to nullptr already, so it doesn't get * past the previous check. For GSUB, we only want to collect the output @@ -161,11 +178,11 @@ struct hb_collect_glyphs_context_t : */ if (output == hb_set_get_empty ()) - return HB_VOID; + return; /* Return if new lookup was recursed to before. */ if (recursed_lookups->has (lookup_index)) - return HB_VOID; + return; hb_set_t *old_before = before; hb_set_t *old_input = input; @@ -182,7 +199,7 @@ struct hb_collect_glyphs_context_t : recursed_lookups->add (lookup_index); - return HB_VOID; + return; } hb_face_t *face; @@ -207,24 +224,16 @@ struct hb_collect_glyphs_context_t : after (glyphs_after ? glyphs_after : hb_set_get_empty ()), output (glyphs_output ? glyphs_output : hb_set_get_empty ()), recurse_func (nullptr), - recursed_lookups (nullptr), + recursed_lookups (hb_set_create ()), nesting_level_left (nesting_level_left_), - debug_depth (0) - { - recursed_lookups = hb_set_create (); - } - ~hb_collect_glyphs_context_t (void) - { - hb_set_destroy (recursed_lookups); - } + debug_depth (0) {} + ~hb_collect_glyphs_context_t (void) { hb_set_destroy (recursed_lookups); } void set_recurse_func (recurse_func_t func) { recurse_func = func; } }; -/* XXX Can we remove this? */ - template <typename set_t> struct hb_add_coverage_context_t : hb_dispatch_context_t<hb_add_coverage_context_t<set_t>, const Coverage &, HB_DEBUG_GET_COVERAGE> @@ -480,7 +489,7 @@ struct hb_ot_apply_context_t : iter_input (), iter_context (), font (font_), face (font->face), buffer (buffer_), recurse_func (nullptr), - gdef (*hb_ot_layout_from_face (face)->table.GDEF), + gdef (_get_gdef (face)), var_store (gdef.get_var_store ()), direction (buffer_->props.direction), lookup_mask (1), @@ -598,7 +607,7 @@ struct hb_ot_apply_context_t : -typedef bool (*intersects_func_t) (hb_set_t *glyphs, const HBUINT16 &value, const void *data); +typedef bool (*intersects_func_t) (const hb_set_t *glyphs, const HBUINT16 &value, const void *data); typedef void (*collect_glyphs_func_t) (hb_set_t *glyphs, const HBUINT16 &value, const void *data); typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const HBUINT16 &value, const void *data); @@ -616,29 +625,29 @@ struct ContextApplyFuncs }; -static inline bool intersects_glyph (hb_set_t *glyphs, const HBUINT16 &value, const void *data HB_UNUSED) +static inline bool intersects_glyph (const hb_set_t *glyphs, const HBUINT16 &value, const void *data HB_UNUSED) { return glyphs->has (value); } -static inline bool intersects_class (hb_set_t *glyphs, const HBUINT16 &value, const void *data) +static inline bool intersects_class (const hb_set_t *glyphs, const HBUINT16 &value, const void *data) { const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data); return class_def.intersects_class (glyphs, value); } -static inline bool intersects_coverage (hb_set_t *glyphs, const HBUINT16 &value, const void *data) +static inline bool intersects_coverage (const hb_set_t *glyphs, const HBUINT16 &value, const void *data) { const OffsetTo<Coverage> &coverage = (const OffsetTo<Coverage>&)value; return (data+coverage).intersects (glyphs); } -static inline bool intersects_array (hb_closure_context_t *c, +static inline bool intersects_array (const hb_set_t *glyphs, unsigned int count, const HBUINT16 values[], intersects_func_t intersects_func, const void *intersects_data) { for (unsigned int i = 0; i < count; i++) - if (likely (!intersects_func (c->glyphs, values[i], intersects_data))) + if (likely (!intersects_func (glyphs, values[i], intersects_data))) return false; return true; } @@ -987,7 +996,6 @@ struct LookupRecord DEFINE_SIZE_STATIC (4); }; - template <typename context_t> static inline void recurse_lookups (context_t *c, unsigned int lookupCount, @@ -1140,6 +1148,16 @@ struct ContextApplyLookupContext const void *match_data; }; +static inline bool context_intersects (const hb_set_t *glyphs, + unsigned int inputCount, /* Including the first glyph (not matched) */ + const HBUINT16 input[], /* Array of input values--start with second glyph */ + ContextClosureLookupContext &lookup_context) +{ + return intersects_array (glyphs, + inputCount ? inputCount - 1 : 0, input, + lookup_context.funcs.intersects, lookup_context.intersects_data); +} + static inline void context_closure_lookup (hb_closure_context_t *c, unsigned int inputCount, /* Including the first glyph (not matched) */ const HBUINT16 input[], /* Array of input values--start with second glyph */ @@ -1147,9 +1165,9 @@ static inline void context_closure_lookup (hb_closure_context_t *c, const LookupRecord lookupRecord[], ContextClosureLookupContext &lookup_context) { - if (intersects_array (c, - inputCount ? inputCount - 1 : 0, input, - lookup_context.funcs.intersects, lookup_context.intersects_data)) + if (context_intersects (c->glyphs, + inputCount, input, + lookup_context)) recurse_lookups (c, lookupCount, lookupRecord); } @@ -1201,6 +1219,13 @@ static inline bool context_apply_lookup (hb_ot_apply_context_t *c, struct Rule { + inline bool intersects (const hb_set_t *glyphs, ContextClosureLookupContext &lookup_context) const + { + return context_intersects (glyphs, + inputCount, inputZ, + lookup_context); + } + inline void closure (hb_closure_context_t *c, ContextClosureLookupContext &lookup_context) const { TRACE_CLOSURE (this); @@ -1261,6 +1286,15 @@ struct Rule struct RuleSet { + inline bool intersects (const hb_set_t *glyphs, ContextClosureLookupContext &lookup_context) const + { + unsigned int num_rules = rule.len; + for (unsigned int i = 0; i < num_rules; i++) + if ((this+rule[i]).intersects (glyphs, lookup_context)) + return true; + return false; + } + inline void closure (hb_closure_context_t *c, ContextClosureLookupContext &lookup_context) const { TRACE_CLOSURE (this); @@ -1318,23 +1352,42 @@ struct RuleSet struct ContextFormat1 { + inline bool intersects (const hb_set_t *glyphs) const + { + struct ContextClosureLookupContext lookup_context = { + {intersects_glyph}, + nullptr + }; + + unsigned int count = ruleSet.len; + for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) + { + if (unlikely (iter.get_coverage () >= count)) + break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ + if (glyphs->has (iter.get_glyph ()) && + (this+ruleSet[iter.get_coverage ()]).intersects (glyphs, lookup_context)) + return true; + } + return false; + } + inline void closure (hb_closure_context_t *c) const { TRACE_CLOSURE (this); - const Coverage &cov = (this+coverage); - struct ContextClosureLookupContext lookup_context = { {intersects_glyph}, nullptr }; unsigned int count = ruleSet.len; - for (unsigned int i = 0; i < count; i++) - if (cov.intersects_coverage (c->glyphs, i)) { - const RuleSet &rule_set = this+ruleSet[i]; - rule_set.closure (c, lookup_context); - } + for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) + { + if (unlikely (iter.get_coverage () >= count)) + break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ + if (c->glyphs->has (iter.get_glyph ())) + (this+ruleSet[iter.get_coverage ()]).closure (c, lookup_context); + } } inline void collect_glyphs (hb_collect_glyphs_context_t *c) const @@ -1365,9 +1418,7 @@ struct ContextFormat1 } inline const Coverage &get_coverage (void) const - { - return this+coverage; - } + { return this+coverage; } inline bool apply (hb_ot_apply_context_t *c) const { @@ -1384,6 +1435,13 @@ struct ContextFormat1 return_trace (rule_set.apply (c, lookup_context)); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -1405,6 +1463,27 @@ struct ContextFormat1 struct ContextFormat2 { + inline bool intersects (const hb_set_t *glyphs) const + { + if (!(this+coverage).intersects (glyphs)) + return false; + + const ClassDef &class_def = this+classDef; + + struct ContextClosureLookupContext lookup_context = { + {intersects_class}, + &class_def + }; + + unsigned int count = ruleSet.len; + for (unsigned int i = 0; i < count; i++) + if (class_def.intersects_class (glyphs, i) && + (this+ruleSet[i]).intersects (glyphs, lookup_context)) + return true; + + return false; + } + inline void closure (hb_closure_context_t *c) const { TRACE_CLOSURE (this); @@ -1457,9 +1536,7 @@ struct ContextFormat2 } inline const Coverage &get_coverage (void) const - { - return this+coverage; - } + { return this+coverage; } inline bool apply (hb_ot_apply_context_t *c) const { @@ -1477,6 +1554,13 @@ struct ContextFormat2 return_trace (rule_set.apply (c, lookup_context)); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -1501,6 +1585,20 @@ struct ContextFormat2 struct ContextFormat3 { + inline bool intersects (const hb_set_t *glyphs) const + { + if (!(this+coverageZ[0]).intersects (glyphs)) + return false; + + struct ContextClosureLookupContext lookup_context = { + {intersects_coverage}, + this + }; + return context_intersects (glyphs, + glyphCount, (const HBUINT16 *) (coverageZ + 1), + lookup_context); + } + inline void closure (hb_closure_context_t *c) const { TRACE_CLOSURE (this); @@ -1548,9 +1646,7 @@ struct ContextFormat3 } inline const Coverage &get_coverage (void) const - { - return this+coverageZ[0]; - } + { return this+coverageZ[0]; } inline bool apply (hb_ot_apply_context_t *c) const { @@ -1566,6 +1662,13 @@ struct ContextFormat3 return_trace (context_apply_lookup (c, glyphCount, (const HBUINT16 *) (coverageZ + 1), lookupCount, lookupRecord, lookup_context)); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -1638,6 +1741,26 @@ struct ChainContextApplyLookupContext const void *match_data[3]; }; +static inline bool chain_context_intersects (const hb_set_t *glyphs, + unsigned int backtrackCount, + const HBUINT16 backtrack[], + unsigned int inputCount, /* Including the first glyph (not matched) */ + const HBUINT16 input[], /* Array of input values--start with second glyph */ + unsigned int lookaheadCount, + const HBUINT16 lookahead[], + ChainContextClosureLookupContext &lookup_context) +{ + return intersects_array (glyphs, + backtrackCount, backtrack, + lookup_context.funcs.intersects, lookup_context.intersects_data[0]) + && intersects_array (glyphs, + inputCount ? inputCount - 1 : 0, input, + lookup_context.funcs.intersects, lookup_context.intersects_data[1]) + && intersects_array (glyphs, + lookaheadCount, lookahead, + lookup_context.funcs.intersects, lookup_context.intersects_data[2]); +} + static inline void chain_context_closure_lookup (hb_closure_context_t *c, unsigned int backtrackCount, const HBUINT16 backtrack[], @@ -1649,15 +1772,11 @@ static inline void chain_context_closure_lookup (hb_closure_context_t *c, const LookupRecord lookupRecord[], ChainContextClosureLookupContext &lookup_context) { - if (intersects_array (c, - backtrackCount, backtrack, - lookup_context.funcs.intersects, lookup_context.intersects_data[0]) - && intersects_array (c, - inputCount ? inputCount - 1 : 0, input, - lookup_context.funcs.intersects, lookup_context.intersects_data[1]) - && intersects_array (c, - lookaheadCount, lookahead, - lookup_context.funcs.intersects, lookup_context.intersects_data[2])) + if (chain_context_intersects (c->glyphs, + backtrackCount, backtrack, + inputCount, input, + lookaheadCount, lookahead, + lookup_context)) recurse_lookups (c, lookupCount, lookupRecord); } @@ -1737,6 +1856,17 @@ static inline bool chain_context_apply_lookup (hb_ot_apply_context_t *c, struct ChainRule { + inline bool intersects (const hb_set_t *glyphs, ChainContextClosureLookupContext &lookup_context) const + { + const HeadlessArrayOf<HBUINT16> &input = StructAfter<HeadlessArrayOf<HBUINT16> > (backtrack); + const ArrayOf<HBUINT16> &lookahead = StructAfter<ArrayOf<HBUINT16> > (input); + return chain_context_intersects (glyphs, + backtrack.len, backtrack.arrayZ, + input.len, input.arrayZ, + lookahead.len, lookahead.arrayZ, + lookup_context); + } + inline void closure (hb_closure_context_t *c, ChainContextClosureLookupContext &lookup_context) const { TRACE_CLOSURE (this); @@ -1823,6 +1953,14 @@ struct ChainRule struct ChainRuleSet { + inline bool intersects (const hb_set_t *glyphs, ChainContextClosureLookupContext &lookup_context) const + { + unsigned int num_rules = rule.len; + for (unsigned int i = 0; i < num_rules; i++) + if ((this+rule[i]).intersects (glyphs, lookup_context)) + return true; + return false; + } inline void closure (hb_closure_context_t *c, ChainContextClosureLookupContext &lookup_context) const { TRACE_CLOSURE (this); @@ -1877,10 +2015,28 @@ struct ChainRuleSet struct ChainContextFormat1 { + inline bool intersects (const hb_set_t *glyphs) const + { + struct ChainContextClosureLookupContext lookup_context = { + {intersects_glyph}, + {nullptr, nullptr, nullptr} + }; + + unsigned int count = ruleSet.len; + for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) + { + if (unlikely (iter.get_coverage () >= count)) + break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ + if (glyphs->has (iter.get_glyph ()) && + (this+ruleSet[iter.get_coverage ()]).intersects (glyphs, lookup_context)) + return true; + } + return false; + } + inline void closure (hb_closure_context_t *c) const { TRACE_CLOSURE (this); - const Coverage &cov = (this+coverage); struct ChainContextClosureLookupContext lookup_context = { {intersects_glyph}, @@ -1888,11 +2044,13 @@ struct ChainContextFormat1 }; unsigned int count = ruleSet.len; - for (unsigned int i = 0; i < count; i++) - if (cov.intersects_coverage (c->glyphs, i)) { - const ChainRuleSet &rule_set = this+ruleSet[i]; - rule_set.closure (c, lookup_context); - } + for (hb_auto_t<Coverage::Iter> iter (this+coverage); iter.more (); iter.next ()) + { + if (unlikely (iter.get_coverage () >= count)) + break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */ + if (c->glyphs->has (iter.get_glyph ())) + (this+ruleSet[iter.get_coverage ()]).closure (c, lookup_context); + } } inline void collect_glyphs (hb_collect_glyphs_context_t *c) const @@ -1923,9 +2081,7 @@ struct ChainContextFormat1 } inline const Coverage &get_coverage (void) const - { - return this+coverage; - } + { return this+coverage; } inline bool apply (hb_ot_apply_context_t *c) const { @@ -1941,6 +2097,13 @@ struct ChainContextFormat1 return_trace (rule_set.apply (c, lookup_context)); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -1961,6 +2124,30 @@ struct ChainContextFormat1 struct ChainContextFormat2 { + inline bool intersects (const hb_set_t *glyphs) const + { + if (!(this+coverage).intersects (glyphs)) + return false; + + const ClassDef &backtrack_class_def = this+backtrackClassDef; + const ClassDef &input_class_def = this+inputClassDef; + const ClassDef &lookahead_class_def = this+lookaheadClassDef; + + struct ChainContextClosureLookupContext lookup_context = { + {intersects_class}, + {&backtrack_class_def, + &input_class_def, + &lookahead_class_def} + }; + + unsigned int count = ruleSet.len; + for (unsigned int i = 0; i < count; i++) + if (input_class_def.intersects_class (glyphs, i) && + (this+ruleSet[i]).intersects (glyphs, lookup_context)) + return true; + + return false; + } inline void closure (hb_closure_context_t *c) const { TRACE_CLOSURE (this); @@ -2027,9 +2214,7 @@ struct ChainContextFormat2 } inline const Coverage &get_coverage (void) const - { - return this+coverage; - } + { return this+coverage; } inline bool apply (hb_ot_apply_context_t *c) const { @@ -2052,6 +2237,13 @@ struct ChainContextFormat2 return_trace (rule_set.apply (c, lookup_context)); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -2088,6 +2280,25 @@ struct ChainContextFormat2 struct ChainContextFormat3 { + inline bool intersects (const hb_set_t *glyphs) const + { + const OffsetArrayOf<Coverage> &input = StructAfter<OffsetArrayOf<Coverage> > (backtrack); + + if (!(this+input[0]).intersects (glyphs)) + return false; + + const OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (input); + struct ChainContextClosureLookupContext lookup_context = { + {intersects_coverage}, + {this, this, this} + }; + return chain_context_intersects (glyphs, + backtrack.len, (const HBUINT16 *) backtrack.arrayZ, + input.len, (const HBUINT16 *) input.arrayZ + 1, + lookahead.len, (const HBUINT16 *) lookahead.arrayZ, + lookup_context); + } + inline void closure (hb_closure_context_t *c) const { TRACE_CLOSURE (this); @@ -2176,6 +2387,13 @@ struct ChainContextFormat3 lookup.len, lookup.arrayZ, lookup_context)); } + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + // TODO(subset) + return_trace (false); + } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); @@ -2244,8 +2462,8 @@ struct ExtensionFormat1 inline const X& get_subtable (void) const { unsigned int offset = extensionOffset; - if (unlikely (!offset)) return Null(typename T::LookupSubTable); - return StructAtOffset<typename T::LookupSubTable> (this, offset); + if (unlikely (!offset)) return Null(typename T::SubTable); + return StructAtOffset<typename T::SubTable> (this, offset); } template <typename context_t> @@ -2253,7 +2471,7 @@ struct ExtensionFormat1 { TRACE_DISPATCH (this, format); if (unlikely (!c->may_dispatch (this, this))) return_trace (c->no_dispatch_return_value ()); - return_trace (get_subtable<typename T::LookupSubTable> ().dispatch (c, get_type ())); + return_trace (get_subtable<typename T::SubTable> ().dispatch (c, get_type ())); } /* This is called from may_dispatch() above with hb_sanitize_context_t. */ @@ -2262,7 +2480,7 @@ struct ExtensionFormat1 TRACE_SANITIZE (this); return_trace (c->check_struct (this) && extensionOffset != 0 && - extensionLookupType != T::LookupSubTable::Extension); + extensionLookupType != T::SubTable::Extension); } protected: @@ -2290,8 +2508,8 @@ struct Extension inline const X& get_subtable (void) const { switch (u.format) { - case 1: return u.format1.template get_subtable<typename T::LookupSubTable> (); - default:return Null(typename T::LookupSubTable); + case 1: return u.format1.template get_subtable<typename T::SubTable> (); + default:return Null(typename T::SubTable); } } @@ -2370,17 +2588,78 @@ struct GSUBGPOS return get_feature (feature_index); } + template <typename TLookup> + inline bool subset (hb_subset_context_t *c) const + { + TRACE_SUBSET (this); + struct GSUBGPOS *out = c->serializer->embed (*this); + if (unlikely (!out)) return_trace (false); + out->scriptList.serialize_subset (c, this+scriptList, out); + out->featureList.serialize_subset (c, this+featureList, out); + + typedef OffsetListOf<TLookup> TLookupList; + /* TODO Use intersects() to count how many subtables survive? */ + CastR<OffsetTo<TLookupList> > (out->lookupList) + .serialize_subset (c, + this+CastR<const OffsetTo<TLookupList> > (lookupList), + out); + + if (version.to_int () >= 0x00010001u) + out->featureVars.serialize_subset (c, this+featureVars, out); + return_trace (true); + } + + inline unsigned int get_size (void) const + { + return min_size + + (version.to_int () >= 0x00010001u ? featureVars.static_size : 0); + } + + template <typename TLookup> inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); + typedef OffsetListOf<TLookup> TLookupList; return_trace (version.sanitize (c) && likely (version.major == 1) && scriptList.sanitize (c, this) && featureList.sanitize (c, this) && - lookupList.sanitize (c, this) && + CastR<OffsetTo<TLookupList> > (lookupList).sanitize (c, this) && (version.to_int () < 0x00010001u || featureVars.sanitize (c, this))); } + template <typename T> + struct accelerator_t + { + inline void init (hb_face_t *face) + { + this->blob = hb_sanitize_context_t().reference_table<T> (face); + table = this->blob->template as<T> (); + + this->lookup_count = table->get_lookup_count (); + + this->accels = (hb_ot_layout_lookup_accelerator_t *) calloc (this->lookup_count, sizeof (hb_ot_layout_lookup_accelerator_t)); + if (unlikely (!this->accels)) + this->lookup_count = 0; + + for (unsigned int i = 0; i < this->lookup_count; i++) + this->accels[i].init (table->get_lookup (i)); + } + + inline void fini (void) + { + for (unsigned int i = 0; i < this->lookup_count; i++) + this->accels[i].fini (); + free (this->accels); + hb_blob_destroy (this->blob); + } + + hb_blob_t *blob; + const T *table; + unsigned int lookup_count; + hb_ot_layout_lookup_accelerator_t *accels; + }; + protected: FixedVersion<>version; /* Version of the GSUB/GPOS table--initially set * to 0x00010000u */ @@ -2403,4 +2682,4 @@ struct GSUBGPOS } /* namespace OT */ -#endif /* HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH */ +#endif /* HB_OT_LAYOUT_GSUBGPOS_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-jstf-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-jstf-table.hh index 7fabdebb2ac..e718c319f0e 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-jstf-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-jstf-table.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_LAYOUT_JSTF_TABLE_HH #define HB_OT_LAYOUT_JSTF_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" #include "hb-ot-layout-gpos-table.hh" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc index 09ff0e6c0d7..a1220f4dd3b 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.cc @@ -28,10 +28,11 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-open-type-private.hh" -#include "hb-ot-layout-private.hh" -#include "hb-ot-map-private.hh" -#include "hb-map-private.hh" +#include "hb-open-type.hh" +#include "hb-ot-layout.hh" +#include "hb-ot-face.hh" +#include "hb-ot-map.hh" +#include "hb-map.hh" #include "hb-ot-layout-gdef-table.hh" #include "hb-ot-layout-gsub-table.hh" @@ -47,6 +48,53 @@ #include "hb-ot-name-table.hh" +// static inline const OT::BASE& +// _get_base (hb_face_t *face) +// { +// if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::BASE); +// hb_ot_face_data_t *data = hb_ot_face_data (face); +// return *(data->base.get ()); +// } + +const OT::GDEF& _get_gdef (hb_face_t *face) +{ + if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GDEF); + return *hb_ot_face_data (face)->GDEF->table; +} +static hb_blob_t * _get_gsub_blob (hb_face_t *face) +{ + if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return hb_blob_get_empty (); + return hb_ot_face_data (face)->GSUB->blob; +} +static inline const OT::GSUB& _get_gsub (hb_face_t *face) +{ + if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GSUB); + return *hb_ot_face_data (face)->GSUB->table; +} +const OT::GSUB& _get_gsub_relaxed (hb_face_t *face) +{ + return *hb_ot_face_data (face)->GSUB.get_relaxed ()->table; +} +static hb_blob_t * _get_gpos_blob (hb_face_t *face) +{ + if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return hb_blob_get_empty (); + return hb_ot_face_data (face)->GPOS->blob; +} +static inline const OT::GPOS& _get_gpos (hb_face_t *face) +{ + if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GPOS); + return *hb_ot_face_data (face)->GPOS->table; +} +const OT::GPOS& _get_gpos_relaxed (hb_face_t *face) +{ + return *hb_ot_face_data (face)->GPOS.get_relaxed ()->table; +} + + +/* + * GDEF + */ + static bool _hb_ot_blacklist_gdef (unsigned int gdef_len, unsigned int gsub_len, @@ -149,106 +197,39 @@ _hb_ot_blacklist_gdef (unsigned int gdef_len, return false; } -void hb_ot_layout_t::tables_t::init0 (hb_face_t *face) +inline void +OT::GDEF::accelerator_t::init (hb_face_t *face) { - this->face = face; -#define HB_OT_LAYOUT_TABLE(Namespace, Type) Type.init0 (); - HB_OT_LAYOUT_TABLES -#undef HB_OT_LAYOUT_TABLE -} -void hb_ot_layout_t::tables_t::fini (void) -{ -#define HB_OT_LAYOUT_TABLE(Namespace, Type) Type.fini (); - HB_OT_LAYOUT_TABLES -#undef HB_OT_LAYOUT_TABLE -} + this->blob = hb_sanitize_context_t().reference_table<GDEF> (face); -hb_ot_layout_t * -_hb_ot_layout_create (hb_face_t *face) -{ - hb_ot_layout_t *layout = (hb_ot_layout_t *) calloc (1, sizeof (hb_ot_layout_t)); - if (unlikely (!layout)) - return nullptr; - - layout->table.init0 (face); - - const OT::GSUB &gsub = *layout->table.GSUB; - const OT::GPOS &gpos = *layout->table.GPOS; - - if (unlikely (_hb_ot_blacklist_gdef (layout->table.GDEF.get_blob ()->length, - layout->table.GSUB.get_blob ()->length, - layout->table.GPOS.get_blob ()->length))) - layout->table.GDEF.set_stored (hb_blob_get_empty ()); - - unsigned int gsub_lookup_count = layout->gsub_lookup_count = gsub.get_lookup_count (); - unsigned int gpos_lookup_count = layout->gpos_lookup_count = gpos.get_lookup_count (); - - layout->gsub_accels = (hb_ot_layout_lookup_accelerator_t *) calloc (gsub_lookup_count, sizeof (hb_ot_layout_lookup_accelerator_t)); - layout->gpos_accels = (hb_ot_layout_lookup_accelerator_t *) calloc (gpos_lookup_count, sizeof (hb_ot_layout_lookup_accelerator_t)); - - if (unlikely ((gsub_lookup_count && !layout->gsub_accels) || - (gpos_lookup_count && !layout->gpos_accels))) + if (unlikely (_hb_ot_blacklist_gdef (this->blob->length, + _get_gsub_blob (face)->length, + _get_gpos_blob (face)->length))) { - _hb_ot_layout_destroy (layout); - return nullptr; + hb_blob_destroy (this->blob); + this->blob = hb_blob_get_empty (); } - for (unsigned int i = 0; i < gsub_lookup_count; i++) - layout->gsub_accels[i].init (gsub.get_lookup (i)); - for (unsigned int i = 0; i < gpos_lookup_count; i++) - layout->gpos_accels[i].init (gpos.get_lookup (i)); - - return layout; + table = this->blob->as<GDEF> (); } -void -_hb_ot_layout_destroy (hb_ot_layout_t *layout) +static void +_hb_ot_layout_set_glyph_props (hb_font_t *font, + hb_buffer_t *buffer) { - if (layout->gsub_accels) - for (unsigned int i = 0; i < layout->gsub_lookup_count; i++) - layout->gsub_accels[i].fini (); - if (layout->gpos_accels) - for (unsigned int i = 0; i < layout->gpos_lookup_count; i++) - layout->gpos_accels[i].fini (); - - free (layout->gsub_accels); - free (layout->gpos_accels); - - layout->table.fini (); - - free (layout); -} - -// static inline const OT::BASE& -// _get_base (hb_face_t *face) -// { -// if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::BASE); -// hb_ot_layout_t * layout = hb_ot_layout_from_face (face); -// return *(layout->base.get ()); -// } + _hb_buffer_assert_gsubgpos_vars (buffer); -static inline const OT::GDEF& -_get_gdef (hb_face_t *face) -{ - if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GDEF); - return *hb_ot_layout_from_face (face)->table.GDEF; -} -static inline const OT::GSUB& -_get_gsub (hb_face_t *face) -{ - if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GSUB); - return *hb_ot_layout_from_face (face)->table.GSUB; -} -static inline const OT::GPOS& -_get_gpos (hb_face_t *face) -{ - if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::GPOS); - return *hb_ot_layout_from_face (face)->table.GPOS; + const OT::GDEF &gdef = _get_gdef (font->face); + unsigned int count = buffer->len; + for (unsigned int i = 0; i < count; i++) + { + _hb_glyph_info_set_glyph_props (&buffer->info[i], gdef.get_glyph_props (buffer->info[i].codepoint)); + _hb_glyph_info_clear_lig_props (&buffer->info[i]); + buffer->info[i].syllable() = 0; + } } -/* - * GDEF - */ +/* Public API */ hb_bool_t hb_ot_layout_has_glyph_classes (hb_face_t *face) @@ -633,11 +614,11 @@ hb_ot_layout_table_get_lookup_count (hb_face_t *face, { case HB_OT_TAG_GSUB: { - return hb_ot_layout_from_face (face)->gsub_lookup_count; + return hb_ot_face_data (face)->GSUB->lookup_count; } case HB_OT_TAG_GPOS: { - return hb_ot_layout_from_face (face)->gpos_lookup_count; + return hb_ot_face_data (face)->GPOS->lookup_count; } } return 0; @@ -851,13 +832,13 @@ hb_ot_layout_lookup_collect_glyphs (hb_face_t *face, { case HB_OT_TAG_GSUB: { - const OT::SubstLookup& l = hb_ot_layout_from_face (face)->table.GSUB->get_lookup (lookup_index); + const OT::SubstLookup& l = hb_ot_face_data (face)->GSUB->table->get_lookup (lookup_index); l.collect_glyphs (&c); return; } case HB_OT_TAG_GPOS: { - const OT::PosLookup& l = hb_ot_layout_from_face (face)->table.GPOS->get_lookup (lookup_index); + const OT::PosLookup& l = hb_ot_face_data (face)->GPOS->table->get_lookup (lookup_index); l.collect_glyphs (&c); return; } @@ -930,18 +911,19 @@ hb_ot_layout_lookup_would_substitute_fast (hb_face_t *face, unsigned int glyphs_length, hb_bool_t zero_context) { - if (unlikely (lookup_index >= hb_ot_layout_from_face (face)->gsub_lookup_count)) return false; + if (unlikely (lookup_index >= hb_ot_face_data (face)->GSUB->lookup_count)) return false; OT::hb_would_apply_context_t c (face, glyphs, glyphs_length, (bool) zero_context); - const OT::SubstLookup& l = hb_ot_layout_from_face (face)->table.GSUB->get_lookup (lookup_index); + const OT::SubstLookup& l = hb_ot_face_data (face)->GSUB->table->get_lookup (lookup_index); - return l.would_apply (&c, &hb_ot_layout_from_face (face)->gsub_accels[lookup_index]); + return l.would_apply (&c, &hb_ot_face_data (face)->GSUB->accels[lookup_index]); } void -hb_ot_layout_substitute_start (hb_font_t *font, hb_buffer_t *buffer) +hb_ot_layout_substitute_start (hb_font_t *font, + hb_buffer_t *buffer) { - OT::GSUB::substitute_start (font, buffer); +_hb_ot_layout_set_glyph_props (font, buffer); } /** @@ -1086,13 +1068,13 @@ hb_ot_layout_get_size_params (hb_face_t *face, struct GSUBProxy { - static const unsigned int table_index = 0; + enum { table_index = 0 }; static const bool inplace = false; typedef OT::SubstLookup Lookup; GSUBProxy (hb_face_t *face) : - table (*hb_ot_layout_from_face (face)->table.GSUB), - accels (hb_ot_layout_from_face (face)->gsub_accels) {} + table (*hb_ot_face_data (face)->GSUB->table), + accels (hb_ot_face_data (face)->GSUB->accels) {} const OT::GSUB &table; const hb_ot_layout_lookup_accelerator_t *accels; @@ -1100,13 +1082,13 @@ struct GSUBProxy struct GPOSProxy { - static const unsigned int table_index = 1; + enum { table_index = 1 }; static const bool inplace = true; typedef OT::PosLookup Lookup; GPOSProxy (hb_face_t *face) : - table (*hb_ot_layout_from_face (face)->table.GPOS), - accels (hb_ot_layout_from_face (face)->gpos_accels) {} + table (*hb_ot_face_data (face)->GPOS->table), + accels (hb_ot_face_data (face)->GPOS->accels) {} const OT::GPOS &table; const hb_ot_layout_lookup_accelerator_t *accels; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.hh index 612bc7fce38..84981391cb5 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-layout.hh @@ -26,15 +26,27 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OT_LAYOUT_PRIVATE_HH -#define HB_OT_LAYOUT_PRIVATE_HH +#ifndef HB_OT_LAYOUT_HH +#define HB_OT_LAYOUT_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-font-private.hh" -#include "hb-buffer-private.hh" -#include "hb-set-digest-private.hh" -#include "hb-open-type-private.hh" +#include "hb-font.hh" +#include "hb-buffer.hh" +#include "hb-open-type.hh" +#include "hb-set-digest.hh" + + +namespace OT +{ + struct GDEF; + struct GSUB; + struct GPOS; +} + +HB_INTERNAL const OT::GDEF& _get_gdef (hb_face_t *face); +HB_INTERNAL const OT::GSUB& _get_gsub_relaxed (hb_face_t *face); +HB_INTERNAL const OT::GPOS& _get_gpos_relaxed (hb_face_t *face); /* Private API corresponding to hb-ot-layout.h: */ @@ -87,7 +99,22 @@ hb_ot_layout_substitute_start (hb_font_t *font, hb_buffer_t *buffer); -struct hb_ot_layout_lookup_accelerator_t; +struct hb_ot_layout_lookup_accelerator_t +{ + template <typename TLookup> + inline void init (const TLookup &lookup) + { + digest.init (); + lookup.add_coverage (&digest); + } + inline void fini (void) {} + + inline bool may_have (hb_codepoint_t g) const + { return digest.may_have (g); } + + private: + hb_set_digest_t digest; +}; namespace OT { struct hb_ot_apply_context_t; @@ -116,112 +143,6 @@ hb_ot_layout_position_finish_offsets (hb_font_t *font, hb_buffer_t *buffer); - -/* - * hb_ot_layout_t - */ - -struct hb_ot_layout_lookup_accelerator_t -{ - template <typename TLookup> - inline void init (const TLookup &lookup) - { - digest.init (); - lookup.add_coverage (&digest); - } - - inline void fini (void) - { - } - - inline bool may_have (hb_codepoint_t g) const { - return digest.may_have (g); - } - - private: - hb_set_digest_t digest; -}; - -/* Most of these tables are NOT needed for shaping. But we need to hook them *somewhere*. - * This is as good as any place. */ -#define HB_OT_LAYOUT_TABLES \ - /* OpenType shaping. */ \ - HB_OT_LAYOUT_TABLE(OT, GDEF) \ - HB_OT_LAYOUT_TABLE(OT, GSUB) \ - HB_OT_LAYOUT_TABLE(OT, GPOS) \ - HB_OT_LAYOUT_TABLE(OT, JSTF) \ - HB_OT_LAYOUT_TABLE(OT, BASE) \ - /* AAT shaping. */ \ - HB_OT_LAYOUT_TABLE(AAT, morx) \ - HB_OT_LAYOUT_TABLE(AAT, kerx) \ - HB_OT_LAYOUT_TABLE(AAT, ankr) \ - HB_OT_LAYOUT_TABLE(AAT, trak) \ - /* OpenType variations. */ \ - HB_OT_LAYOUT_TABLE(OT, fvar) \ - HB_OT_LAYOUT_TABLE(OT, avar) \ - HB_OT_LAYOUT_TABLE(OT, MVAR) \ - /* OpenType color. */ \ - HB_OT_LAYOUT_TABLE(OT, COLR) \ - HB_OT_LAYOUT_TABLE(OT, CPAL) \ - HB_OT_LAYOUT_TABLE(OT, CBDT) \ - HB_OT_LAYOUT_TABLE(OT, CBLC) \ - HB_OT_LAYOUT_TABLE(OT, sbix) \ - HB_OT_LAYOUT_TABLE(OT, svg) \ - /* OpenType math. */ \ - HB_OT_LAYOUT_TABLE(OT, MATH) \ - /* OpenType fundamentals. */ \ - HB_OT_LAYOUT_TABLE(OT, post) \ - /* */ - -/* Declare tables. */ -#define HB_OT_LAYOUT_TABLE(Namespace, Type) namespace Namespace { struct Type; } -HB_OT_LAYOUT_TABLES -#undef HB_OT_LAYOUT_TABLE - -struct hb_ot_layout_t -{ - unsigned int gsub_lookup_count; - unsigned int gpos_lookup_count; - - hb_ot_layout_lookup_accelerator_t *gsub_accels; - hb_ot_layout_lookup_accelerator_t *gpos_accels; - - /* Various non-shaping tables. */ - struct tables_t - { - HB_INTERNAL void init0 (hb_face_t *face); - HB_INTERNAL void fini (void); - -#define HB_OT_LAYOUT_TABLE_ORDER(Namespace, Type) \ - HB_PASTE (ORDER_, HB_PASTE (Namespace, HB_PASTE (_, Type))) - enum order_t - { - ORDER_ZERO, -#define HB_OT_LAYOUT_TABLE(Namespace, Type) \ - HB_OT_LAYOUT_TABLE_ORDER (Namespace, Type), - HB_OT_LAYOUT_TABLES -#undef HB_OT_LAYOUT_TABLE - }; - - hb_face_t *face; /* MUST be JUST before the lazy loaders. */ -#define HB_OT_LAYOUT_TABLE(Namespace, Type) \ - hb_table_lazy_loader_t<struct Namespace::Type, HB_OT_LAYOUT_TABLE_ORDER (Namespace, Type)> Type; - HB_OT_LAYOUT_TABLES -#undef HB_OT_LAYOUT_TABLE - } table; -}; - - -HB_INTERNAL hb_ot_layout_t * -_hb_ot_layout_create (hb_face_t *face); - -HB_INTERNAL void -_hb_ot_layout_destroy (hb_ot_layout_t *layout); - - -#define hb_ot_layout_from_face(face) ((hb_ot_layout_t *) face->shaper_data.ot.get_relaxed ()) - - /* * Buffer var routines. */ @@ -701,4 +622,4 @@ _hb_buffer_assert_gsubgpos_vars (hb_buffer_t *buffer) #undef lig_props #undef glyph_props -#endif /* HB_OT_LAYOUT_PRIVATE_HH */ +#endif /* HB_OT_LAYOUT_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.cc index f26cac9b102..29f52dcc28d 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.cc @@ -26,9 +26,9 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-map-private.hh" +#include "hb-ot-map.hh" -#include "hb-ot-layout-private.hh" +#include "hb-ot-layout.hh" void hb_ot_map_t::collect_lookups (unsigned int table_index, hb_set_t *lookups_out) const diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.hh index 4aaf3283113..32a9e7e003d 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-map.hh @@ -26,10 +26,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OT_MAP_PRIVATE_HH -#define HB_OT_MAP_PRIVATE_HH +#ifndef HB_OT_MAP_HH +#define HB_OT_MAP_HH -#include "hb-buffer-private.hh" +#include "hb-buffer.hh" struct hb_ot_shape_plan_t; @@ -250,4 +250,4 @@ struct hb_ot_map_builder_t -#endif /* HB_OT_MAP_PRIVATE_HH */ +#endif /* HB_OT_MAP_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-math-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-math-table.hh index 2dd714580d5..b7ca167b179 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-math-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-math-table.hh @@ -27,8 +27,8 @@ #ifndef HB_OT_MATH_TABLE_HH #define HB_OT_MATH_TABLE_HH -#include "hb-open-type-private.hh" -#include "hb-ot-layout-common-private.hh" +#include "hb-open-type.hh" +#include "hb-ot-layout-common.hh" #include "hb-ot-math.h" namespace OT { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-math.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-math.cc index 66ce207a799..c693f4807be 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-math.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-math.cc @@ -24,17 +24,17 @@ * Igalia Author(s): Frédéric Wang */ -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" -#include "hb-ot-layout-private.hh" +#include "hb-ot-face.hh" #include "hb-ot-math-table.hh" static inline const OT::MATH& _get_math (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::MATH); - hb_ot_layout_t * layout = hb_ot_layout_from_face (face); - return *(layout->table.MATH.get ()); + hb_ot_face_data_t * data = hb_ot_face_data (face); + return *(data->MATH.get ()); } /* diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-maxp-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-maxp-table.hh index 75aac4f44bb..efcf593e956 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-maxp-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-maxp-table.hh @@ -27,8 +27,7 @@ #ifndef HB_OT_MAXP_TABLE_HH #define HB_OT_MAXP_TABLE_HH -#include "hb-open-type-private.hh" -#include "hb-subset-plan.hh" +#include "hb-open-type.hh" namespace OT { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-name-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-name-table.hh index bff85df27fd..a1de1193f00 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-name-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-name-table.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_NAME_TABLE_HH #define HB_OT_NAME_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" namespace OT { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-table.hh index 56bbab74118..f28858c592b 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-table.hh @@ -27,9 +27,8 @@ #ifndef HB_OT_OS2_TABLE_HH #define HB_OT_OS2_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" #include "hb-ot-os2-unicode-ranges.hh" -#include "hb-subset-plan.hh" namespace OT { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-unicode-ranges.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-unicode-ranges.hh index cb1260784d5..42dfa490680 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-unicode-ranges.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-os2-unicode-ranges.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_OS2_UNICODE_RANGES_HH #define HB_OT_OS2_UNICODE_RANGES_HH -#include "hb-private.hh" +#include "hb.hh" namespace OT { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-post-macroman.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-post-macroman.hh index dbbb97e5a9f..b4df8aaeeab 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-post-macroman.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-post-macroman.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_POST_MACROMAN_HH #if 0 /* Make checks happy. */ #define HB_OT_POST_MACROMAN_HH -#include "hb-private.hh" +#include "hb.hh" #endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-post-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-post-table.hh index 4f08a51a2c1..d0265d056dd 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-post-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-post-table.hh @@ -27,8 +27,7 @@ #ifndef HB_OT_POST_TABLE_HH #define HB_OT_POST_TABLE_HH -#include "hb-open-type-private.hh" -#include "hb-subset-plan.hh" +#include "hb-open-type.hh" #define HB_STRING_ARRAY_NAME format1_names #define HB_STRING_ARRAY_LIST "hb-ot-post-macroman.hh" @@ -295,6 +294,8 @@ struct post DEFINE_SIZE_STATIC (32); }; +struct post_accelerator_t : post::accelerator_t {}; + } /* namespace OT */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic-fallback.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic-fallback.hh index a55511aa069..0ef60f64347 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic-fallback.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic-fallback.hh @@ -27,9 +27,9 @@ #ifndef HB_OT_SHAPE_COMPLEX_ARABIC_FALLBACK_HH #define HB_OT_SHAPE_COMPLEX_ARABIC_FALLBACK_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-ot-shape-private.hh" +#include "hb-ot-shape.hh" #include "hb-ot-layout-gsub-table.hh" @@ -173,7 +173,6 @@ arabic_fallback_synthesize_lookup_ligature (const hb_ot_shape_plan_t *plan HB_UN ligatures_supplier, component_count_supplier, component_supplier); - c.end_serialize (); /* TODO sanitize the results? */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic-win1256.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic-win1256.hh index 54c6cdc24f1..b15e145f2f4 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic-win1256.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic-win1256.hh @@ -313,7 +313,7 @@ OT_TABLE_END * Include a second time to get the table data... */ #if 0 -#include "hb-private.hh" /* Make check-includes.sh happy. */ +#include "hb.hh" /* Make check-includes.sh happy. */ #endif #ifdef OT_MEASURE #include "hb-ot-shape-complex-arabic-win1256.hh" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc index f4b397b932c..ebc1d3d5fd0 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.cc @@ -24,9 +24,9 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" -#include "hb-ot-shape-complex-arabic-private.hh" -#include "hb-ot-shape-private.hh" +#include "hb.hh" +#include "hb-ot-shape-complex-arabic.hh" +#include "hb-ot-shape.hh" /* buffer var allocations */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.hh index fcedc7d7420..5bf6ff6338a 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-arabic.hh @@ -26,12 +26,12 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OT_SHAPE_COMPLEX_ARABIC_PRIVATE_HH -#define HB_OT_SHAPE_COMPLEX_ARABIC_PRIVATE_HH +#ifndef HB_OT_SHAPE_COMPLEX_ARABIC_HH +#define HB_OT_SHAPE_COMPLEX_ARABIC_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-ot-shape-complex-private.hh" +#include "hb-ot-shape-complex.hh" struct arabic_shape_plan_t; @@ -47,4 +47,4 @@ setup_masks_arabic_plan (const arabic_shape_plan_t *arabic_plan, hb_buffer_t *buffer, hb_script_t script); -#endif /* HB_OT_SHAPE_COMPLEX_ARABIC_PRIVATE_HH */ +#endif /* HB_OT_SHAPE_COMPLEX_ARABIC_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-default.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-default.cc index 68a62a10d44..45d5f434673 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-default.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-default.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-complex-private.hh" +#include "hb-ot-shape-complex.hh" const hb_ot_complex_shaper_t _hb_ot_complex_shaper_default = diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-hangul.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-hangul.cc index 7420c5d181b..ea731114a88 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-hangul.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-hangul.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-complex-private.hh" +#include "hb-ot-shape-complex.hh" /* Hangul shaper */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-hebrew.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-hebrew.cc index 34cf28b8e24..ba25258a33b 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-hebrew.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-hebrew.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-complex-private.hh" +#include "hb-ot-shape-complex.hh" static bool diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-machine.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-machine.hh index 73f9d58719f..f67a525c5aa 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-machine.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-machine.hh @@ -29,7 +29,7 @@ #ifndef HB_OT_SHAPE_COMPLEX_INDIC_MACHINE_HH #define HB_OT_SHAPE_COMPLEX_INDIC_MACHINE_HH -#include "hb-private.hh" +#include "hb.hh" #line 36 "hb-ot-shape-complex-indic-machine.hh" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-machine.rl b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-machine.rl index 35e7ce9067c..d384a68c35e 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-machine.rl +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-machine.rl @@ -27,7 +27,7 @@ #ifndef HB_OT_SHAPE_COMPLEX_INDIC_MACHINE_HH #define HB_OT_SHAPE_COMPLEX_INDIC_MACHINE_HH -#include "hb-private.hh" +#include "hb.hh" %%{ machine indic_syllable_machine; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-table.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-table.cc index 54291bc22d8..b7e4e7c7c0b 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-table.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-table.cc @@ -14,7 +14,7 @@ * # Date: 2017-10-16, 24:39:00 GMT [KW] */ -#include "hb-ot-shape-complex-indic-private.hh" +#include "hb-ot-shape-complex-indic.hh" #define ISC_A INDIC_SYLLABIC_CATEGORY_AVAGRAHA /* 16 chars; Avagraha */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc index b52656f44c6..d4541bb18ab 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.cc @@ -24,8 +24,8 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-complex-indic-private.hh" -#include "hb-ot-layout-private.hh" +#include "hb-ot-shape-complex-indic.hh" +#include "hb-ot-layout.hh" /* diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.hh index bb7fff38414..9e597797c88 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-indic.hh @@ -24,14 +24,14 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OT_SHAPE_COMPLEX_INDIC_PRIVATE_HH -#define HB_OT_SHAPE_COMPLEX_INDIC_PRIVATE_HH +#ifndef HB_OT_SHAPE_COMPLEX_INDIC_HH +#define HB_OT_SHAPE_COMPLEX_INDIC_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-ot-shape-complex-private.hh" -#include "hb-ot-shape-private.hh" /* XXX Remove */ +#include "hb-ot-shape-complex.hh" +#include "hb-ot-shape.hh" /* XXX Remove */ /* buffer var allocations */ @@ -400,4 +400,4 @@ set_indic_properties (hb_glyph_info_t &info) } -#endif /* HB_OT_SHAPE_COMPLEX_INDIC_PRIVATE_HH */ +#endif /* HB_OT_SHAPE_COMPLEX_INDIC_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer-machine.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer-machine.hh index d001021561f..a7e1711eb09 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer-machine.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer-machine.hh @@ -29,7 +29,7 @@ #ifndef HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH #define HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH -#include "hb-private.hh" +#include "hb.hh" #line 36 "hb-ot-shape-complex-khmer-machine.hh" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer-machine.rl b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer-machine.rl index 54644d8aa6b..7c7951629cc 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer-machine.rl +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer-machine.rl @@ -27,7 +27,7 @@ #ifndef HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH #define HB_OT_SHAPE_COMPLEX_KHMER_MACHINE_HH -#include "hb-private.hh" +#include "hb.hh" %%{ machine khmer_syllable_machine; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.cc index 264515e86c4..0b5b50a972e 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.cc @@ -24,8 +24,8 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-complex-khmer-private.hh" -#include "hb-ot-layout-private.hh" +#include "hb-ot-shape-complex-khmer.hh" +#include "hb-ot-layout.hh" /* diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.hh index f90ef967440..3371c130216 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-khmer.hh @@ -24,12 +24,12 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OT_SHAPE_COMPLEX_KHMER_PRIVATE_HH -#define HB_OT_SHAPE_COMPLEX_KHMER_PRIVATE_HH +#ifndef HB_OT_SHAPE_COMPLEX_KHMER_HH +#define HB_OT_SHAPE_COMPLEX_KHMER_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-ot-shape-complex-indic-private.hh" +#include "hb-ot-shape-complex-indic.hh" /* buffer var allocations */ @@ -121,4 +121,4 @@ set_khmer_properties (hb_glyph_info_t &info) } -#endif /* HB_OT_SHAPE_COMPLEX_KHMER_PRIVATE_HH */ +#endif /* HB_OT_SHAPE_COMPLEX_KHMER_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-machine.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-machine.hh index fb67dd42e64..7fa23517807 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-machine.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-machine.hh @@ -29,7 +29,7 @@ #ifndef HB_OT_SHAPE_COMPLEX_MYANMAR_MACHINE_HH #define HB_OT_SHAPE_COMPLEX_MYANMAR_MACHINE_HH -#include "hb-private.hh" +#include "hb.hh" #line 36 "hb-ot-shape-complex-myanmar-machine.hh" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-machine.rl b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-machine.rl index 0cd84fa1b88..62f51d1e9e8 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-machine.rl +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-machine.rl @@ -27,7 +27,7 @@ #ifndef HB_OT_SHAPE_COMPLEX_MYANMAR_MACHINE_HH #define HB_OT_SHAPE_COMPLEX_MYANMAR_MACHINE_HH -#include "hb-private.hh" +#include "hb.hh" %%{ machine myanmar_syllable_machine; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar.cc index e4214b87e3c..8466f8129d5 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-complex-myanmar-private.hh" +#include "hb-ot-shape-complex-myanmar.hh" /* diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar.hh index 14d011d67d8..7b6fd4837c7 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-myanmar.hh @@ -24,12 +24,12 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OT_SHAPE_COMPLEX_MYANMAR_PRIVATE_HH -#define HB_OT_SHAPE_COMPLEX_MYANMAR_PRIVATE_HH +#ifndef HB_OT_SHAPE_COMPLEX_MYANMAR_HH +#define HB_OT_SHAPE_COMPLEX_MYANMAR_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-ot-shape-complex-indic-private.hh" +#include "hb-ot-shape-complex-indic.hh" /* buffer var allocations */ @@ -168,4 +168,4 @@ set_myanmar_properties (hb_glyph_info_t &info) } -#endif /* HB_OT_SHAPE_COMPLEX_MYANMAR_PRIVATE_HH */ +#endif /* HB_OT_SHAPE_COMPLEX_MYANMAR_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-thai.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-thai.cc index 02d78ac04a5..1d18760e4da 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-thai.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-thai.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-complex-private.hh" +#include "hb-ot-shape-complex.hh" /* Thai / Lao shaper */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-tibetan.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-tibetan.cc index eaac0bf689f..9982ebc29f0 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-tibetan.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-tibetan.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-complex-private.hh" +#include "hb-ot-shape-complex.hh" static const hb_tag_t tibetan_features[] = diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-machine.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-machine.hh index 0ec805afca5..77ca3aeb52a 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-machine.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-machine.hh @@ -31,7 +31,7 @@ #ifndef HB_OT_SHAPE_COMPLEX_USE_MACHINE_HH #define HB_OT_SHAPE_COMPLEX_USE_MACHINE_HH -#include "hb-private.hh" +#include "hb.hh" #line 38 "hb-ot-shape-complex-use-machine.hh" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-machine.rl b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-machine.rl index 7ec8a7fd172..a233b1200c1 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-machine.rl +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-machine.rl @@ -29,7 +29,7 @@ #ifndef HB_OT_SHAPE_COMPLEX_USE_MACHINE_HH #define HB_OT_SHAPE_COMPLEX_USE_MACHINE_HH -#include "hb-private.hh" +#include "hb.hh" %%{ machine use_syllable_machine; diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-table.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-table.cc index 9c796f05182..4862b7fe943 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-table.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-table.cc @@ -15,7 +15,7 @@ * UnicodeData.txt does not have a header. */ -#include "hb-ot-shape-complex-use-private.hh" +#include "hb-ot-shape-complex-use.hh" #define B USE_B /* BASE */ #define CGJ USE_CGJ /* CGJ */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use.cc index f8e86c9d6e6..676b15b6e9c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use.cc @@ -26,8 +26,8 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-complex-use-private.hh" -#include "hb-ot-shape-complex-arabic-private.hh" +#include "hb-ot-shape-complex-use.hh" +#include "hb-ot-shape-complex-arabic.hh" /* buffer var allocations */ #define use_category() complex_var_u8_0() diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use.hh index b4bda8bb778..b8123e7914c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-use.hh @@ -26,13 +26,13 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OT_SHAPE_COMPLEX_USE_PRIVATE_HH -#define HB_OT_SHAPE_COMPLEX_USE_PRIVATE_HH +#ifndef HB_OT_SHAPE_COMPLEX_USE_HH +#define HB_OT_SHAPE_COMPLEX_USE_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-ot-shape-complex-private.hh" +#include "hb-ot-shape-complex.hh" #define USE_TABLE_ELEMENT_TYPE uint8_t @@ -94,4 +94,4 @@ enum use_category_t { HB_INTERNAL USE_TABLE_ELEMENT_TYPE hb_use_get_category (hb_codepoint_t u); -#endif /* HB_OT_SHAPE_COMPLEX_USE_PRIVATE_HH */ +#endif /* HB_OT_SHAPE_COMPLEX_USE_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex.hh index 37a4d918b1d..a48a38a2015 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-complex.hh @@ -24,13 +24,13 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OT_SHAPE_COMPLEX_PRIVATE_HH -#define HB_OT_SHAPE_COMPLEX_PRIVATE_HH +#ifndef HB_OT_SHAPE_COMPLEX_HH +#define HB_OT_SHAPE_COMPLEX_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-ot-shape-private.hh" -#include "hb-ot-shape-normalize-private.hh" +#include "hb-ot-shape.hh" +#include "hb-ot-shape-normalize.hh" @@ -390,4 +390,4 @@ hb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner) } -#endif /* HB_OT_SHAPE_COMPLEX_PRIVATE_HH */ +#endif /* HB_OT_SHAPE_COMPLEX_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-fallback.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-fallback.cc index fbf31ab249b..5f43023bec1 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-fallback.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-fallback.cc @@ -24,8 +24,8 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-fallback-private.hh" -#include "hb-ot-layout-gsubgpos-private.hh" +#include "hb-ot-shape-fallback.hh" +#include "hb-ot-layout-gsubgpos.hh" static unsigned int recategorize_combining_class (hb_codepoint_t u, diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-fallback-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-fallback.hh index e134224df92..730e7f28068 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-fallback-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-fallback.hh @@ -24,12 +24,12 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OT_SHAPE_FALLBACK_PRIVATE_HH -#define HB_OT_SHAPE_FALLBACK_PRIVATE_HH +#ifndef HB_OT_SHAPE_FALLBACK_HH +#define HB_OT_SHAPE_FALLBACK_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-ot-shape-private.hh" +#include "hb-ot-shape.hh" HB_INTERNAL void _hb_ot_shape_fallback_position (const hb_ot_shape_plan_t *plan, @@ -50,4 +50,4 @@ HB_INTERNAL void _hb_ot_shape_fallback_spaces (const hb_ot_shape_plan_t *plan, hb_buffer_t *buffer); -#endif /* HB_OT_SHAPE_FALLBACK_PRIVATE_HH */ +#endif /* HB_OT_SHAPE_FALLBACK_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-normalize.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-normalize.cc index 358450ee7f0..fd0b63aecd3 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-normalize.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-normalize.cc @@ -24,9 +24,9 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-normalize-private.hh" -#include "hb-ot-shape-complex-private.hh" -#include "hb-ot-shape-private.hh" +#include "hb-ot-shape-normalize.hh" +#include "hb-ot-shape-complex.hh" +#include "hb-ot-shape.hh" /* diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-normalize-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-normalize.hh index c744e26451d..4aea640b165 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-normalize-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-normalize.hh @@ -24,10 +24,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OT_SHAPE_NORMALIZE_PRIVATE_HH -#define HB_OT_SHAPE_NORMALIZE_PRIVATE_HH +#ifndef HB_OT_SHAPE_NORMALIZE_HH +#define HB_OT_SHAPE_NORMALIZE_HH -#include "hb-private.hh" +#include "hb.hh" /* buffer var allocations, used during the normalization process */ @@ -66,4 +66,4 @@ struct hb_ot_shape_normalize_context_t }; -#endif /* HB_OT_SHAPE_NORMALIZE_PRIVATE_HH */ +#endif /* HB_OT_SHAPE_NORMALIZE_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc index 71632b563c4..63102f6b0cf 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.cc @@ -27,21 +27,21 @@ */ #define HB_SHAPER ot -#define hb_ot_face_data_t hb_ot_layout_t #define hb_ot_shape_plan_data_t hb_ot_shape_plan_t -#include "hb-shaper-impl-private.hh" +#include "hb-shaper-impl.hh" -#include "hb-ot-shape-private.hh" -#include "hb-ot-shape-complex-private.hh" -#include "hb-ot-shape-fallback-private.hh" -#include "hb-ot-shape-normalize-private.hh" +#include "hb-ot-shape.hh" +#include "hb-ot-shape-complex.hh" +#include "hb-ot-shape-fallback.hh" +#include "hb-ot-shape-normalize.hh" -#include "hb-ot-layout-private.hh" -#include "hb-unicode-private.hh" -#include "hb-set-private.hh" +#include "hb-ot-face.hh" +#include "hb-ot-layout.hh" +#include "hb-unicode.hh" +#include "hb-set.hh" -#include "hb-ot-layout-gsubgpos-private.hh" -#include "hb-aat-layout-private.hh" +#include "hb-ot-layout-gsubgpos.hh" +#include "hb-aat-layout.hh" static hb_tag_t common_features[] = { HB_TAG('c','c','m','p'), @@ -135,13 +135,13 @@ HB_SHAPER_DATA_ENSURE_DEFINE(ot, face) hb_ot_face_data_t * _hb_ot_shaper_face_data_create (hb_face_t *face) { - return _hb_ot_layout_create (face); + return _hb_ot_face_data_create (face); } void _hb_ot_shaper_face_data_destroy (hb_ot_face_data_t *data) { - _hb_ot_layout_destroy (data); + _hb_ot_face_data_destroy (data); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.hh index d6898263f24..b3a490a3723 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-shape.hh @@ -24,13 +24,13 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_OT_SHAPE_PRIVATE_HH -#define HB_OT_SHAPE_PRIVATE_HH +#ifndef HB_OT_SHAPE_HH +#define HB_OT_SHAPE_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-ot-map-private.hh" -#include "hb-ot-layout-private.hh" +#include "hb-ot-map.hh" +#include "hb-ot-layout.hh" @@ -109,4 +109,4 @@ struct hb_ot_shape_planner_t }; -#endif /* HB_OT_SHAPE_PRIVATE_HH */ +#endif /* HB_OT_SHAPE_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-tag.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-tag.cc index 991d8e77ab8..283723e27d8 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-tag.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-tag.cc @@ -26,7 +26,7 @@ * Google Author(s): Behdad Esfahbod, Roozbeh Pournader */ -#include "hb-private.hh" +#include "hb.hh" /* hb_script_t */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-avar-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-avar-table.hh index ad063d32de8..8343018b32f 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-avar-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-avar-table.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_VAR_AVAR_TABLE_HH #define HB_OT_VAR_AVAR_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" /* * avar -- Axis Variations diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-fvar-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-fvar-table.hh index 101476ed322..afd29046e15 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-fvar-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-fvar-table.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_VAR_FVAR_TABLE_HH #define HB_OT_VAR_FVAR_TABLE_HH -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" /* * fvar -- Font Variations diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-hvar-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-hvar-table.hh index 2b384db71a0..086e922fdc8 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-hvar-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-hvar-table.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_VAR_HVAR_TABLE_HH #define HB_OT_VAR_HVAR_TABLE_HH -#include "hb-ot-layout-common-private.hh" +#include "hb-ot-layout-common.hh" namespace OT { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-mvar-table.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-mvar-table.hh index dfde782f664..20dd2200c50 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-mvar-table.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var-mvar-table.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_VAR_MVAR_TABLE_HH #define HB_OT_VAR_MVAR_TABLE_HH -#include "hb-ot-layout-common-private.hh" +#include "hb-ot-layout-common.hh" namespace OT { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var.cc index 6081ddfc389..472ee845224 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ot-var.cc @@ -24,9 +24,9 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" -#include "hb-ot-layout-private.hh" +#include "hb-ot-face.hh" #include "hb-ot-var-avar-table.hh" #include "hb-ot-var-fvar-table.hh" #include "hb-ot-var-mvar-table.hh" @@ -40,15 +40,15 @@ static inline const OT::fvar& _get_fvar (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::fvar); - hb_ot_layout_t * layout = hb_ot_layout_from_face (face); - return *(layout->table.fvar.get ()); + hb_ot_face_data_t *layout = hb_ot_face_data (face); + return *(layout->fvar.get ()); } static inline const OT::avar& _get_avar (hb_face_t *face) { if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return Null(OT::avar); - hb_ot_layout_t * layout = hb_ot_layout_from_face (face); - return *(layout->table.avar.get ()); + hb_ot_face_data_t *layout = hb_ot_face_data (face); + return *(layout->avar.get ()); } /** diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-digest-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-digest.hh index e099a826414..0f9329f621c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-digest-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-digest.hh @@ -24,10 +24,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_SET_DIGEST_PRIVATE_HH -#define HB_SET_DIGEST_PRIVATE_HH +#ifndef HB_SET_DIGEST_HH +#define HB_SET_DIGEST_HH -#include "hb-private.hh" +#include "hb.hh" /* * The set digests here implement various "filters" that support @@ -50,8 +50,8 @@ struct hb_set_digest_lowest_bits_t { ASSERT_POD (); - static const unsigned int mask_bytes = sizeof (mask_t); - static const unsigned int mask_bits = sizeof (mask_t) * 8; + enum { mask_bytes = sizeof (mask_t) }; + enum { mask_bits = sizeof (mask_t) * 8 }; static const unsigned int num_bits = 0 + (mask_bytes >= 1 ? 3 : 0) + (mask_bytes >= 2 ? 1 : 0) @@ -176,4 +176,4 @@ typedef hb_set_digest_combiner_t > hb_set_digest_t; -#endif /* HB_SET_DIGEST_PRIVATE_HH */ +#endif /* HB_SET_DIGEST_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.cc index 25027e6c216..09dc4b483af 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-set-private.hh" +#include "hb-set.hh" /* Public API */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.hh index 032ddb1ee20..353403e9297 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-set.hh @@ -24,10 +24,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_SET_PRIVATE_HH -#define HB_SET_PRIVATE_HH +#ifndef HB_SET_HH +#define HB_SET_HH -#include "hb-private.hh" +#include "hb.hh" /* @@ -157,7 +157,7 @@ struct hb_set_t } typedef unsigned long long elt_t; - static const unsigned int PAGE_BITS = 512; + enum { PAGE_BITS = 512 }; static_assert ((PAGE_BITS & ((PAGE_BITS) - 1)) == 0, ""); static inline unsigned int elt_get_min (const elt_t &elt) { return hb_ctz (elt); } @@ -165,11 +165,11 @@ struct hb_set_t typedef hb_vector_size_t<elt_t, PAGE_BITS / 8> vector_t; - static const unsigned int ELT_BITS = sizeof (elt_t) * 8; - static const unsigned int ELT_MASK = ELT_BITS - 1; - static const unsigned int BITS = sizeof (vector_t) * 8; - static const unsigned int MASK = BITS - 1; - static_assert (PAGE_BITS == BITS, ""); + enum { ELT_BITS = sizeof (elt_t) * 8 }; + enum { ELT_MASK = ELT_BITS - 1 }; + enum { BITS = sizeof (vector_t) * 8 }; + enum { MASK = BITS - 1 }; + static_assert ((unsigned) PAGE_BITS == (unsigned) BITS, ""); elt_t &elt (hb_codepoint_t g) { return v[(g & MASK) / ELT_BITS]; } elt_t const &elt (hb_codepoint_t g) const { return v[(g & MASK) / ELT_BITS]; } @@ -697,4 +697,4 @@ struct hb_set_t }; -#endif /* HB_SET_PRIVATE_HH */ +#endif /* HB_SET_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan.cc index 0d61d9e1f2a..b0cf1e92d1d 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan.cc @@ -24,11 +24,11 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" -#include "hb-shape-plan-private.hh" -#include "hb-shaper-private.hh" -#include "hb-font-private.hh" -#include "hb-buffer-private.hh" +#include "hb.hh" +#include "hb-shape-plan.hh" +#include "hb-shaper.hh" +#include "hb-font.hh" +#include "hb-buffer.hh" static void diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan.hh index 7d020ff16be..bf82b912be0 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape-plan.hh @@ -24,11 +24,11 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_SHAPE_PLAN_PRIVATE_HH -#define HB_SHAPE_PLAN_PRIVATE_HH +#ifndef HB_SHAPE_PLAN_HH +#define HB_SHAPE_PLAN_HH -#include "hb-private.hh" -#include "hb-shaper-private.hh" +#include "hb.hh" +#include "hb-shaper.hh" struct hb_shape_plan_t @@ -64,4 +64,4 @@ DECLARE_NULL_INSTANCE (hb_shape_plan_t); #undef HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS -#endif /* HB_SHAPE_PLAN_PRIVATE_HH */ +#endif /* HB_SHAPE_PLAN_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape.cc index 3c2e6c4a969..e8eeff5b354 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shape.cc @@ -26,13 +26,13 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" -#include "hb-shaper-private.hh" -#include "hb-shape-plan-private.hh" -#include "hb-buffer-private.hh" -#include "hb-font-private.hh" -#include "hb-machinery-private.hh" +#include "hb-shaper.hh" +#include "hb-shape-plan.hh" +#include "hb-buffer.hh" +#include "hb-font.hh" +#include "hb-machinery.hh" /** * SECTION:hb-shape @@ -46,8 +46,10 @@ * contains the output glyphs and their positions. **/ - +#ifdef HB_USE_ATEXIT static void free_static_shaper_list (void); +#endif + static const char *nil_shaper_list[] = {nullptr}; static struct hb_shaper_list_lazy_loader_t : hb_lazy_loader_t<const char *, diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-impl-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-impl.hh index 4a10279c794..d40cb085a23 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-impl-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-impl.hh @@ -24,15 +24,15 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_SHAPER_IMPL_PRIVATE_HH -#define HB_SHAPER_IMPL_PRIVATE_HH +#ifndef HB_SHAPER_IMPL_HH +#define HB_SHAPER_IMPL_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-shaper-private.hh" -#include "hb-shape-plan-private.hh" -#include "hb-font-private.hh" -#include "hb-buffer-private.hh" +#include "hb-shaper.hh" +#include "hb-shape-plan.hh" +#include "hb-font.hh" +#include "hb-buffer.hh" #ifdef HB_SHAPER @@ -40,4 +40,4 @@ #endif -#endif /* HB_SHAPER_IMPL_PRIVATE_HH */ +#endif /* HB_SHAPER_IMPL_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper.cc index e423f2557c5..52418c08234 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper.cc @@ -24,9 +24,9 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" -#include "hb-shaper-private.hh" -#include "hb-machinery-private.hh" +#include "hb.hh" +#include "hb-shaper.hh" +#include "hb-machinery.hh" static const hb_shaper_pair_t all_shapers[] = { @@ -35,8 +35,9 @@ static const hb_shaper_pair_t all_shapers[] = { #undef HB_SHAPER_IMPLEMENT }; - +#ifdef HB_USE_ATEXIT static void free_static_shapers (void); +#endif static struct hb_shapers_lazy_loader_t : hb_lazy_loader_t<const hb_shaper_pair_t, hb_shapers_lazy_loader_t> diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper.hh index fb04bbc3cf5..361165e4f95 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-shaper.hh @@ -24,10 +24,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_SHAPER_PRIVATE_HH -#define HB_SHAPER_PRIVATE_HH +#ifndef HB_SHAPER_HH +#define HB_SHAPER_HH -#include "hb-private.hh" +#include "hb.hh" typedef hb_bool_t hb_shape_func_t (hb_shape_plan_t *shape_plan, hb_font_t *font, @@ -131,4 +131,4 @@ struct hb_shaper_data_t { #define HB_SHAPERS_COUNT (sizeof (hb_shaper_data_t) / sizeof (void *)) -#endif /* HB_SHAPER_PRIVATE_HH */ +#endif /* HB_SHAPER_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-static.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-static.cc index ddecbba1154..5112d77be0a 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-static.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-static.cc @@ -24,12 +24,12 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" -#include "hb-open-type-private.hh" -#include "hb-ot-layout-common-private.hh" +#include "hb-open-type.hh" +#include "hb-ot-layout-common.hh" -#include "hb-face-private.hh" +#include "hb-face.hh" #include "hb-ot-head-table.hh" #include "hb-ot-maxp-table.hh" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-string-array.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-string-array.hh index 679841c87d2..c4cf666d721 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-string-array.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-string-array.hh @@ -29,7 +29,7 @@ #define HB_STRING_ARRAY_HH #endif -#include "hb-private.hh" +#include "hb.hh" /* Based on Bruno Haible's code in Appendix B of Ulrich Drepper's dsohowto.pdf: * https://software.intel.com/sites/default/files/m/a/1/e/dsohowto.pdf */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-glyf.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-glyf.cc index 36af3beae72..499380a9773 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-glyf.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-glyf.cc @@ -24,11 +24,10 @@ * Google Author(s): Garret Rieger, Roderick Sheeter */ -#include "hb-open-type-private.hh" +#include "hb-open-type.hh" #include "hb-ot-glyf-table.hh" #include "hb-set.h" #include "hb-subset-glyf.hh" -#include "hb-subset-plan.hh" static bool _calculate_glyf_and_loca_prime_size (const OT::glyf::accelerator_t &glyf, diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-glyf.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-glyf.hh index 99b76db9bbe..3109ecb643a 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-glyf.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-glyf.hh @@ -27,9 +27,9 @@ #ifndef HB_SUBSET_GLYF_HH #define HB_SUBSET_GLYF_HH -#include "hb-private.hh" +#include "hb.hh" -#include "hb-subset-plan.hh" +#include "hb-subset.hh" HB_INTERNAL bool hb_subset_glyf_and_loca (hb_subset_plan_t *plan, diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-input.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-input.cc index 74470fd1fa5..d59b5bae03c 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-input.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-input.cc @@ -24,8 +24,8 @@ * Google Author(s): Garret Rieger, Rod Sheeter, Behdad Esfahbod */ -#include "hb-subset-private.hh" -#include "hb-set-private.hh" +#include "hb-subset.hh" +#include "hb-set.hh" /** * hb_subset_input_create_or_fail: @@ -44,7 +44,7 @@ hb_subset_input_create_or_fail (void) input->unicodes = hb_set_create (); input->glyphs = hb_set_create (); - input->drop_ot_layout = true; + input->drop_layout = true; return input; } @@ -106,30 +106,28 @@ hb_subset_input_glyph_set (hb_subset_input_t *subset_input) return subset_input->glyphs; } -/** - * hb_subset_input_drop_hints: - * @subset_input: a subset_input. - * - * Since: 1.8.0 - **/ -HB_EXTERN hb_bool_t * -hb_subset_input_drop_hints (hb_subset_input_t *subset_input) +HB_EXTERN void +hb_subset_input_set_drop_hints (hb_subset_input_t *subset_input, + hb_bool_t drop_hints) { - return &subset_input->drop_hints; + subset_input->drop_hints = drop_hints; } -/** - * hb_subset_input_drop_ot_layout: - * @subset_input: a subset_input. - * - * If enabled ot layout tables will be dropped as part of - * the subsetting operation. Currently this defaults to - * true. - * - * Since: REPLACEME - **/ -HB_EXTERN hb_bool_t * -hb_subset_input_drop_ot_layout (hb_subset_input_t *subset_input) +HB_EXTERN hb_bool_t +hb_subset_input_get_drop_hints (hb_subset_input_t *subset_input) +{ + return subset_input->drop_hints; +} + +HB_EXTERN void +hb_subset_input_set_drop_layout (hb_subset_input_t *subset_input, + hb_bool_t drop_layout) +{ + subset_input->drop_layout = drop_layout; +} + +HB_EXTERN hb_bool_t +hb_subset_input_get_drop_layout (hb_subset_input_t *subset_input) { - return &subset_input->drop_ot_layout; + return subset_input->drop_layout; } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-input.hh index 6b2b207fff6..9fc86154e40 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-input.hh @@ -24,27 +24,26 @@ * Google Author(s): Garret Rieger, Roderick Sheeter */ -#ifndef HB_SUBSET_PRIVATE_HH -#define HB_SUBSET_PRIVATE_HH +#ifndef HB_SUBSET_INPUT_HH +#define HB_SUBSET_INPUT_HH -#include "hb-private.hh" +#include "hb.hh" #include "hb-subset.h" -#include "hb-font-private.hh" +#include "hb-font.hh" -typedef struct hb_subset_face_data_t hb_subset_face_data_t; - -struct hb_subset_input_t { +struct hb_subset_input_t +{ hb_object_header_t header; ASSERT_POD (); hb_set_t *unicodes; hb_set_t *glyphs; - hb_bool_t drop_hints; - hb_bool_t drop_ot_layout; + bool drop_hints : 1; + bool drop_layout : 1; /* TODO * * features @@ -54,10 +53,5 @@ struct hb_subset_input_t { */ }; -HB_INTERNAL hb_face_t * -hb_subset_face_create (void); - -HB_INTERNAL hb_bool_t -hb_subset_face_add_table (hb_face_t *face, hb_tag_t tag, hb_blob_t *blob); -#endif /* HB_SUBSET_PRIVATE_HH */ +#endif /* HB_SUBSET_INPUT_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc index 12566827251..0570060399d 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.cc @@ -24,11 +24,10 @@ * Google Author(s): Garret Rieger, Roderick Sheeter */ -#include "hb-map-private.hh" -#include "hb-subset-private.hh" -#include "hb-set-private.hh" - #include "hb-subset-plan.hh" +#include "hb-map.hh" +#include "hb-set.hh" + #include "hb-ot-cmap-table.hh" #include "hb-ot-glyf-table.hh" @@ -69,7 +68,7 @@ _gsub_closure (hb_face_t *face, hb_set_t *gids_to_retain) } -static void +static hb_set_t * _populate_gids_to_retain (hb_face_t *face, const hb_set_t *unicodes, bool close_over_gsub, @@ -118,9 +117,10 @@ _populate_gids_to_retain (hb_face_t *face, while (all_gids_to_retain->next (&gid)) glyphs->push (gid); - hb_set_destroy (all_gids_to_retain); glyf.fini (); cmap.fini (); + + return all_gids_to_retain; } static void @@ -135,7 +135,7 @@ _create_old_gid_to_new_gid_map (const hb_vector_t<hb_codepoint_t> &glyphs, /** * hb_subset_plan_create: * Computes a plan for subsetting the supplied face according - * to a provide profile and input. The plan describes + * to a provided input. The plan describes * which tables and glyphs should be retained. * * Return value: New subset plan. @@ -144,26 +144,24 @@ _create_old_gid_to_new_gid_map (const hb_vector_t<hb_codepoint_t> &glyphs, **/ hb_subset_plan_t * hb_subset_plan_create (hb_face_t *face, - hb_subset_profile_t *profile, hb_subset_input_t *input) { hb_subset_plan_t *plan = hb_object_create<hb_subset_plan_t> (); plan->drop_hints = input->drop_hints; - plan->drop_ot_layout = input->drop_ot_layout; + plan->drop_layout = input->drop_layout; plan->unicodes = hb_set_create(); plan->glyphs.init(); plan->source = hb_face_reference (face); - plan->dest = hb_subset_face_create (); + plan->dest = hb_face_builder_create (); plan->codepoint_to_glyph = hb_map_create(); plan->glyph_map = hb_map_create(); - - _populate_gids_to_retain (face, - input->unicodes, - !plan->drop_ot_layout, - plan->unicodes, - plan->codepoint_to_glyph, - &plan->glyphs); + plan->glyphset = _populate_gids_to_retain (face, + input->unicodes, + !plan->drop_layout, + plan->unicodes, + plan->codepoint_to_glyph, + &plan->glyphs); _create_old_gid_to_new_gid_map (plan->glyphs, plan->glyph_map); @@ -186,6 +184,7 @@ hb_subset_plan_destroy (hb_subset_plan_t *plan) hb_face_destroy (plan->dest); hb_map_destroy (plan->codepoint_to_glyph); hb_map_destroy (plan->glyph_map); + hb_set_destroy (plan->glyphset); free (plan); } diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.hh index 7501294d702..c2c484a5bef 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset-plan.hh @@ -27,27 +27,26 @@ #ifndef HB_SUBSET_PLAN_HH #define HB_SUBSET_PLAN_HH -#include "hb-private.hh" +#include "hb.hh" #include "hb-subset.h" -#include "hb-subset-private.hh" +#include "hb-subset-input.hh" -#include "hb-map-private.hh" +#include "hb-map.hh" struct hb_subset_plan_t { hb_object_header_t header; ASSERT_POD (); - hb_bool_t drop_hints; - hb_bool_t drop_ot_layout; + bool drop_hints : 1; + bool drop_layout : 1; // For each cp that we'd like to retain maps to the corresponding gid. hb_set_t *unicodes; - // This list contains the complete set of glyphs to retain and may contain - // more glyphs then the lists above. hb_vector_t<hb_codepoint_t> glyphs; + hb_set_t *glyphset; hb_map_t *codepoint_to_glyph; hb_map_t *glyph_map; @@ -56,7 +55,7 @@ struct hb_subset_plan_t hb_face_t *source; hb_face_t *dest; - inline hb_bool_t + inline bool new_gid_for_codepoint (hb_codepoint_t codepoint, hb_codepoint_t *new_gid) const { @@ -67,7 +66,7 @@ struct hb_subset_plan_t return new_gid_for_old_gid (old_gid, new_gid); } - inline hb_bool_t + inline bool new_gid_for_old_gid (hb_codepoint_t old_gid, hb_codepoint_t *new_gid) const { @@ -79,7 +78,7 @@ struct hb_subset_plan_t return true; } - inline hb_bool_t + inline bool add_table (hb_tag_t tag, hb_blob_t *contents) { @@ -89,7 +88,7 @@ struct hb_subset_plan_t hb_blob_get_length (contents), hb_blob_get_length (source_blob)); hb_blob_destroy (source_blob); - return hb_subset_face_add_table(dest, tag, contents); + return hb_face_builder_add_table (dest, tag, contents); } }; @@ -97,7 +96,6 @@ typedef struct hb_subset_plan_t hb_subset_plan_t; HB_INTERNAL hb_subset_plan_t * hb_subset_plan_create (hb_face_t *face, - hb_subset_profile_t *profile, hb_subset_input_t *input); HB_INTERNAL void diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc index 411c6b861c7..b714f291a88 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.cc @@ -24,14 +24,13 @@ * Google Author(s): Garret Rieger, Rod Sheeter, Behdad Esfahbod */ -#include "hb-private.hh" -#include "hb-open-type-private.hh" +#include "hb.hh" +#include "hb-open-type.hh" +#include "hb-subset.hh" #include "hb-subset-glyf.hh" -#include "hb-subset-private.hh" -#include "hb-subset-plan.hh" -#include "hb-open-file-private.hh" +#include "hb-open-file.hh" #include "hb-ot-cmap-table.hh" #include "hb-ot-glyf-table.hh" #include "hb-ot-hdmx-table.hh" @@ -41,42 +40,26 @@ #include "hb-ot-maxp-table.hh" #include "hb-ot-os2-table.hh" #include "hb-ot-post-table.hh" +#include "hb-ot-layout-gsub-table.hh" +#include "hb-ot-layout-gpos-table.hh" -struct hb_subset_profile_t { - hb_object_header_t header; - ASSERT_POD (); -}; - -/** - * hb_subset_profile_create: - * - * Return value: New profile with default settings. - * - * Since: 1.8.0 - **/ -hb_subset_profile_t * -hb_subset_profile_create () +static unsigned int +_plan_estimate_subset_table_size (hb_subset_plan_t *plan, + unsigned int table_len) { - return hb_object_create<hb_subset_profile_t>(); -} + unsigned int src_glyphs = plan->source->get_num_glyphs (); + unsigned int dst_glyphs = plan->glyphset->get_population (); -/** - * hb_subset_profile_destroy: - * - * Since: 1.8.0 - **/ -void -hb_subset_profile_destroy (hb_subset_profile_t *profile) -{ - if (!hb_object_destroy (profile)) return; + if (unlikely (!src_glyphs)) + return 512 + table_len; - free (profile); + return 512 + (unsigned int) (table_len * sqrt ((double) dst_glyphs / src_glyphs)); } template<typename TableType> static bool -_subset (hb_subset_plan_t *plan) +_subset2 (hb_subset_plan_t *plan) { hb_blob_t *source_blob = hb_sanitize_context_t ().reference_table<TableType> (plan->source); const TableType *table = source_blob->as<TableType> (); @@ -85,145 +68,69 @@ _subset (hb_subset_plan_t *plan) hb_bool_t result = false; if (source_blob->data) { - result = table->subset(plan); - } else { - DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG(tag)); + hb_auto_t<hb_vector_t<char> > buf; + unsigned int buf_size = _plan_estimate_subset_table_size (plan, source_blob->length); + DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c initial estimated table size: %u bytes.", HB_UNTAG(tag), buf_size); + if (unlikely (!buf.alloc (buf_size))) + { + DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG(tag), buf_size); + return false; + } + retry: + hb_serialize_context_t serializer (buf.arrayZ, buf_size); + hb_subset_context_t c (plan, &serializer); + result = table->subset (&c); + if (serializer.ran_out_of_room) + { + buf_size += (buf_size >> 1) + 32; + DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.", HB_UNTAG(tag), buf_size); + if (unlikely (!buf.alloc (buf_size))) + { + DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c failed to reallocate %u bytes.", HB_UNTAG(tag), buf_size); + return false; + } + goto retry; + } + if (result) + { + hb_blob_t *dest_blob = serializer.copy_blob (); + DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c final subset table size: %u bytes.", HB_UNTAG(tag), dest_blob->length); + result = c.plan->add_table (tag, dest_blob); + hb_blob_destroy (dest_blob); + } + else + { + DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c::subset table subsetted to empty.", HB_UNTAG(tag)); + result = true; + } } + else + DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG(tag)); hb_blob_destroy (source_blob); DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c::subset %s", HB_UNTAG(tag), result ? "success" : "FAILED!"); return result; } - -/* - * A face that has add_table(). - */ - -struct hb_subset_face_data_t -{ - struct table_entry_t - { - inline int cmp (const hb_tag_t *t) const - { - if (*t < tag) return -1; - if (*t > tag) return -1; - return 0; - } - - hb_tag_t tag; - hb_blob_t *blob; - }; - - hb_vector_t<table_entry_t, 32> tables; -}; - -static hb_subset_face_data_t * -_hb_subset_face_data_create (void) -{ - hb_subset_face_data_t *data = (hb_subset_face_data_t *) calloc (1, sizeof (hb_subset_face_data_t)); - if (unlikely (!data)) - return nullptr; - - data->tables.init (); - - return data; -} - -static void -_hb_subset_face_data_destroy (void *user_data) -{ - hb_subset_face_data_t *data = (hb_subset_face_data_t *) user_data; - - for (unsigned int i = 0; i < data->tables.len; i++) - hb_blob_destroy (data->tables[i].blob); - - data->tables.fini (); - - free (data); -} - -static hb_blob_t * -_hb_subset_face_data_reference_blob (hb_subset_face_data_t *data) -{ - - unsigned int table_count = data->tables.len; - unsigned int face_length = table_count * 16 + 12; - - for (unsigned int i = 0; i < table_count; i++) - face_length += hb_ceil_to_4 (hb_blob_get_length (data->tables.arrayZ[i].blob)); - - char *buf = (char *) malloc (face_length); - if (unlikely (!buf)) - return nullptr; - - hb_serialize_context_t c (buf, face_length); - OT::OpenTypeFontFile *f = c.start_serialize<OT::OpenTypeFontFile> (); - - bool is_cff = data->tables.lsearch (HB_TAG ('C','F','F',' ')) || data->tables.lsearch (HB_TAG ('C','F','F','2')); - hb_tag_t sfnt_tag = is_cff ? OT::OpenTypeFontFile::CFFTag : OT::OpenTypeFontFile::TrueTypeTag; - - Supplier<hb_tag_t> tags_supplier (&data->tables[0].tag, table_count, sizeof (data->tables[0])); - Supplier<hb_blob_t *> blobs_supplier (&data->tables[0].blob, table_count, sizeof (data->tables[0])); - bool ret = f->serialize_single (&c, - sfnt_tag, - tags_supplier, - blobs_supplier, - table_count); - - c.end_serialize (); - - if (unlikely (!ret)) - { - free (buf); - return nullptr; - } - - return hb_blob_create (buf, face_length, HB_MEMORY_MODE_WRITABLE, buf, free); -} - -static hb_blob_t * -_hb_subset_face_reference_table (hb_face_t *face, hb_tag_t tag, void *user_data) +template<typename TableType> +static bool +_subset (hb_subset_plan_t *plan) { - hb_subset_face_data_t *data = (hb_subset_face_data_t *) user_data; - - if (!tag) - return _hb_subset_face_data_reference_blob (data); - - hb_subset_face_data_t::table_entry_t *entry = data->tables.lsearch (tag); - if (entry) - return hb_blob_reference (entry->blob); - - return nullptr; -} + hb_blob_t *source_blob = hb_sanitize_context_t ().reference_table<TableType> (plan->source); + const TableType *table = source_blob->as<TableType> (); -/* TODO: Move this to hb-face.h and rename to hb_face_builder_create() - * with hb_face_builder_add_table(). */ -hb_face_t * -hb_subset_face_create (void) -{ - hb_subset_face_data_t *data = _hb_subset_face_data_create (); - if (unlikely (!data)) return hb_face_get_empty (); + hb_tag_t tag = TableType::tableTag; + hb_bool_t result = false; + if (source_blob->data) + result = table->subset (plan); + else + DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c::subset sanitize failed on source table.", HB_UNTAG(tag)); - return hb_face_create_for_tables (_hb_subset_face_reference_table, - data, - _hb_subset_face_data_destroy); + hb_blob_destroy (source_blob); + DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c::subset %s", HB_UNTAG(tag), result ? "success" : "FAILED!"); + return result; } -hb_bool_t -hb_subset_face_add_table (hb_face_t *face, hb_tag_t tag, hb_blob_t *blob) -{ - if (unlikely (face->destroy != (hb_destroy_func_t) _hb_subset_face_data_destroy)) - return false; - - hb_subset_face_data_t *data = (hb_subset_face_data_t *) face->user_data; - hb_subset_face_data_t::table_entry_t *entry = data->tables.push (); - - entry->tag = tag; - entry->blob = hb_blob_reference (blob); - - return true; -} static bool _subset_table (hb_subset_plan_t *plan, @@ -270,6 +177,14 @@ _subset_table (hb_subset_plan_t *plan, case HB_OT_TAG_post: result = _subset<const OT::post> (plan); break; + + case HB_OT_TAG_GSUB: + //result = _subset2<const OT::GSUB> (plan); + break; + case HB_OT_TAG_GPOS: + //result = _subset2<const OT::GPOS> (plan); + break; + default: hb_blob_t *source_table = hb_face_reference_table(plan->source, tag); if (likely (source_table)) @@ -298,7 +213,7 @@ _should_drop_table(hb_subset_plan_t *plan, hb_tag_t tag) case HB_TAG ('G', 'D', 'E', 'F'): /* temporary */ case HB_TAG ('G', 'P', 'O', 'S'): /* temporary */ case HB_TAG ('G', 'S', 'U', 'B'): /* temporary */ - return plan->drop_ot_layout; + return plan->drop_layout; // Drop these tables below by default, list pulled // from fontTools: case HB_TAG ('B', 'A', 'S', 'E'): @@ -327,19 +242,17 @@ _should_drop_table(hb_subset_plan_t *plan, hb_tag_t tag) /** * hb_subset: * @source: font face data to be subset. - * @profile: profile to use for the subsetting. * @input: input to use for the subsetting. * - * Subsets a font according to provided profile and input. + * Subsets a font according to provided input. **/ hb_face_t * hb_subset (hb_face_t *source, - hb_subset_profile_t *profile, hb_subset_input_t *input) { - if (unlikely (!profile || !input || !source)) return hb_face_get_empty(); + if (unlikely (!input || !source)) return hb_face_get_empty(); - hb_subset_plan_t *plan = hb_subset_plan_create (source, profile, input); + hb_subset_plan_t *plan = hb_subset_plan_create (source, input); hb_tag_t table_tags[32]; unsigned int offset = 0, count; @@ -358,23 +271,9 @@ hb_subset (hb_face_t *source, success = success && _subset_table (plan, tag); } offset += count; - } while (count == ARRAY_LENGTH (table_tags)); + } while (success && count == ARRAY_LENGTH (table_tags)); hb_face_t *result = success ? hb_face_reference(plan->dest) : hb_face_get_empty(); hb_subset_plan_destroy (plan); return result; } - -/** - * hb_subset_get_all_codepoints: - * @source: font face data to load. - * @out: set to add the all codepoints covered by font face, source. - */ -void -hb_subset_get_all_codepoints (hb_face_t *source, hb_set_t *out) -{ - OT::cmap::accelerator_t cmap; - cmap.init (source); - cmap.get_all_codepoints (out); - cmap.fini(); -} diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.h b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.h index f6d2ae0a01b..8b07a45e923 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.h +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.h @@ -32,20 +32,6 @@ HB_BEGIN_DECLS /* - * hb_subset_profile_t - * Things that change based on target environment, e.g. OS. - * Threadsafe for multiple concurrent subset operations. - */ - -typedef struct hb_subset_profile_t hb_subset_profile_t; - -HB_EXTERN hb_subset_profile_t * -hb_subset_profile_create (void); - -HB_EXTERN void -hb_subset_profile_destroy (hb_subset_profile_t *profile); - -/* * hb_subset_input_t * * Things that change based on the input. Characters to keep, etc. @@ -68,21 +54,24 @@ hb_subset_input_unicode_set (hb_subset_input_t *subset_input); HB_EXTERN hb_set_t * hb_subset_input_glyph_set (hb_subset_input_t *subset_input); -HB_EXTERN hb_bool_t * -hb_subset_input_drop_hints (hb_subset_input_t *subset_input); +HB_EXTERN void +hb_subset_input_set_drop_hints (hb_subset_input_t *subset_input, + hb_bool_t drop_hints); +HB_EXTERN hb_bool_t +hb_subset_input_get_drop_hints (hb_subset_input_t *subset_input); + +HB_EXTERN void +hb_subset_input_set_drop_layout (hb_subset_input_t *subset_input, + hb_bool_t drop_layout); +HB_EXTERN hb_bool_t +hb_subset_input_get_drop_layout (hb_subset_input_t *subset_input); -HB_EXTERN hb_bool_t * -hb_subset_input_drop_ot_layout (hb_subset_input_t *subset_input); /* hb_subset() */ HB_EXTERN hb_face_t * hb_subset (hb_face_t *source, - hb_subset_profile_t *profile, hb_subset_input_t *input); -/* hb_subset_get_all_codepoints */ -HB_EXTERN void -hb_subset_get_all_codepoints (hb_face_t *source, hb_set_t *out); HB_END_DECLS diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.hh new file mode 100644 index 00000000000..9cdd388d780 --- /dev/null +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-subset.hh @@ -0,0 +1,60 @@ +/* + * Copyright © 2018 Google, Inc. + * + * This is part of HarfBuzz, a text shaping library. + * + * Permission is hereby granted, without written agreement and without + * license or royalty fees, to use, copy, modify, and distribute this + * software and its documentation for any purpose, provided that the + * above copyright notice and the following two paragraphs appear in + * all copies of this software. + * + * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR + * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN + * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + * DAMAGE. + * + * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, + * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO + * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + * + * Google Author(s): Garret Rieger, Roderick Sheeter + */ + +#ifndef HB_SUBSET_HH +#define HB_SUBSET_HH + + +#include "hb.hh" + +#include "hb-subset.h" + +#include "hb-machinery.hh" +#include "hb-subset-input.hh" +#include "hb-subset-plan.hh" + +struct hb_subset_context_t : + hb_dispatch_context_t<hb_subset_context_t, bool, HB_DEBUG_SUBSET> +{ + inline const char *get_name (void) { return "SUBSET"; } + template <typename T> + inline bool dispatch (const T &obj) { return obj.subset (this); } + static bool default_return_value (void) { return true; } + bool stop_sublookup_iteration (bool r) const { return false; } + + hb_subset_plan_t *plan; + hb_serialize_context_t *serializer; + unsigned int debug_depth; + + hb_subset_context_t (hb_subset_plan_t *plan_, + hb_serialize_context_t *serializer_) : + plan (plan_), + serializer (serializer_), + debug_depth (0) {} +}; + + +#endif /* HB_SUBSET_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ucdn.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ucdn.cc index 56d13e7cd28..624c1eb4163 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ucdn.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-ucdn.cc @@ -14,10 +14,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include "hb-private.hh" +#include "hb.hh" -#include "hb-unicode-private.hh" -#include "hb-machinery-private.hh" +#include "hb-unicode.hh" +#include "hb-machinery.hh" #include "ucdn.h" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode.cc index 8cb41723398..bb1cd6821ee 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode.cc @@ -28,9 +28,9 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" -#include "hb-unicode-private.hh" +#include "hb-unicode.hh" @@ -450,7 +450,7 @@ hb_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs, } -/* See hb-unicode-private.hh for details. */ +/* See hb-unicode.hh for details. */ const uint8_t _hb_modified_combining_class[256] = { diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode.h b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode.h index 2657f481300..c8d87e4d1d2 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode.h +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode.h @@ -40,6 +40,14 @@ HB_BEGIN_DECLS +/** + * HB_UNICODE_MAX + * + * Since: 1.9.0 + */ +#define HB_UNICODE_MAX 0x10FFFFu + + /* hb_unicode_general_category_t */ /* Unicode Character Database property: General_Category (gc) */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode.hh index fb16ba437ed..e6bca5f08c8 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-unicode.hh @@ -28,10 +28,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_UNICODE_PRIVATE_HH -#define HB_UNICODE_PRIVATE_HH +#ifndef HB_UNICODE_HH +#define HB_UNICODE_HH -#include "hb-private.hh" +#include "hb.hh" extern HB_INTERNAL const uint8_t _hb_modified_combining_class[256]; @@ -366,4 +366,4 @@ DECLARE_NULL_INSTANCE (hb_unicode_funcs_t); FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) | \ FLAG (HB_UNICODE_GENERAL_CATEGORY_MODIFIER_SYMBOL))) -#endif /* HB_UNICODE_PRIVATE_HH */ +#endif /* HB_UNICODE_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-uniscribe.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-uniscribe.cc index 11b7384fa77..4a77c8c1f41 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-uniscribe.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-uniscribe.cc @@ -24,9 +24,9 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" #define HB_SHAPER uniscribe -#include "hb-shaper-impl-private.hh" +#include "hb-shaper-impl.hh" #include <windows.h> #include <usp10.h> @@ -34,7 +34,7 @@ #include "hb-uniscribe.h" -#include "hb-open-file-private.hh" +#include "hb-open-file.hh" #include "hb-ot-name-table.hh" #include "hb-ot-tag.h" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-utf-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-utf.hh index 211eb4dc023..eccb632e489 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-utf-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-utf.hh @@ -24,10 +24,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_UTF_PRIVATE_HH -#define HB_UTF_PRIVATE_HH +#ifndef HB_UTF_HH +#define HB_UTF_HH -#include "hb-private.hh" +#include "hb.hh" struct hb_utf8_t @@ -279,4 +279,4 @@ struct hb_latin1_t } }; -#endif /* HB_UTF_PRIVATE_HH */ +#endif /* HB_UTF_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-vector-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-vector.hh index 1ef20d43863..da548cbb12f 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-vector-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-vector.hh @@ -25,10 +25,10 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_VECTOR_PRIVATE_HH -#define HB_VECTOR_PRIVATE_HH +#ifndef HB_VECTOR_HH +#define HB_VECTOR_HH -#include "hb-private.hh" +#include "hb.hh" template <typename Type, unsigned int StaticSize=8> @@ -72,6 +72,8 @@ struct hb_vector_t return p; } + inline bool in_error (void) const { return allocated == 0; } + /* Allocate for size but don't adjust len. */ inline bool alloc (unsigned int size) { @@ -235,4 +237,4 @@ struct hb_vector_t }; -#endif /* HB_VECTOR_PRIVATE_HH */ +#endif /* HB_VECTOR_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-warning.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-warning.cc index f7a87b5abf9..9fb41003808 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-warning.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-warning.cc @@ -24,14 +24,14 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" #if defined(HB_ATOMIC_INT_NIL) #error "Could not find any system to define atomic_int macros, library WILL NOT be thread-safe" -#error "Check hb-atomic-private.hh for possible resolutions." +#error "Check hb-atomic.hh for possible resolutions." #endif #if defined(HB_MUTEX_IMPL_NIL) #error "Could not find any system to define mutex macros, library WILL NOT be thread-safe" -#error "Check hb-mutex-private.hh for possible resolutions." +#error "Check hb-mutex.hh for possible resolutions." #endif diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb.hh index efe7bda9e38..557ae6b35d9 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/hb-private.hh +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/hb.hh @@ -26,8 +26,8 @@ * Google Author(s): Behdad Esfahbod */ -#ifndef HB_PRIVATE_HH -#define HB_PRIVATE_HH +#ifndef HB_HH +#define HB_HH #define _GNU_SOURCE 1 @@ -470,11 +470,11 @@ _hb_memalign(void **memptr, size_t alignment, size_t size) /* Headers we include for everyone. Keep sorted. They express dependency amongst * themselves, but no other file should include them.*/ -#include "hb-atomic-private.hh" +#include "hb-atomic.hh" #include "hb-debug.hh" #include "hb-dsalgs.hh" -#include "hb-mutex-private.hh" +#include "hb-mutex.hh" #include "hb-null.hh" -#include "hb-object-private.hh" +#include "hb-object.hh" -#endif /* HB_PRIVATE_HH */ +#endif /* HB_HH */ diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/main.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/main.cc index 98a1320bfb0..490b76e5b6d 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/main.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/main.cc @@ -25,9 +25,9 @@ */ #include "hb-static.cc" -#include "hb-open-file-private.hh" +#include "hb-open-file.hh" #include "hb-ot-layout-gdef-table.hh" -#include "hb-ot-layout-gsubgpos-private.hh" +#include "hb-ot-layout-gsubgpos.hh" #ifdef HAVE_GLIB #include <glib.h> diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/test-buffer-serialize.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-buffer-serialize.cc index 39eb13da7f2..a91f4f7e938 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/test-buffer-serialize.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-buffer-serialize.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" #include "hb.h" #include "hb-ot.h" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/test-size-params.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-size-params.cc index 3c43852b3a0..e53a47d8df6 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/test-size-params.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-size-params.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" #include "hb.h" #include "hb-ot.h" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/test-unicode-ranges.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-unicode-ranges.cc index dbc5fa426de..1334ea030f9 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/test-unicode-ranges.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-unicode-ranges.cc @@ -24,7 +24,7 @@ * Google Author(s): Garret Rieger */ -#include "hb-private.hh" +#include "hb.hh" #include "hb-ot-os2-unicode-ranges.hh" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/test-would-substitute.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-would-substitute.cc index 1836d720cc2..268f7db9805 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/test-would-substitute.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/test-would-substitute.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" #include "hb.h" #include "hb-ot.h" diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/test.cc b/Build/source/libs/harfbuzz/harfbuzz-src/src/test.cc index cf59e00ac87..f0eace8c435 100644 --- a/Build/source/libs/harfbuzz/harfbuzz-src/src/test.cc +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/test.cc @@ -24,7 +24,7 @@ * Google Author(s): Behdad Esfahbod */ -#include "hb-private.hh" +#include "hb.hh" #include "hb.h" |